MG32L003 Standard Peripherals Firmware Library
Modules | Data Structures | Functions

PCA driver modules. More...

Modules

 PCA_Exported_Constants
 
 PCA_Private_Functions
 

Data Structures

struct  PCA_BaseInitTypeDef
 PCA Configuration Structure definition. More...
 
struct  PCA_IC_InitTypeDef
 PCA Input Capture Configuration Structure definition. More...
 
struct  PCA_OC_InitTypeDef
 PCA Output Compare Configuration Structure definition. More...
 

Functions

void PCA_BaseInit (PCA_BaseInitTypeDef *PCA_InitStruct)
 Initializes the PCA Unit basic function according to the specified parameters in the PCA_HandleTypeDef. More...
 
void PCA_OC_Config (PCA_OC_InitTypeDef *OC_Config)
 Initializes the PCA output compare Channels according to the specified parameters in the PCA_OC_InitTypeDef. More...
 
void PCA_IC_Config (PCA_IC_InitTypeDef *IC_Config)
 Initializes the PCA input capture Channels according to the specified parameters in the PCA_IC_InitTypeDef. More...
 
uint16_t PCA_GetCompareValue (uint32_t Channel)
 Gets the PCA Capture Compare Register value on runtime. More...
 
void PCA_Cmd (FunctionalState NewState)
 Enables or disables the PCA peripheral. More...
 
void PCA_OC_Cmd (uint32_t Channel, FunctionalState NewState)
 Enables or disables the PCA output compare generation. More...
 
void PCA_OC_INVCmd (uint32_t Channel, FunctionalState NewState)
 Enables or disables the PCA inverse output compare generation. More...
 
void PCA_DeInit (void)
 Deinitializes the PCA peripheral registers to their default reset values. More...
 
void PCA_ITConfig (uint8_t PCA_IT, FunctionalState NewState)
 Enables or disables the specified PCA interrupt. More...
 
FlagStatus PCA_GetFlagStatus (uint8_t PCA_FLAG)
 Checks whether the specified PCA flag is set or not. More...
 
ITStatus PCA_GetITStatus (uint8_t PCA_IT)
 Checks whether the specified PCA interrupt is set or not. More...
 
void PCA_ClearITPendingBit (uint8_t PCA_IT)
 Clears the PCA's interrupt pending bits. More...
 
void PCA_ClearFlag (uint8_t PCA_FLAG)
 Clears the PCA's pending flags. More...
 
void PCA_SetPWMDuty (uint32_t Channel, uint8_t Duty)
 Sets PCA PWM ouput duty cycle. More...
 
void PCA_IC0_TriggerConfig (uint32_t PCA_Trigger_ICPolarity)
 Configures the Channel0 (PCA Input capture). More...
 
void PCA_IC1_TriggerConfig (uint32_t PCA_Trigger_ICPolarity)
 Configures the Channel1 (PCA Input capture). More...
 
void PCA_IC2_TriggerConfig (uint32_t PCA_Trigger_ICPolarity)
 Configures the Channel2 (PCA Input capture). More...
 
void PCA_IC3_TriggerConfig (uint32_t PCA_Trigger_ICPolarity)
 Configures the Channel3 (PCA Input capture). More...
 
void PCA_IC4_TriggerConfig (uint32_t PCA_Trigger_ICPolarity)
 Configures the Channel4 (PCA Input capture). More...
 

Detailed Description

PCA driver modules.

Function Documentation

◆ PCA_BaseInit()

void PCA_BaseInit ( PCA_BaseInitTypeDef PCA_InitStruct)

Initializes the PCA Unit basic function according to the specified parameters in the PCA_HandleTypeDef.

Parameters
PCA_InitStruct: Ponter to PCA base initialization structure.
Return values
None

◆ PCA_ClearFlag()

void PCA_ClearFlag ( uint8_t  PCA_FLAG)

Clears the PCA's pending flags.

Parameters
PCA_FLAGspecifies the flags to clear. This parameter can be one of the following values:
  • PCA_FLAG_CC0: PCA Capture/Compare 0 interrupt flag
  • PCA_FLAG_CC1: PCA Capture/Compare 1 interrupt flag
  • PCA_FLAG_CC2: PCA Capture/Compare 2 interrupt flag
  • PCA_FLAG_CC3: PCA Capture/Compare 3 interrupt flag
  • PCA_FLAG_CC4: PCA Capture/Compare 4 interrupt flag
  • PCA_FLAG_OVERFLOW: PCA count overflow interrupt flag
Return values
None

◆ PCA_ClearITPendingBit()

void PCA_ClearITPendingBit ( uint8_t  PCA_IT)

Clears the PCA's interrupt pending bits.

