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

Function RTC_CompareSet

bsp/efm32/Libraries/emlib/src/em_rtc.c:156–193  ·  view source on GitHub ↗

/ * @brief * Set RTC 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 RTC_Sync() internal

Source from the content-addressed store, hash-verified

154 * Initialization value (<= 0x00ffffff)
155 ******************************************************************************/
156void RTC_CompareSet(unsigned int comp, uint32_t value)
157{
158 volatile uint32_t *compReg;
159#if defined(_EFM32_GECKO_FAMILY)
160 uint32_t syncbusy;
161#endif
162
163 EFM_ASSERT(RTC_COMP_REG_VALID(comp) &&
164 ((value & ~(_RTC_COMP0_COMP0_MASK >> _RTC_COMP0_COMP0_SHIFT)) == 0));
165
166 /* Initialize selected compare value */
167 switch (comp)
168 {
169 case 0:
170 compReg = &(RTC->COMP0);
171#if defined(_EFM32_GECKO_FAMILY)
172 syncbusy = RTC_SYNCBUSY_COMP0;
173#endif
174 break;
175
176 case 1:
177 compReg = &(RTC->COMP1);
178#if defined(_EFM32_GECKO_FAMILY)
179 syncbusy = RTC_SYNCBUSY_COMP1;
180#endif
181 break;
182
183 default:
184 /* Unknown compare register selected, abort */
185 return;
186 }
187#if defined(_EFM32_GECKO_FAMILY)
188 /* LF register about to be modified require sync. busy check */
189 RTC_Sync(syncbusy);
190#endif
191
192 *compReg = value;
193}
194
195
196/***************************************************************************//**

Callers

nothing calls this directly

Calls 1

RTC_SyncFunction · 0.85

Tested by

no test coverage detected