This is a collection of components for the esp-idf build environment for ESP32 application development.
References:
The included components are generally re-usable and have limited coupling, allowing applications to easily use a subset of the compnoents.
Functionality covered by the components (pretty much all of these are TODOs):
- Processing:
Task
: A simple wrapper around FreeRTOSxTaskCreate
and related functions [more]. Also included:Fft
: An embedded-optimized FFT.- Using fix_fft originally from here, but the basic implementation is all over the internet.
Queue
: A thread safe FIFO. Thread safe only for push and pop.LambdaQueue
: A queue for lambdas to be passed safely from one task to another.Actor
: A task with an associated lambda queue.Dispatcher
: To send/receive process-wide notifications.
- Presentation:
FixedPoint
: A template class that handles arbitrary precision fixed-point math. Handy for integer-based operations on color components for driving LEDs, but has many uses beyond that in the embedded world.Color
: For manipulating colors in RGB and HSV space. Includes lerp functions in both color spaces which is handy for LED animations.ArrayResampler
: For up and downsampling an array of data. Handy for scaling 1D image data for display on different size LED strips. Should probably make a 2D array resampler and then get 1D functionality for free.Gauge
: Classes to show data in various forms. Targeted for monochrome displays (i.e., OLEDs such as SSD1306), so not too fancy.GaugeLinear
: Bar and line graphs for 1D data.GaugeRadial
: Radial graph (a la speedometer or tachometer).
Mapper
For clut to map colors between display devices. Can be used for keeping constant brightness while animating hue.
- Drivers:
- Apa102: A simple set of classes to drive APA102 LEDs. Has an abstraction to accomodate S/W and H/W SPI. Note: Only the S/W interface is currently implemented.
- Msgeq7: Configure and read the MSGEQ7 graphic EQ chip.
- Max9814: Auto-gain control mic amp, used with Adafruit Electrec Mic breakout: Adafruit Electret Microphone Amplifier.
Given an application project for the esp-idf, do the following:
- Add a submodule (assuming you are using git):
- Change directory to the root of the project
mkdir 3p
# an example name for 3rd party code directorycd 3p
git submodule add <repo url> pnicomponents
- There's always a chance you might need to do a
git submodule sync
orinit
depending on your git version.
- There's always a chance you might need to do a
- Symbolic link desired components into build system:
- Change directory to the root of the project
mkdir components
# name must be 'components'cd components
ln -s ../3p/pnicomponents/components/<some-component> <some-component>
When you do your next build, the <some-component>
component will automatically be built and linked into your project. The headers from the component will automatically be available to your application code and other components.
- Issue: Build fails
- Probably due to component dependencies. While there is minimal coupling between components in this project, some do exist and not adding a symbolic link for a dependeny in the
components
directory can cause this kind of failure.
- Probably due to component dependencies. While there is minimal coupling between components in this project, some do exist and not adding a symbolic link for a dependeny in the
The PNI prefix is an arbitrary thing to give all the classes a namespace to avoid collisions with other libraries and system symbol names. Don't ask what it stands for.