Parameters
PCA_ITspecifies the PCA interrupt pending bits to clear. This parameter can be any combination of the following values:
  • PCA_IT_CC0: PCA Capture/Compare 0 interrupt
  • PCA_IT_CC1: PCA Capture/Compare 1 interrupt
  • PCA_IT_CC2: PCA Capture/Compare 2 interrupt
  • PCA_IT_CC3: PCA Capture/Compare 3 interrupt
  • PCA_IT_CC4: PCA Capture/Compare 4 interrupt
  • PCA_IT_OVERFLOW: PCA counter overflow interrupt
Return values
None

◆ PCA_Cmd()

void PCA_Cmd ( FunctionalState  NewState)

Enables or disables the PCA peripheral.

Parameters
NewStateThe new state of the PCA peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ PCA_DeInit()

void PCA_DeInit ( void  )

Deinitializes the PCA peripheral registers to their default reset values.

Parameters
None
Return values
None

◆ PCA_GetCompareValue()

uint16_t PCA_GetCompareValue ( uint32_t  Channel)

Gets the PCA Capture Compare Register value on runtime.

Parameters
Channel: PCA Channel associated with the capture compare register. This parameter can be one of the following values:
  • PCA_CHANNEL_0: PCA Capture/Compare channel0
  • PCA_CHANNEL_1: PCA Capture/Compare channel1
  • PCA_CHANNEL_2: PCA Capture/Compare channel2
  • PCA_CHANNEL_3: PCA Capture/Compare channel3
  • PCA_CHANNEL_4: PCA Capture/Compare channel4
Return values
16-bitvalue of the capture/compare register (PCA_CCAPx)

◆ PCA_GetFlagStatus()

FlagStatus PCA_GetFlagStatus ( uint8_t  PCA_FLAG)

Checks whether the specified PCA flag is set or not.

Parameters
PCA_FLAGspecifies the flag to check. This parameter can be any combination of the following values:
  • PCA_FLAG_CC0: PCA Capture/Compare 0 interrupt flag
  • PCA_FLAG_CC1: PCA Capture/Compare 1 interrupt flag
  • PCA_FLAG_CC2: PCA Capture/Compare 2 interrupt flag
  • PCA_FLAG_CC3: PCA Capture/Compare 3 interrupt flag
  • PCA_FLAG_CC4: PCA Capture/Compare 4 interrupt flag
  • PCA_FLAG_OVERFLOW: PCA count overflow interrupt flag
Return values
Thenew state of PCA_FLAG (SET or RESET).

◆ PCA_GetITStatus()

ITStatus PCA_GetITStatus ( uint8_t  PCA_IT)

Checks whether the specified PCA interrupt is set or not.

Parameters
PCA_FLAGspecifies the interrupt to check. This parameter can be any combination of the following values:
  • PCA_IT_CC0: PCA Capture/Compare 0 interrupt
  • PCA_IT_CC1: PCA Capture/Compare 1 interrupt
  • PCA_IT_CC2: PCA Capture/Compare 2 interrupt
  • PCA_IT_CC3: PCA Capture/Compare 3 interrupt
  • PCA_IT_CC4: PCA Capture/Compare 4 interrupt
  • PCA_IT_OVERFLOW: PCA count overflow interrupt
Return values
Thenew state of PCA_IT (SET or RESET).

◆ PCA_IC0_TriggerConfig()

void PCA_IC0_TriggerConfig ( uint32_t  PCA_Trigger_ICPolarity)

Configures the Channel0 (PCA Input capture).

Parameters
PCA_Trigger_ICPolarityThe Input Polarity. This parameter can be one of the following values:
  • PCA_Trigger_ICPOLARITY_NONE
  • PCA_Trigger_ICPOLARITY_RISING
  • PCA_Trigger_ICPOLARITY_FALLING
  • PCA_Trigger_ICPOLARITY_BOTHEDGE
Return values
None

◆ PCA_IC1_TriggerConfig()

void PCA_IC1_TriggerConfig ( uint32_t  PCA_Trigger_ICPolarity)

Configures the Channel1 (PCA Input capture).

Parameters
PCA_Trigger_ICPolarityThe Input Polarity. This parameter can be one of the following values:
  • PCA_Trigger_ICPOLARITY_NONE
  • PCA_Trigger_ICPOLARITY_RISING
  • PCA_Trigger_ICPOLARITY_FALLING
  • PCA_Trigger_ICPOLARITY_BOTHEDGE
Return values
None

◆ PCA_IC2_TriggerConfig()

void PCA_IC2_TriggerConfig ( uint32_t  PCA_Trigger_ICPolarity)

Configures the Channel2 (PCA Input capture).

Parameters
PCA_Trigger_ICPolarityThe Input Polarity. This parameter can be one of the following values:
  • PCA_Trigger_ICPOLARITY_NONE
  • PCA_Trigger_ICPOLARITY_RISING
  • PCA_Trigger_ICPOLARITY_FALLING
  • PCA_Trigger_ICPOLARITY_BOTHEDGE
