This directory provides drivers with generic interfaces to peripherals used with the TFLM examples.
Copy from TensorFlow Lite Micro Library for Arduino Examples.
A generic LED API is provided in the led.h header file.
The physical default LED will vary between peripherals and platforms. The GPIO pin that connects to the default LED is defined in the peripherals.h header file.
The generic LED API provides the following functionality:
- Turning the LED on/off
- Blinking the LED at an application defined duty cycle and rate
This implementation is based on the Microphone Library for Pico, see README_pico_microphone. It requires the Raspberry Pi Pico Arduino core, for all RP2040 boards to be installed.
The original analog_microphone
from the Microphone Library for Pico has been modified and adapted to work with Arduino IDE, as follows:
- Flatten implementation to have all required files in the peripherals directory
- Convert *.c to *.cpp, including the use of new/delete instead of malloc/free
- Move code within
namespace peripherals {}
andnamespace {}
to match how the overall peripherals implementation approach - Ensure the
analog_microphone_init()
andanalog_microphone_start()
functions have areturn 0
at the end (were missing from the original C implementation)
This peripheral implementation is used by the analog_audio_provider, based on the pico-wake-word implementation. Remember to enable #define ANALOG_MIC
in
audio_provider.h.
NOTE1: The Raspberry Pi Pico Arduino core, for all RP2040 boards has support for ADCInput API, based on DMA buffering, with similar functionality as provided in analog_microphone
from the Microphone Library for Pico. This is not used in the current code, yet.
This uses PDM Arduino library based on Microphone Library for Pico
This peripheral implementation is used by the pdm_audio_provider, based on the pico-wake-word implementation. Remember to enable #define PDM_MIC
in
audio_provider.h.
NOTE2: The Raspberry Pi Pico Arduino core, for all RP2040 boards has support also for I2S API, based on DMA buffering, with similar functionality as provided in pdm_microphone
from the Microphone Library for Pico. This is not used in the current code, yet.