https://forum.pjrc.com/threads/28932-LC-is-10-9-times-slower-than-T3-1teensy4-core
@@ -885,6 +885,11 @@ uint32_t micros(void) | |||
//systick_istatus = istatus & SCB_ICSR_PENDSTSET ? 1 : 0; | |||
if ((istatus & SCB_ICSR_PENDSTSET) && current > 50) count++; | |||
current = ((F_CPU / 1000) - 1) - current; | |||
#if defined(KINETISL) && F_CPU == 48000000 | |||
return count * 1000 + ((current * (uint32_t)87381) >> 22); | |||
#elif defined(KINETISL) && F_CPU == 24000000 | |||
return count * 1000 + ((current * (uint32_t)174763) >> 23); | |||
#endif | |||
return count * 1000 + current / (F_CPU / 1000000); | |||
} | |||