Return values
None

◆ PCA_IC3_TriggerConfig()

void PCA_IC3_TriggerConfig ( uint32_t  PCA_Trigger_ICPolarity)

Configures the Channel3 (PCA Input capture).

Parameters
PCA_Trigger_ICPolarityThe Input Polarity. This parameter can be one of the following values:
  • PCA_Trigger_ICPOLARITY_NONE
  • PCA_Trigger_ICPOLARITY_RISING
  • PCA_Trigger_ICPOLARITY_FALLING
  • PCA_Trigger_ICPOLARITY_BOTHEDGE
Return values
None

◆ PCA_IC4_TriggerConfig()

void PCA_IC4_TriggerConfig ( uint32_t  PCA_Trigger_ICPolarity)

Configures the Channel4 (PCA Input capture).

Parameters
PCA_Trigger_ICPolarityThe Input Polarity. This parameter can be one of the following values:
  • PCA_Trigger_ICPOLARITY_NONE
  • PCA_Trigger_ICPOLARITY_RISING
  • PCA_Trigger_ICPOLARITY_FALLING
  • PCA_Trigger_ICPOLARITY_BOTHEDGE
Return values
None

◆ PCA_IC_Config()

void PCA_IC_Config ( PCA_IC_InitTypeDef IC_Config)

Initializes the PCA input capture Channels according to the specified parameters in the PCA_IC_InitTypeDef.

Parameters
IC_Config: Pointer to PCA input capture configuration structure.
Return values
None

◆ PCA_ITConfig()

void PCA_ITConfig ( uint8_t  PCA_IT,
FunctionalState  NewState 
)

Enables or disables the specified PCA interrupt.

Parameters
PCA_ITspecifies the PCA interrupt source to enable or disable. This parameter can be any combination of the following values:
  • PCA_IT_CC0: Capture/Compare 0 interrupt
  • PCA_IT_CC1: Capture/Compare 1 interrupt
  • PCA_IT_CC2: Capture/Compare 2 interrupt
  • PCA_IT_CC3: Capture/Compare 3 interrupt
  • PCA_IT_CC4: Capture/Compare 4 interrupt
  • PCA_IT_OVERFLOW: Overflow interrupt
NewStateThe new state of the specified PCA interrupt. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ PCA_OC_Cmd()

void PCA_OC_Cmd ( uint32_t  Channel,
FunctionalState  NewState 
)

Enables or disables the PCA output compare generation.

Parameters
Channel: PCA Channel associated with the capture compare register. This parameter can any combination of the following values:
  • PCA_CHANNEL_0: Capture/Compare channel0
  • PCA_CHANNEL_1: Capture/Compare channel1
  • PCA_CHANNEL_2: Capture/Compare channel2
  • PCA_CHANNEL_3: Capture/Compare channel3
  • PCA_CHANNEL_4: Capture/Compare channel4
NewStateThe new state of the specified PCA channel output compare generation. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ PCA_OC_Config()

void PCA_OC_Config ( PCA_OC_InitTypeDef OC_Config)

Initializes the PCA output compare Channels according to the specified parameters in the PCA_OC_InitTypeDef.

Parameters
OC_Config: Pointer to PCA output compare configuration structure.
Return values
None

◆ PCA_OC_INVCmd()

void PCA_OC_INVCmd ( uint32_t  Channel,
FunctionalState  NewState 
)

Enables or disables the PCA inverse output compare generation.

Parameters
Channel: PCA Channel associated with the capture compare register. This parameter can be any combination of the following values:
  • PCA_CHANNEL_0: Capture/Compare channel0
  • PCA_CHANNEL_1: Capture/Compare channel1
  • PCA_CHANNEL_2: Capture/Compare channel2
  • PCA_CHANNEL_3: Capture/Compare channel3
  • PCA_CHANNEL_4: Capture/Compare channel4
NewStateThe new state of the specified PCA channle inverse output compare generation. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ PCA_SetPWMDuty()

void PCA_SetPWMDuty ( uint32_t  Channel,
uint8_t  Duty 
)

Sets PCA PWM ouput duty cycle.

Parameters
Channel: PCA Channel associated with the capture compare register. This parameter can be any combination of the following values:
  • PCA_CHANNEL_0: PCA Capture/Compare channel0
  • PCA_CHANNEL_1: PCA Capture/Compare channel1
  • PCA_CHANNEL_2: PCA Capture/Compare channel2
  • PCA_CHANNEL_3: PCA Capture/Compare channel3
  • PCA_CHANNEL_4: PCA Capture/Compare channel4
DutyPWM output duty configuration, the duty cycle will decrease from 100% to 0.4% with the increase of Duty value from 0 to 255.
Return values
None