33 #ifndef EM_CRYOTIMER_H__
34 #define EM_CRYOTIMER_H__
40 #if defined(CRYOTIMER_PRESENT) && (CRYOTIMER_COUNT == 1)
86 cryotimerPresc_1 = _CRYOTIMER_CTRL_PRESC_DIV1,
87 cryotimerPresc_2 = _CRYOTIMER_CTRL_PRESC_DIV2,
88 cryotimerPresc_4 = _CRYOTIMER_CTRL_PRESC_DIV4,
89 cryotimerPresc_8 = _CRYOTIMER_CTRL_PRESC_DIV8,
90 cryotimerPresc_16 = _CRYOTIMER_CTRL_PRESC_DIV16,
91 cryotimerPresc_32 = _CRYOTIMER_CTRL_PRESC_DIV32,
92 cryotimerPresc_64 = _CRYOTIMER_CTRL_PRESC_DIV64,
93 cryotimerPresc_128 = _CRYOTIMER_CTRL_PRESC_DIV128,
94 } CRYOTIMER_Presc_TypeDef;
99 cryotimerOscLFRCO = _CRYOTIMER_CTRL_OSCSEL_LFRCO,
100 cryotimerOscLFXO = _CRYOTIMER_CTRL_OSCSEL_LFXO,
101 cryotimerOscULFRCO = _CRYOTIMER_CTRL_OSCSEL_ULFRCO,
102 } CRYOTIMER_Osc_TypeDef;
107 cryotimerPeriod_1 = 0,
108 cryotimerPeriod_2 = 1,
109 cryotimerPeriod_4 = 2,
110 cryotimerPeriod_8 = 3,
111 cryotimerPeriod_16 = 4,
112 cryotimerPeriod_32 = 5,
113 cryotimerPeriod_64 = 6,
114 cryotimerPeriod_128 = 7,
115 cryotimerPeriod_256 = 8,
116 cryotimerPeriod_512 = 9,
117 cryotimerPeriod_1k = 10,
118 cryotimerPeriod_2k = 11,
119 cryotimerPeriod_4k = 12,
120 cryotimerPeriod_8k = 13,
121 cryotimerPeriod_16k = 14,
122 cryotimerPeriod_32k = 15,
123 cryotimerPeriod_64k = 16,
124 cryotimerPeriod_128k = 17,
125 cryotimerPeriod_256k = 18,
126 cryotimerPeriod_512k = 19,
127 cryotimerPeriod_1m = 20,
128 cryotimerPeriod_2m = 21,
129 cryotimerPeriod_4m = 22,
130 cryotimerPeriod_8m = 23,
131 cryotimerPeriod_16m = 24,
132 cryotimerPeriod_32m = 25,
133 cryotimerPeriod_64m = 26,
134 cryotimerPeriod_128m = 27,
135 cryotimerPeriod_256m = 28,
136 cryotimerPeriod_512m = 29,
137 cryotimerPeriod_1024m = 30,
138 cryotimerPeriod_2048m = 31,
139 cryotimerPeriod_4096m = 32,
140 } CRYOTIMER_Period_TypeDef;
159 CRYOTIMER_Osc_TypeDef osc;
162 CRYOTIMER_Presc_TypeDef presc;
165 CRYOTIMER_Period_TypeDef period;
166 } CRYOTIMER_Init_TypeDef;
173 #define CRYOTIMER_INIT_DEFAULT \
180 cryotimerPeriod_4096m, \
194 __STATIC_INLINE
void CRYOTIMER_IntClear(uint32_t flags)
196 CRYOTIMER->IFC = flags & _CRYOTIMER_IFC_MASK;
209 __STATIC_INLINE uint32_t CRYOTIMER_IntGet(
void)
211 return CRYOTIMER->IF;
228 __STATIC_INLINE uint32_t CRYOTIMER_IntGetEnabled(
void)
232 ien = CRYOTIMER->IEN & _CRYOTIMER_IEN_MASK;
233 return CRYOTIMER->IF & ien;
243 __STATIC_INLINE
void CRYOTIMER_IntEnable(uint32_t flags)
245 CRYOTIMER->IEN |= (flags & _CRYOTIMER_IEN_MASK);
255 __STATIC_INLINE
void CRYOTIMER_IntDisable(uint32_t flags)
257 CRYOTIMER->IEN &= ~(flags & _CRYOTIMER_IEN_MASK);
270 __STATIC_INLINE
void CRYOTIMER_IntSet(uint32_t flags)
272 CRYOTIMER->IFS = flags & _CRYOTIMER_IFS_MASK;
288 __STATIC_INLINE
void CRYOTIMER_PeriodSet(uint32_t period)
290 CRYOTIMER->PERIODSEL = period & _CRYOTIMER_PERIODSEL_MASK;
306 __STATIC_INLINE uint32_t CRYOTIMER_PeriodGet(
void)
308 return CRYOTIMER->PERIODSEL;
318 __STATIC_INLINE uint32_t CRYOTIMER_CounterGet(
void)
320 return CRYOTIMER->CNT;
330 __STATIC_INLINE
void CRYOTIMER_EM4WakeupEnable(
bool enable)
332 BUS_RegBitWrite((&CRYOTIMER->EM4WUEN), _CRYOTIMER_EM4WUEN_EM4WU_SHIFT, enable);
342 __STATIC_INLINE
void CRYOTIMER_Enable(
bool enable)
347 void CRYOTIMER_Init(
const CRYOTIMER_Init_TypeDef *init);
RAM and peripheral bit-field set and clear API.
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
__STATIC_INLINE void BUS_RegBitWrite(volatile uint32_t *addr, unsigned int bit, unsigned int val)
Perform a single-bit write operation on a peripheral register.