|
arduino-audio-driver
|
Header-only driver class for the SGTL5000 codec chip. More...
#include <SGTL5000.h>
Public Types | |
| enum | AnaCtrlBits : uint16_t { MuteLineOut = 1 << 8 , SelectHeadphoneLineIn = 1 << 6 , EnableZeroCrossHp = 1 << 5 , MuteHeadphone = 1 << 4 , SelectAdcLineIn = 1 << 2 , EnableZeroCrossAdc = 1 << 1 , MuteAdc = 1 << 0 } |
| Bit flags for the ANA_CTRL register (0x0024) More... | |
| enum | I2SMode : uint16_t { I2SModeI2SOrLeftJustified = 0x0 , I2SModeRightJustified = 0x1 , I2SModePcm = 0x2 } |
| I2S_MODE field of the I2S_CTRL register (0x0006) More... | |
| enum class | Reg : uint16_t { ChipId = 0x0000 , DigPower = 0x0002 , ClkCtrl = 0x0004 , I2SCtrl = 0x0006 , SssCtrl = 0x000A , AdcDacCtrl = 0x000E , DacVol = 0x0010 , PadStrength = 0x0014 , AnaAdcCtrl = 0x0020 , AnaHpCtrl = 0x0022 , AnaCtrl = 0x0024 , LinregCtrl = 0x0026 , RefCtrl = 0x0028 , MicCtrl = 0x002A , LineOutCtrl = 0x002C , LineOutVol = 0x002E , AnaPower = 0x0030 , PllCtrl = 0x0032 , ClkTopCtrl = 0x0034 , AnaStatus = 0x0036 , ShortCtrl = 0x003C , DapControl = 0x0100 } |
| SGTL5000 register addresses. More... | |
Public Member Functions | |
| SGTL5000 ()=default | |
| error_t | configI2S (codec_mode_t mode, I2SDefinition *iface) |
| Configure the digital audio interface format and sample rate. | |
| error_t | ctrlStateActive (codec_mode_t mode, bool ctrl_state_active) |
| Activate or mute the codec. | |
| error_t | deinit (void) |
| Deinitialize the SGTL5000 codec chip. | |
| uint16_t | getClkCtrl (samplerate_t rate) |
| Determine the CLK_CTRL register value for the requested sample rate. | |
| error_t | getVoiceVolume (int *volume) |
| Get the headphone / line output volume (0~100) | |
| error_t | init (codec_config_t *cfg) |
| Initialize the SGTL5000 codec chip. | |
| uint16_t | readReg (Reg reg) |
| Read a 16 bit value from a SGTL5000 register. | |
| void | setAddress (int addr) |
| Defines the I2C device address. | |
| error_t | setVoiceMute (bool enable) |
| Mute / unmute the headphone and line outputs. | |
| error_t | setVoiceVolume (int volume) |
| Set the headphone / line output volume. | |
| void | setWire (i2c_bus_handle_t handle) |
| Defines the I2C bus instance to be used. | |
| error_t | writeReg (Reg reg, uint16_t value) |
| Write a 16 bit value to a SGTL5000 register. | |
Protected Attributes | |
| uint16_t | ana_ctrl = 0 |
| int | i2c_addr = SGTL5000_ADDR |
| i2c_bus_handle_t | i2c_handle = nullptr |
| bool | initialized = false |
| int | voice_volume = 70 |
Header-only driver class for the SGTL5000 codec chip.
| enum AnaCtrlBits : uint16_t |
| enum I2SMode : uint16_t |
|
strong |
SGTL5000 register addresses.
|
default |
|
inline |
Configure the digital audio interface format and sample rate.
|
inline |
Activate or mute the codec.
|
inline |
Determine the CLK_CTRL register value for the requested sample rate.
|
inline |
Get the headphone / line output volume (0~100)
|
inline |
Initialize the SGTL5000 codec chip.
|
inline |
Defines the I2C device address.
|
inline |
Mute / unmute the headphone and line outputs.
|
inline |
Set the headphone / line output volume.
| volume | voice volume (0~100) |
|
inline |
Defines the I2C bus instance to be used.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |