|
arduino-audio-driver
|
Common parent class for codec drivers that have been ported from the Zephyr RTOS audio driver implementations (drivers/audio). More...
#include <ZephyrDriverCommon.h>
Public Member Functions | |
| uint8_t | address () |
| Provides the actual I2C address of the codec. | |
| virtual bool | begin (uint32_t sample_rate, uint8_t bits, codec_mode_t mode, i2s_format_t fmt, bool is_master, uint8_t channels)=0 |
| Initializes the codec. | |
| virtual int | getInputVolume () |
| virtual int | getVolume () |
| Provides the output volume in % (0...100) that was set with setVolume() | |
| i2c_bus_handle_t | getWire () |
| Provides the actual I2C communication object. | |
| virtual bool | isInputVolumeSupported () |
| Returns true if the driver supports setting the input volume, false otherwise. By default we return false, but some drivers (e.g. WM8962) override this to return true. | |
| virtual bool | setActive (codec_mode_t mode) |
| void | setAddress (uint8_t addr) |
| Defines the I2C address of the codec. | |
| virtual bool | setDevices (input_device_t input_device, output_device_t output_device) |
| virtual bool | setInputVolume (int volume) |
| virtual bool | setMute (bool mute) |
| virtual bool | setVolume (int volume) |
| void | setWire (i2c_bus_handle_t w) |
| Defines the I2C communication object. | |
Protected Member Functions | |
| bool | readReg (uint8_t reg, uint8_t &value) |
| Reads a single byte from an 8 bit register address. | |
| bool | readReg16 (uint8_t reg, uint16_t &value) |
| Reads a 16 bit (big endian) value from an 8 bit register address. | |
| bool | updateReg (uint8_t reg, uint8_t mask, uint8_t value) |
| Read-Modify-Write of a single byte register. | |
| bool | updateReg16 (uint8_t reg, uint16_t mask, uint16_t value) |
| Read-Modify-Write of a 16 bit (big endian) register. | |
| bool | writeReg (uint8_t reg, uint8_t value) |
| Writes a single byte to an 8 bit register address. | |
| bool | writeReg16 (uint8_t reg, uint16_t value) |
| Writes a 16 bit (big endian) value to an 8 bit register address. | |
Protected Attributes | |
| uint8_t | i2c_addr = 0 |
| int | input_volume_percent = 100 |
| Last input volume (in %) provided to setInputVolume() | |
| int | volume_percent = 100 |
| Last volume (in %) provided to setVolume() | |
| i2c_bus_handle_t | wire = nullptr |
Common parent class for codec drivers that have been ported from the Zephyr RTOS audio driver implementations (drivers/audio).
It provides the basic I2C register access helpers (8 bit and 16 bit register values addressed via an 8 bit register address) that are used by most of these drivers. Chip specific classes can add additional register access methods (e.g. for paged/book based register maps) by using the protected wire and i2c_addr members directly.
|
inline |
Provides the actual I2C address of the codec.
|
pure virtual |
Initializes the codec.
Implemented in AW88298, DA7212, MAX98091, PCM1681, TAS2563, TAS6422DAC, TLV320AIC3110, TLV320DAC310x, WM8904, and WM8962.
|
inlinevirtual |
Provides the input volume in % (0...100) that was set with setInputVolume()
|
inlinevirtual |
Provides the output volume in % (0...100) that was set with setVolume()
|
inline |
Provides the actual I2C communication object.
|
inlinevirtual |
|
inlineprotected |
Reads a single byte from an 8 bit register address.
|
inlineprotected |
Reads a 16 bit (big endian) value from an 8 bit register address.
|
inlinevirtual |
Activates/deactivates the playback and/or capture path at runtime (without reconfiguring the codec), based on codec_mode_t (CODEC_MODE_DECODE: playback active, CODEC_MODE_ENCODE: capture active). By default this just mutes/unmutes all outputs depending on CODEC_MODE_DECODE; chip specific subclasses that support muting the input path independently override this to also mute/unmute the capture path depending on CODEC_MODE_ENCODE.
|
inline |
Defines the I2C address of the codec.
|
inlinevirtual |
Selects the ADC input source / DAC output destination. By default this is a no-op; chip specific subclasses that support input/output routing override this to configure the corresponding registers.
Reimplemented in DA7212, MAX98091, TAS6422DAC, TLV320AIC3110, TLV320DAC310x, WM8904, and WM8962.
|
inlinevirtual |
|
inlinevirtual |
Mutes/unmutes all outputs. Chip specific subclasses map this to their native mute functionality.
Reimplemented in AW88298, DA7212, MAX98091, PCM1681, TAS2563, TLV320AIC3110, TLV320DAC310x, WM8904, WM8962, and SF32LB.
|
inlinevirtual |
Defines the output volume in % (0...100). Chip specific subclasses map this to their native volume range.
Reimplemented in AW88298, DA7212, MAX98091, SF32LB, TAS2563, TAS6422DAC, TLV320AIC3110, TLV320DAC310x, WM8904, and WM8962.
|
inline |
Defines the I2C communication object.
|
inlineprotected |
Read-Modify-Write of a single byte register.
|
inlineprotected |
Read-Modify-Write of a 16 bit (big endian) register.
|
inlineprotected |
Writes a single byte to an 8 bit register address.
|
inlineprotected |
Writes a 16 bit (big endian) value to an 8 bit register address.
|
protected |
|
protected |
Last input volume (in %) provided to setInputVolume()
|
protected |
Last volume (in %) provided to setVolume()
|
protected |