The Device OS includes an RTOS (Real Time Operating System). The RTOS is responsible for switching between the application thread and the system thread, which it does automatically every millisecond. This has 2 main consequences:
- delays close to 1ms are typically much longer
- application code may be stopped at any time when the RTOS switches to the system thread
When executing timing-critical sections of code, the task switching needs to be momentarily disabled.