MG32L003 Standard Peripherals Firmware Library
Data Structures | Macros | Functions
mg32l003_pca.h File Reference

This file contains all the functions prototypes for the PCA firmware library. More...

#include "mg32l003.h"

Go to the source code of this file.

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...
 

Macros

#define PCA_CLOCK_SOURCE_PCLKDIV32   0x00000000U
 
#define PCA_CLOCK_SOURCE_PCLKDIV16   (PCA_MOD_CPS_0)
 
#define PCA_CLOCK_SOURCE_PCLKDIV8   (PCA_MOD_CPS_1)
 
#define PCA_CLOCK_SOURCE_PCLKDIV4   (PCA_MOD_CPS_1 | PCA_MOD_CPS_0)
 
#define PCA_CLOCK_SOURCE_PCLKDIV2   (PCA_MOD_CPS_2)
 
#define PCA_CLOCK_SOURCE_TIM10_OVERFLOW   (PCA_MOD_CPS_2 | PCA_MOD_CPS_0)
 
#define PCA_CLOCK_SOURCE_TIM11_OVERFLOW   (PCA_MOD_CPS_2 | PCA_MOD_CPS_1)
 
#define PCA_CLOCK_SOURCE_ECI   (PCA_MOD_CPS_2 | PCA_MOD_CPS_1 | PCA_MOD_CPS_0)
 
#define IS_PCA_CLOCK_COURCE(CLOCK_SOURCE)
 
#define PCA_IDLEMODE_DISABLE   (0x00000000)
 
#define PCA_IDLEMODE_ENABLE   (0x00000080)
 
#define IS_PCA_IDLEMODE(IDLE_MODE)   (((IDLE_MODE) == PCA_IDLEMODE_DISABLE) || ((IDLE_MODE) == PCA_IDLEMODE_ENABLE))
 
#define PCA_INPUT_POLARITY_NONE   (0x00000000)
 
#define PCA_INPUT_POLARITY_FALLING   (PCA_CCAPM0_CAPN)
 
#define PCA_INPUT_POLARITY_RISING   (PCA_CCAPM0_CAPP)
 
#define PCA_INPUT_POLARITY_BOTH   (PCA_CCAPM0_CAPN | PCA_CCAPM0_CAPP)
 
#define IS_PCA_INPUT_POLARATY(INPUT_POLARATY)
 
#define PCA_FLAG_CC0   (PCA_CR_CCF0)
 
#define PCA_FLAG_CC1   (PCA_CR_CCF1)
 
#define PCA_FLAG_CC2   (PCA_CR_CCF2)
 
#define PCA_FLAG_CC3   (PCA_CR_CCF3)
 
#define PCA_FLAG_CC4   (PCA_CR_CCF4)
 
#define PCA_FLAG_OVERFLOW   (PCA_CR_CF)
 
#define IS_PCA_FLAG(FLAG)
 
#define PCA_IT_CC0   (0x01)
 
#define PCA_IT_CC1   (0x02)
 
#define PCA_IT_CC2   (0x04)
 
#define PCA_IT_CC3   (0x08)
 
#define PCA_IT_CC4   (0x10)
 
#define PCA_IT_OVERFLOW   (0x80)
 
#define IS_PCA_IT(PCA_IT)
 
#define PCA_CHANNEL_0   (0x01)
 
#define PCA_CHANNEL_1   (0x02)
 
#define PCA_CHANNEL_2   (0x04)
 
#define PCA_CHANNEL_3   (0x08)
 
#define PCA_CHANNEL_4   (0x10)
 
#define PCA_CHANNEL_MASK   (0x1F)
 
#define IS_PCA_CHANNEL(CHANNEL)   (((CHANNEL) & PCA_CHANNEL_MASK) != 0x00)
 
#define PCA_OC_ENABLE   (PCA_CCAPM0_ECOM)
 
#define PCA_OC_DISABLE   0x00000000U
 
#define IS_PCA_OC_ENABLE(OC_ENABLE)   (((OC_ENABLE) == PCA_OC_ENABLE) || ((OC_ENABLE) == PCA_OC_DISABLE))
 
#define PCA_TOG_ENABLE   (PCA_CCAPM0_MAT | PCA_CCAPM0_TOG)
 
#define PCA_TOG_DISABLE   0x00000000U
 
#define IS_PCA_TOG_ENABLE(TOG_ENABLE)   (((TOG_ENABLE) == PCA_TOG_ENABLE) || ((TOG_ENABLE) == PCA_TOG_DISABLE))
 
#define PCA_PWM_ENABLE   (PCA_CCAPM0_PWM)
 
#define PCA_PWM_DISABLE   0x00000000U
 
#define IS_PCA_PWM_ENABLE(PWM_ENABLE)   (((PWM_ENABLE) == PCA_PWM_ENABLE) || ((PWM_ENABLE) == PCA_PWM_DISABLE))
 

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

This file contains all the functions prototypes for the PCA firmware library.

Author
megawin Application Team
Version
V0.0.5
Date
13-August-2024