33 #ifndef EM_CRYOTIMER_H
34 #define EM_CRYOTIMER_H
40 #if defined(CRYOTIMER_PRESENT) && (CRYOTIMER_COUNT == 1)
121 cryotimerPresc_1 = _CRYOTIMER_CTRL_PRESC_DIV1,
122 cryotimerPresc_2 = _CRYOTIMER_CTRL_PRESC_DIV2,
123 cryotimerPresc_4 = _CRYOTIMER_CTRL_PRESC_DIV4,
124 cryotimerPresc_8 = _CRYOTIMER_CTRL_PRESC_DIV8,
125 cryotimerPresc_16 = _CRYOTIMER_CTRL_PRESC_DIV16,
126 cryotimerPresc_32 = _CRYOTIMER_CTRL_PRESC_DIV32,
127 cryotimerPresc_64 = _CRYOTIMER_CTRL_PRESC_DIV64,
128 cryotimerPresc_128 = _CRYOTIMER_CTRL_PRESC_DIV128,
129 } CRYOTIMER_Presc_TypeDef;
134 cryotimerOscLFRCO = _CRYOTIMER_CTRL_OSCSEL_LFRCO,
135 cryotimerOscLFXO = _CRYOTIMER_CTRL_OSCSEL_LFXO,
136 cryotimerOscULFRCO = _CRYOTIMER_CTRL_OSCSEL_ULFRCO,
137 } CRYOTIMER_Osc_TypeDef;
142 cryotimerPeriod_1 = 0,
143 cryotimerPeriod_2 = 1,
144 cryotimerPeriod_4 = 2,
145 cryotimerPeriod_8 = 3,
146 cryotimerPeriod_16 = 4,
147 cryotimerPeriod_32 = 5,
148 cryotimerPeriod_64 = 6,
149 cryotimerPeriod_128 = 7,
150 cryotimerPeriod_256 = 8,
151 cryotimerPeriod_512 = 9,
152 cryotimerPeriod_1k = 10,
153 cryotimerPeriod_2k = 11,
154 cryotimerPeriod_4k = 12,
155 cryotimerPeriod_8k = 13,
156 cryotimerPeriod_16k = 14,
157 cryotimerPeriod_32k = 15,
158 cryotimerPeriod_64k = 16,
159 cryotimerPeriod_128k = 17,
160 cryotimerPeriod_256k = 18,
161 cryotimerPeriod_512k = 19,
162 cryotimerPeriod_1m = 20,
163 cryotimerPeriod_2m = 21,
164 cryotimerPeriod_4m = 22,
165 cryotimerPeriod_8m = 23,
166 cryotimerPeriod_16m = 24,
167 cryotimerPeriod_32m = 25,
168 cryotimerPeriod_64m = 26,
169 cryotimerPeriod_128m = 27,
170 cryotimerPeriod_256m = 28,
171 cryotimerPeriod_512m = 29,
172 cryotimerPeriod_1024m = 30,
173 cryotimerPeriod_2048m = 31,
174 cryotimerPeriod_4096m = 32,
175 } CRYOTIMER_Period_TypeDef;
194 CRYOTIMER_Osc_TypeDef osc;
197 CRYOTIMER_Presc_TypeDef presc;
200 CRYOTIMER_Period_TypeDef period;
201 } CRYOTIMER_Init_TypeDef;
208 #define CRYOTIMER_INIT_DEFAULT \
215 cryotimerPeriod_4096m, \
229 __STATIC_INLINE
void CRYOTIMER_IntClear(uint32_t flags)
231 CRYOTIMER->IFC = flags & _CRYOTIMER_IFC_MASK;
245 __STATIC_INLINE uint32_t CRYOTIMER_IntGet(
void)
247 return CRYOTIMER->IF;
264 __STATIC_INLINE uint32_t CRYOTIMER_IntGetEnabled(
void)
268 ien = CRYOTIMER->IEN & _CRYOTIMER_IEN_MASK;
269 return CRYOTIMER->IF & ien;
279 __STATIC_INLINE
void CRYOTIMER_IntEnable(uint32_t flags)
281 CRYOTIMER->IEN |= (flags & _CRYOTIMER_IEN_MASK);
291 __STATIC_INLINE
void CRYOTIMER_IntDisable(uint32_t flags)
293 CRYOTIMER->IEN &= ~(flags & _CRYOTIMER_IEN_MASK);
307 __STATIC_INLINE
void CRYOTIMER_IntSet(uint32_t flags)
309 CRYOTIMER->IFS = flags & _CRYOTIMER_IFS_MASK;
325 __STATIC_INLINE
void CRYOTIMER_PeriodSet(uint32_t period)
327 CRYOTIMER->PERIODSEL = period & _CRYOTIMER_PERIODSEL_MASK;
343 __STATIC_INLINE uint32_t CRYOTIMER_PeriodGet(
void)
345 return CRYOTIMER->PERIODSEL;
355 __STATIC_INLINE uint32_t CRYOTIMER_CounterGet(
void)
357 return CRYOTIMER->CNT;
367 __STATIC_INLINE
void CRYOTIMER_EM4WakeupEnable(
bool enable)
369 BUS_RegBitWrite((&CRYOTIMER->EM4WUEN), _CRYOTIMER_EM4WUEN_EM4WU_SHIFT, enable);
379 __STATIC_INLINE
void CRYOTIMER_Enable(
bool enable)
384 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.