11 #ifndef __MG32L003_LPTIM_H 12 #define __MG32L003_LPTIM_H 67 #define LPTIM_GATE_ENABLE (LPTIM_CR_GATE_EN) 68 #define LPTIM_GATE_DISABLE 0x00000000U 70 #define IS_LPTIM_GATE_ENABLE(GATE) (((GATE) == LPTIM_GATE_ENABLE) || \ 71 ((GATE) == LPTIM_GATE_DISABLE)) 79 #define LPTIM_GATELEVEL_LOW (LPTIM_CR_GATE_P) 80 #define LPTIM_GATELEVEL_HIGH 0x00000000U 82 #define IS_LPTIM_GATE_LEVEL(GATE_LEVEL) (((GATE_LEVEL) == LPTIM_GATELEVEL_LOW) || \ 83 ((GATE_LEVEL) == LPTIM_GATELEVEL_HIGH)) 91 #define LPTIM_CLOCK_SOURCE_PCLK 0x00000000U 92 #define LPTIM_CLOCK_SOURCE_LSE (LPTIM_CR_TCK_SEL_1) 93 #define LPTIM_CLOCK_SOURCE_LSI (LPTIM_CR_TCK_SEL_1 | LPTIM_CR_TCK_SEL_0) 95 #define IS_LPTIM_CLOCK_SOURCE(CLOCK_SOURCE) (((CLOCK_SOURCE) == LPTIM_CLOCK_SOURCE_PCLK) || \ 96 ((CLOCK_SOURCE) == LPTIM_CLOCK_SOURCE_LSE) || \ 97 ((CLOCK_SOURCE) == LPTIM_CLOCK_SOURCE_LSI)) 105 #define LPTIM_TOG_ENABLE (LPTIM_CR_TOG_EN) 106 #define LPTIM_TOG_DISABLE 0x00000000U 108 #define IS_LPTIM_TOG(TOG) (((TOG) == LPTIM_TOG_ENABLE) || \ 109 ((TOG) == LPTIM_TOG_DISABLE)) 117 #define LPTIM_COUNTER_SELECT (LPTIM_CR_CT_SEL) 118 #define LPTIM_TIMER_SELECT 0x00000000U 120 #define IS_LPTIM_COUNTER(COUNTER) (((COUNTER) == LPTIM_COUNTER_SELECT) || \ 121 ((COUNTER) == LPTIM_TIMER_SELECT)) 129 #define LPTIM_AUTORELOAD_ENABLE (LPTIM_CR_MODE) 130 #define LPTIM_AUTORELOAD_DISABLE 0x00000000U 132 #define IS_LPTIM_AUTORELOAD(AUTORELOAD) (((AUTORELOAD) == LPTIM_AUTORELOAD_ENABLE) || \ 133 ((AUTORELOAD) == LPTIM_AUTORELOAD_DISABLE)) 147 void LPTIM_Cmd(FunctionalState NewState);
void LPTIM_ClearFlag(void)
Clears the LPTIM pending interrupt flag.
Definition: mg32l003_lptim.c:197
void LPTIM_DeInit(void)
Deinitializes the LPTIM peripheral registers to their default reset values.
Definition: mg32l003_lptim.c:38
uint32_t TogEnable
Definition: mg32l003_lptim.h:42
ITStatus LPTIM_GetITStatus(void)
Checks whether the LPTIM interrupt is set or not.
Definition: mg32l003_lptim.c:174
FlagStatus LPTIM_GetSyncFlag(void)
Waits for LPTIM WT sync finish.
Definition: mg32l003_lptim.c:310
uint32_t GateEnable
Definition: mg32l003_lptim.h:33
void LPTIM_GateCmd(FunctionalState NewState)
Enables or disables the LPTIM gate function.
Definition: mg32l003_lptim.c:245
LPTIM Time base Configuration Structure definition.
Definition: mg32l003_lptim.h:31
uint32_t Period
Definition: mg32l003_lptim.h:51
uint32_t GateLevel
Definition: mg32l003_lptim.h:36
void LPTIM_ToggleCmd(FunctionalState NewState)
Enables or disables the LPTIM toggle function.
Definition: mg32l003_lptim.c:268
void LPTIM_ClearITPendingBit(void)
Clears the LPTIM pending interrupt bit.
Definition: mg32l003_lptim.c:208
uint32_t CntTimSel
Definition: mg32l003_lptim.h:45
uint32_t LPTIM_GetCounter(void)
Gets LPTIM counter.
Definition: mg32l003_lptim.c:234
void LPTIM_Cmd(FunctionalState NewState)
Enables or disables the LPTIM peripheral.
Definition: mg32l003_lptim.c:106
void LPTIM_SetCounter(uint32_t Counter)
Sets the LPTIM counter register value on runtime.
Definition: mg32l003_lptim.c:219
void LPTIM_BaseInit(LPTIM_BaseInitTypeDef *Base_InitStruct)
Low Power Time base configuration.
Definition: mg32l003_lptim.c:50
void LPTIM_ITCmd(FunctionalState NewState)
Enables or disables the LPTIM interrupt.
Definition: mg32l003_lptim.c:129
uint32_t AutoReload
Definition: mg32l003_lptim.h:48
FlagStatus LPTIM_GetFlagStatus(void)
Checks whether the LPTIM interrupt flag is set or not.
Definition: mg32l003_lptim.c:151
uint32_t ClkSel
Definition: mg32l003_lptim.h:39
void LPTIM_SetGateLevel(uint32_t Level)
Sets gate level high or low.
Definition: mg32l003_lptim.c:291
void LPTIM_TCKCmd(FunctionalState NewState)
Enables or disables the LPTIM time clock.
Definition: mg32l003_lptim.c:83