/ * @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()
| 167 | * Initialization value (<= 0x0000ffff) |
| 168 | ******************************************************************************/ |
| 169 | void 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 | /***************************************************************************//** |
no test coverage detected