/ * @brief * Configure the SysTick for OS tick. * * @details * * @note * ******************************************************************************/
| 143 | * |
| 144 | ******************************************************************************/ |
| 145 | static void SysTick_Configuration(void) |
| 146 | { |
| 147 | #if defined(EFM32_USING_LFXO) |
| 148 | /* LETIMER0 configurations */ |
| 149 | const LETIMER_Init_TypeDef letimerInit = |
| 150 | { |
| 151 | .enable = true, /* Start counting when init completed. */ |
| 152 | .debugRun = false, /* Counter shall not keep running during debug halt. */ |
| 153 | .rtcComp0Enable = false, /* Don't start counting on RTC COMP0 match. */ |
| 154 | .rtcComp1Enable = false, /* Don't start counting on RTC COMP1 match. */ |
| 155 | .comp0Top = true, /* Load COMP0 register into CNT when counter underflows. COMP is used as TOP */ |
| 156 | .bufTop = false, /* Don't load COMP1 into COMP0 when REP0 reaches 0. */ |
| 157 | .out0Pol = 0, /* Idle value for output 0. */ |
| 158 | .out1Pol = 0, /* Idle value for output 1. */ |
| 159 | .ufoa0 = letimerUFOANone, /* No output on output 0. */ |
| 160 | .ufoa1 = letimerUFOANone, /* No output on output 1. */ |
| 161 | .repMode = letimerRepeatFree /* Count until stopped by SW. */ |
| 162 | }; |
| 163 | |
| 164 | CMU_ClockDivSet(cmuClock_LETIMER0, cmuClkDiv_8); |
| 165 | CMU_ClockEnable(cmuClock_LETIMER0, true); |
| 166 | LETIMER_CompareSet(LETIMER0, 0, |
| 167 | EFM32_LETIMER_TOP_100HZ * RT_TICK_PER_SECOND / 100); |
| 168 | |
| 169 | /* Enable underflow interrupt */ |
| 170 | LETIMER_IntClear(LETIMER0, LETIMER_IF_UF); |
| 171 | LETIMER_IntEnable(LETIMER0, LETIMER_IF_UF); |
| 172 | /* Enable LETIMER0 interrupt vector in NVIC */ |
| 173 | NVIC_ClearPendingIRQ(LETIMER0_IRQn); |
| 174 | NVIC_SetPriority(LETIMER0_IRQn, EFM32_IRQ_PRI_DEFAULT); |
| 175 | NVIC_EnableIRQ(LETIMER0_IRQn); |
| 176 | |
| 177 | /* Start LETIMER0 */ |
| 178 | LETIMER_Init(LETIMER0, &letimerInit); |
| 179 | #else |
| 180 | rt_uint32_t coreClk; |
| 181 | rt_uint32_t cnts; |
| 182 | |
| 183 | coreClk = SystemCoreClockGet(); |
| 184 | cnts = coreClk / RT_TICK_PER_SECOND; |
| 185 | |
| 186 | SysTick_Config(cnts); |
| 187 | SysTick_CLKSourceConfig(SysTick_CLKSource_HFCORECLK); |
| 188 | #endif |
| 189 | } |
| 190 | |
| 191 | /***************************************************************************//** |
| 192 | * @brief |
no test coverage detected