__attribute__((weak))
in most of the definitions, which means that a user could override the implementation elsewhere in the program:
time_ms
Time in milliseconds to sleepEI_IMPULSE_OK
if successful, error code otherwise
c
The chararater to sendei_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.
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 to ei_printf()
from within the edge-impulse-sdk library do not pass anything other than the format
argument.
ei_printf()
).
If your platform can print floating point values, the easiest implementation of this function is as follows:
f
The floating point number to printsize
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:
size
The number of bytes to allocatenitems * 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:
nitems
Number of blocks to allocate and clear
size
Size (in bytes) of each block
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:
ptr
Pointer to the memory to free