EI_IMPULSE_ERROR ei_sleep(int32_t time_ms);

Brief: Cancellable sleep, can be triggered with signal from other thread

Location: edge-impulse-sdk/porting/ei_classifier_porting.h

Blocking: Depends on user implementation

ei_sleep() is declared internally in the Edge Impulse SDK library, and the function must be defined by the user.

This function should allow the processor or thread to sleep or block for the given time.


  • time_ms - [input] Number of milliseconds the processor or current thread should sleep for.

Error code as defined by EI_IMPULSE_ERROR enum. Will be EI_IMPULSE_OK if the function completed successfully.

The following examples demonstrate possible implementations of this function for various platforms. Note the __attribute__((weak)) in most of the definitions, which means that a user could override the implementation elsewhere in the program: