__attribute__((weak))
in most of the definitions, which means that a user could override the implementation elsewhere in the program:
- Arduino classifier porting
- mbed classifier porting
- POSIX classifier porting
- Silicon Labs classifier porting
- STM32 classifier porting
- TI classifier porting
- Zephyr classifier porting
ei_sleep
Parameters
time_ms
Time in milliseconds to sleep
Returns
EI_IMPULSE_OK
if successful, error code otherwise
ei_read_timer_ms
Returns
The number of milliseconds that have passed since the start of the programei_read_timer_us
Returns
The number of microseconds that have passed since the start of the programei_putchar
Parameters
c
The character to send
ei_getchar
Returns
The character read from the serial portei_printf
ei_printf()
is declared internally to the Edge Impulse SDK library so that debugging information (e.g. during inference) can be printed out. However, the function must be defined by the user, as printing methods can change depending on the platform and use case. For example, you may want to print debugging information to stdout in Linux or over a UART serial port on a microcontroller.
Parameters
-
format
Pointer to a character array or string that should be printed -
...
Other optional arguments may be passed as necessary (e.g. handle to a UART object). Note that any calls toei_printf()
from within the edge-impulse-sdk library do not pass anything other than theformat
argument.
ei_printf_float
ei_printf()
).
If your platform can print floating point values, the easiest implementation of this function is as follows:
Parameters
f
The floating point number to print
ei_malloc
size
bytes and return a pointer to the allocated memory. In bare-metal implementations, it can simply be a wrapper for malloc()
. For example:
ei_malloc()
is thread-safe. For example, if you are using FreeRTOS, here is one possible implementation:
Parameters
size
The number of bytes to allocate
ei_calloc
nitems * size
bytes and initialize all bytes in this allocated memory to 0. It should return a pointer to the allocated memory. In bare-metal implementations, it can simply be a wrapper for calloc()
. For example:
ei_calloc()
is thread-safe. For example, if you are using FreeRTOS, here is one possible implementation:
Parameters
-
nitems
Number of blocks to allocate and clear -
size
Size (in bytes) of each block
ei_free
ptr
. If ptr
is NULL
, no operation should be performed. In bare-metal implementations, it can simply be a wrapper for free()
. For example:
ei_free()
is thread-safe. For example, if you are using FreeRTOS, here is one possible implementation:
Parameters
ptr
Pointer to the memory to free