This module is the base for SPI based drivers.
Options
This module is not a concrete driver, but usually the concrete drivers make use of
Fledex.Driver.Impl.Spi.Utils.default_spi_config/1 to configure the SPI port.
Concrete drivers can both define different defaults and implement additional options,
but you can expect to find the following:
:dev: SPI device name (default "spidev0.0", seeCircuits.SPI.spi_option/0for details).:mode: set clock polarity and phase (default: mode0, seeCircuits.SPI.spi_option/0for details),:bits_per_word: set the bits per word on the bus (default:8, seeCircuits.SPI.spi_option/0for details).:speed_hz: set the bus speed (default:1_000_000, seeCircuits.SPI.spi_option/0for details).:delay_us: set the delay between transactions (default:10, seeCircuits.SPI.spi_option/0for details).:lsb_first: sets whether the least significant bit is first (default:false, seeCircuits.SPI.spi_option/0for details).:color_correction: specifies the color correction (seeFledex.Color.Correctionfor details):clear_leds: Sets the number of leds that should be cleared during startup (default:0)
Warning
Be careful, because specific drivers might need very specific settings. You really should understand the driver before you modify any option.
Summary
Callbacks
Before we can transfer the rgb values we need to convert them to the a bitstring
that we can send over the wire. Any SPI driver use-ing this module, needs to
implement the conversion in this function
Functions
If you want to implement a new SPI driver you can use this module as a base.
Callbacks
@callback convert_to_bits(Fledex.Color.RGBW.t(), config :: keyword()) :: bitstring()
Before we can transfer the rgb values we need to convert them to the a bitstring
that we can send over the wire. Any SPI driver use-ing this module, needs to
implement the conversion in this function
Functions
If you want to implement a new SPI driver you can use this module as a base.
This way you only have to have to implement the callbacks
Fledex.Driver.Interface.configure/1 and from this module:
convert_to_bits/2.