/ * @brief * Calculate the warm-up time value providing at least 10us * * @param[in] hfperFreq * Frequency in Hz of reference HFPER clock. Set to 0 to use currently defined * HFPER clock setting * * @return * Warm-up time value to use for ACMP in order to achieve at least 10us ******************************************************************************/
| 361 | * Warm-up time value to use for ACMP in order to achieve at least 10us |
| 362 | ******************************************************************************/ |
| 363 | ACMP_WarmTime_TypeDef efm32_acmp_WarmTimeCalc(rt_uint32_t hfperFreq) |
| 364 | { |
| 365 | if (!hfperFreq) |
| 366 | { |
| 367 | hfperFreq = CMU_ClockFreqGet(cmuClock_HFPER); |
| 368 | |
| 369 | /* Just in case, make sure we get non-zero freq for below calculation */ |
| 370 | if (!hfperFreq) |
| 371 | { |
| 372 | hfperFreq = 1; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | /* Determine number of HFPERCLK cycle >= 10us */ |
| 377 | if (4 * 1000000 / hfperFreq > 10) |
| 378 | { |
| 379 | return acmpWarmTime4; |
| 380 | } |
| 381 | else if (8 * 1000000 / hfperFreq > 10) |
| 382 | { |
| 383 | return acmpWarmTime8; |
| 384 | } |
| 385 | else if (16 * 1000000 / hfperFreq > 10) |
| 386 | { |
| 387 | return acmpWarmTime16; |
| 388 | } |
| 389 | else if (32 * 1000000 / hfperFreq > 10) |
| 390 | { |
| 391 | return acmpWarmTime32; |
| 392 | } |
| 393 | else if (64 * 1000000 / hfperFreq > 10) |
| 394 | { |
| 395 | return acmpWarmTime64; |
| 396 | } |
| 397 | else if (128 * 1000000 / hfperFreq > 10) |
| 398 | { |
| 399 | return acmpWarmTime128; |
| 400 | } |
| 401 | else if (256 * 1000000 / hfperFreq > 10) |
| 402 | { |
| 403 | return acmpWarmTime256; |
| 404 | } |
| 405 | else if (512 * 1000000 / hfperFreq > 10) |
| 406 | { |
| 407 | return acmpWarmTime512; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | #endif |
| 412 | /***************************************************************************//** |
nothing calls this directly
no test coverage detected