|
arduino-audio-driver
|
Generic Driver API that wraps a codec driver class which has been ported from the Zephyr RTOS (see Codecs/<chip>/*.h, e.g. WM8904, DA7212, TAS2563, ...). It provides the I2C wire/address from the pin configuration to the driver and calls its begin()/setVolume()/setMute() (or setOutputVolume()/setOutputMute()) methods, so that the chip can be used via the regular AudioDriver API. More...
#include <AudioDriver.h>
Public Member Functions | |
| AudioDriverZephyrT (uint8_t i2cAddress=DefaultI2CAddress) | |
| virtual bool | begin (CodecConfig codecCfg, DriverDeviceInfo &pins) |
| Starts the processing. | |
| T & | driver () |
| Provides access to the wrapped Zephyr driver instance. | |
| virtual bool | end (void) |
| Ends the processing: shut down dac and adc. | |
| API_GPIO & | getGPIO () |
| virtual int | getI2CAddress () |
| Provides the i2c address. | |
| int | getInputVolume () |
| int | getVolume () override |
| Determines the actual volume (range: 0-100) | |
| bool | isInputVolumeSupported () override |
| Determines if setInputVolume() is supported. | |
| virtual bool | isVolumeSupported () |
| Determines if setVolume() is suppored. | |
| operator bool () | |
| virtual DriverDeviceInfo & | pins () |
| Provides the pin information. | |
| virtual bool | setConfig (CodecConfig codecCfg) |
| changes the configuration | |
| virtual bool | setI2CAddress (uint16_t adr) |
| Defines the i2c address. | |
| bool | setInputVolume (int volume) override |
| Defines the input volume (range: 0-100) if supported. | |
| bool | setMute (bool enable) override |
| Mutes all output lines. | |
| virtual bool | setMute (bool mute, int line) |
| Mute individual lines: only supported for some rare DACs. | |
| bool | setPAPower (bool enable) |
| Sets the PA Power pin to active or inactive. | |
| void | setPins (DriverDeviceInfo &pins) |
| void | setupI2CAddress () |
| If no address is defined in the pins we provide it here. | |
| bool | setVolume (int volume) override |
| Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100. | |
Protected Member Functions | |
| bool | configInterface (codec_mode_t mode, I2SDefinition iface) override |
| Configures the codec (sample rate, bits per sample) for the given I2S setup. | |
| bool | controlState (codec_mode_t mode) override |
| bool | deinit () override |
| Stops the input and output and (if supported) shuts down the codec. | |
| virtual i2c_bus_handle_t | getI2C () |
| Determine the TwoWire object from the I2C config or use Wire. | |
| bool | init (codec_config_t codecCfg) override |
| int | limitValue (int volume, int min=0, int max=100) |
| int | mapVolume (int x, int in_min, int in_max, int out_min, int out_max) |
Protected Attributes | |
| CodecConfig | codec_cfg |
| int | i2c_default_address = -1 |
| DriverDeviceInfo * | p_pins = nullptr |
| int | volume_value = 100 |
| T | zephyr_driver |
Generic Driver API that wraps a codec driver class which has been ported from the Zephyr RTOS (see Codecs/<chip>/*.h, e.g. WM8904, DA7212, TAS2563, ...). It provides the I2C wire/address from the pin configuration to the driver and calls its begin()/setVolume()/setMute() (or setOutputVolume()/setOutputMute()) methods, so that the chip can be used via the regular AudioDriver API.
Some chips require additional parameters (e.g. the master clock frequency) for their begin() method: in this case begin() is not called automatically and driver() must be used to set up the chip manually before AudioDriver::begin() is called.
| T | the Zephyr ported codec driver class (e.g. WM8904) |
| DefaultI2CAddress | the default I2C address of the chip |
|
inline |
|
inlinevirtualinherited |
Starts the processing.
Reimplemented in AudioDriverNAU8325Class, NoDriverClass, AudioDriverCS43l22Class, AudioDriverCS42L51Class, AudioDriverWM8960Class, AudioDriverWM8994Class, AudioDriverLyratMiniClass, AudioDriverCombined, AudioDriverCS42448Class, and AudioDriverWM8978Class.
|
inlineoverrideprotectedvirtual |
Configures the codec (sample rate, bits per sample) for the given I2S setup.
Reimplemented from AudioDriver.
|
inlineoverrideprotectedvirtual |
Reimplemented from AudioDriver.
|
inlineoverrideprotectedvirtual |
Stops the input and output and (if supported) shuts down the codec.
Reimplemented from AudioDriver.
|
inline |
Provides access to the wrapped Zephyr driver instance.
|
inlinevirtualinherited |
Ends the processing: shut down dac and adc.
Reimplemented in AudioDriverWM8978Class, AudioDriverNAU8325Class, NoDriverClass, AudioDriverWM8960Class, AudioDriverLyratMiniClass, AudioDriverCombined, and AudioDriverCS42448Class.
|
inlineinherited |
|
inlineprotectedvirtualinherited |
Determine the TwoWire object from the I2C config or use Wire.
|
inlinevirtualinherited |
Provides the i2c address.
|
inline |
|
inlineoverridevirtual |
Determines the actual volume (range: 0-100)
Implements AudioDriver.
|
inlineoverrideprotectedvirtual |
Reimplemented from AudioDriver.
|
inlineoverridevirtual |
Determines if setInputVolume() is supported.
Reimplemented from AudioDriver.
|
inlinevirtualinherited |
Determines if setVolume() is suppored.
Reimplemented in NoDriverClass, AudioDriverWM8960Class, AudioDriverCS42448Class, and AudioDriverWM8978Class.
|
inlineprotectedinherited |
make sure that value is in range
| volume |
|
inlineprotectedinherited |
|
inlineinherited |
|
inlinevirtualinherited |
Provides the pin information.
Reimplemented in AudioDriverCS42448Class.
|
inlinevirtualinherited |
changes the configuration
Reimplemented in AudioDriverCS43l22Class, AudioDriverCS42L51Class, AudioDriverCS42448Class, AudioDriverWM8960Class, and AudioDriverWM8978Class.
|
inlinevirtualinherited |
Defines the i2c address.
|
inlineoverridevirtual |
Defines the input volume (range: 0-100) if supported.
Reimplemented from AudioDriver.
|
inlineoverridevirtual |
Mutes all output lines.
Implements AudioDriver.
|
inlinevirtualinherited |
Mute individual lines: only supported for some rare DACs.
Reimplemented in AudioDriverCS42448Class, AudioDriverES8388Class, AudioDriverPCM3168Class, and AudioDriverWM8978Class.
|
inlineinherited |
Sets the PA Power pin to active or inactive.
|
inlineinherited |
|
inlineinherited |
If no address is defined in the pins we provide it here.
|
inlineoverridevirtual |
Defines the Volume (in %) if volume is 0, mute is enabled,range is 0-100.
Implements AudioDriver.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protected |