MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / LETIMER_CompareSet

Function LETIMER_CompareSet

bsp/efm32/Libraries/emlib/src/em_letimer.c:169–204  ·  view source on GitHub ↗

/ * @brief * Set LETIMER compare register value. * * @note * The setting of a compare register requires synchronization into the * low frequency domain. If the same register is modified before a previous * update has completed, this function will stall until the previous * synchronization has completed. This only applies to the Gecko Family, see * comment in the LETIMER_Sync()

Source from the content-addressed store, hash-verified

167 * Initialization value (<= 0x0000ffff)
168 ******************************************************************************/
169void LETIMER_CompareSet(LETIMER_TypeDef *letimer,
170 unsigned int comp,
171 uint32_t value)
172{
173 volatile uint32_t *compReg;
174 uint32_t syncbusy;
175
176 EFM_ASSERT(LETIMER_REF_VALID(letimer) &&
177 LETIMER_COMP_REG_VALID(comp) &&
178 ((value & ~(_LETIMER_COMP0_COMP0_MASK >> _LETIMER_COMP0_COMP0_SHIFT)) == 0));
179
180 /* Initialize selected compare value */
181 switch (comp)
182 {
183 case 0:
184 compReg = &(letimer->COMP0);
185 syncbusy = LETIMER_SYNCBUSY_COMP0;
186 break;
187
188 case 1:
189 compReg = &(letimer->COMP1);
190 syncbusy = LETIMER_SYNCBUSY_COMP1;
191 break;
192
193 default:
194 /* Unknown compare register selected, abort */
195 return;
196 }
197
198#if defined(_EFM32_GECKO_FAMILY)
199 /* LF register about to be modified require sync. busy check */
200 LETIMER_Sync(letimer, syncbusy);
201#endif
202
203 *compReg = value;
204}
205
206
207/***************************************************************************//**

Callers 1

SysTick_ConfigurationFunction · 0.85

Calls 1

LETIMER_SyncFunction · 0.85

Tested by

no test coverage detected