Fledex.Driver.Impl.Spi behaviour (fledex v0.8.0)

Copy Markdown View Source

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:

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

convert_to_bits(t, config)

@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

__using__(opts)

(macro)

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.