arduino-audio-driver
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
AC101 Class Reference

Header-only driver class for the AC101 codec chip. More...

#include <AC101.h>

Public Member Functions

 AC101 ()=default
 
error_t configI2S (codec_mode_t mode, I2SDefinition *iface)
 
error_t ctrlStateActive (codec_mode_t mode, bool ctrlStateActive)
 
error_t deinit ()
 
int getEarphVolume ()
 
int getSpkVolume ()
 
uint16_t getSrcValue (input_device_t input_device)
 Determines the value for the SRC register based on the selected input_device.
 
error_t getVoiceVolume (int *volume)
 
error_t i2sConfigClock (ac_i2s_clock_t *cfg)
 
error_t init (codec_config_t *codec_cfg)
 
error_t readI2C (uint8_t devAddr, uint8_t reg_add, uint8_t *p_data, size_t size)
 
uint16_t readReg (uint8_t reg_addr)
 
void setAddress (int addr)
 Defines the I2C device address.
 
void setCodecClk (samplerate_t sampledata)
 
error_t setEarphVolume (uint8_t volume)
 
error_t setOutputMixerGain (ac_output_mixer_gain_t gain, ac_output_mixer_source_t source)
 
error_t setSpkVolume (uint8_t volume)
 
error_t setVoiceMute (bool enable)
 
error_t setVoiceVolume (int volume)
 
void setWire (i2c_bus_handle_t handle)
 Defines the I2C bus instance to be used.
 
error_t start (ac_module_t mode)
 
error_t stop (ac_module_t mode)
 
error_t writeReg (uint8_t reg_add, uint16_t data)
 

Static Public Attributes

static constexpr int AC101_ADDR = 0x1A
 
static constexpr uint8_t AC_DAC_DAPCTRL = 0xa0
 
static constexpr uint8_t AC_DAC_DAPHETHD = 0xab
 
static constexpr uint8_t AC_DAC_DAPHGATC = 0xa9
 
static constexpr uint8_t AC_DAC_DAPHGDEC = 0xa7
 
static constexpr uint8_t AC_DAC_DAPHGKPA = 0xad
 
static constexpr uint8_t AC_DAC_DAPHGOPA = 0xaf
 
static constexpr uint8_t AC_DAC_DAPHHPFC = 0xa1
 
static constexpr uint8_t AC_DAC_DAPLETHD = 0xac
 
static constexpr uint8_t AC_DAC_DAPLGATC = 0xaa
 
static constexpr uint8_t AC_DAC_DAPLGDEC = 0xa8
 
static constexpr uint8_t AC_DAC_DAPLGKPA = 0xae
 
static constexpr uint8_t AC_DAC_DAPLGOPA = 0xb0
 
static constexpr uint8_t AC_DAC_DAPLHAVC = 0xa3
 
static constexpr uint8_t AC_DAC_DAPLHPFC = 0xa2
 
static constexpr uint8_t AC_DAC_DAPLLAVC = 0xa4
 
static constexpr uint8_t AC_DAC_DAPOPT = 0xb1
 
static constexpr uint8_t AC_DAC_DAPRHAVC = 0xa5
 
static constexpr uint8_t AC_DAC_DAPRLAVC = 0xa6
 
static constexpr int ACK_CHECK_DIS = 0x0
 
static constexpr int ACK_CHECK_EN = 0x1
 
static constexpr int ACK_VAL = 0x0
 
static constexpr uint8_t ADC_APC_CTRL = 0x50
 
static constexpr uint8_t ADC_DIG_CTRL = 0x40
 
static constexpr uint8_t ADC_SRC = 0x51
 
static constexpr uint8_t ADC_SRCBST_CTRL = 0x52
 
static constexpr uint8_t ADC_VOL_CTRL = 0x41
 
static constexpr uint8_t CHIP_AUDIO_RS = 0x00
 
static constexpr uint8_t DAC_DAP_ENA = 0xb5
 
static constexpr uint8_t DAC_DIG_CTRL = 0x48
 
static constexpr uint8_t DAC_MXR_GAIN = 0x4d
 
static constexpr uint8_t DAC_MXR_SRC = 0x4c
 
static constexpr uint8_t DAC_VOL_CTRL = 0x49
 
static constexpr uint8_t HMIC_CTRL1 = 0x44
 
static constexpr uint8_t HMIC_CTRL2 = 0x45
 
static constexpr uint8_t HMIC_STATUS = 0x46
 
static constexpr uint8_t HPOUT_CTRL = 0x56
 
static constexpr int I2C_MASTER_READ = 1
 
static constexpr int I2C_MASTER_WRITE = 0
 
static constexpr uint8_t I2S1_MXR_GAIN = 0x18
 
static constexpr uint8_t I2S1_MXR_SRC = 0x13
 
static constexpr uint8_t I2S1_SDIN_CTRL = 0x12
 
static constexpr uint8_t I2S1_SDOUT_CTRL = 0x11
 
static constexpr uint8_t I2S1_VOL_CTRL1 = 0x14
 
static constexpr uint8_t I2S1_VOL_CTRL2 = 0x15
 
static constexpr uint8_t I2S1_VOL_CTRL3 = 0x16
 
static constexpr uint8_t I2S1_VOL_CTRL4 = 0x17
 
static constexpr uint8_t I2S1LCK_CTRL = 0x10
 
static constexpr uint8_t I2S_SR_CTRL = 0x06
 
static constexpr uint8_t MOD_CLK_ENA = 0x04
 
static constexpr uint8_t MOD_RST_CTRL = 0x05
 
static constexpr int NACK_VAL = 0x1
 
static constexpr uint8_t OMIXER_BST1_CTRL = 0x55
 
static constexpr uint8_t OMIXER_DACA_CTRL = 0x53
 
static constexpr uint8_t OMIXER_SR = 0x54
 
static constexpr uint8_t PLL_CTRL1 = 0x01
 
static constexpr uint8_t PLL_CTRL2 = 0x02
 
static constexpr int READ_BIT = 1
 
static constexpr uint8_t SPKOUT_CTRL = 0x58
 
static constexpr uint8_t SYSCLK_CTRL = 0x03
 
static constexpr int WRITE_BIT = 0
 

Protected Attributes

int i2c_addr = AC101_ADDR
 
i2c_bus_handle_t i2c_handle = nullptr
 

Detailed Description

Header-only driver class for the AC101 codec chip.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AC101()

AC101 ( )
default

Member Function Documentation

◆ configI2S()

error_t configI2S ( codec_mode_t  mode,
I2SDefinition *  iface 
)
inline

◆ ctrlStateActive()

error_t ctrlStateActive ( codec_mode_t  mode,
bool  ctrlStateActive 
)
inline

◆ deinit()

error_t deinit ( )
inline

◆ getEarphVolume()

int getEarphVolume ( )
inline

◆ getSpkVolume()

int getSpkVolume ( )
inline

◆ getSrcValue()

uint16_t getSrcValue ( input_device_t  input_device)
inline

Determines the value for the SRC register based on the selected input_device.

◆ getVoiceVolume()

error_t getVoiceVolume ( int *  volume)
inline

◆ i2sConfigClock()

error_t i2sConfigClock ( ac_i2s_clock_t *  cfg)
inline

◆ init()

error_t init ( codec_config_t *  codec_cfg)
inline

◆ readI2C()

error_t readI2C ( uint8_t  devAddr,
uint8_t  reg_add,
uint8_t *  p_data,
size_t  size 
)
inline

◆ readReg()

uint16_t readReg ( uint8_t  reg_addr)
inline

◆ setAddress()

void setAddress ( int  addr)
inline

Defines the I2C device address.

◆ setCodecClk()

void setCodecClk ( samplerate_t  sampledata)
inline

◆ setEarphVolume()

error_t setEarphVolume ( uint8_t  volume)
inline

◆ setOutputMixerGain()

error_t setOutputMixerGain ( ac_output_mixer_gain_t  gain,
ac_output_mixer_source_t  source 
)
inline

◆ setSpkVolume()

error_t setSpkVolume ( uint8_t  volume)
inline

◆ setVoiceMute()

error_t setVoiceMute ( bool  enable)
inline

◆ setVoiceVolume()

error_t setVoiceVolume ( int  volume)
inline

◆ setWire()

void setWire ( i2c_bus_handle_t  handle)
inline

Defines the I2C bus instance to be used.

◆ start()

error_t start ( ac_module_t  mode)
inline

◆ stop()

error_t stop ( ac_module_t  mode)
inline

◆ writeReg()

error_t writeReg ( uint8_t  reg_add,
uint16_t  data 
)
inline

Member Data Documentation

◆ AC101_ADDR

constexpr int AC101_ADDR = 0x1A
staticconstexpr

◆ AC_DAC_DAPCTRL

constexpr uint8_t AC_DAC_DAPCTRL = 0xa0
staticconstexpr

◆ AC_DAC_DAPHETHD

constexpr uint8_t AC_DAC_DAPHETHD = 0xab
staticconstexpr

◆ AC_DAC_DAPHGATC

constexpr uint8_t AC_DAC_DAPHGATC = 0xa9
staticconstexpr

◆ AC_DAC_DAPHGDEC

constexpr uint8_t AC_DAC_DAPHGDEC = 0xa7
staticconstexpr

◆ AC_DAC_DAPHGKPA

constexpr uint8_t AC_DAC_DAPHGKPA = 0xad
staticconstexpr

◆ AC_DAC_DAPHGOPA

constexpr uint8_t AC_DAC_DAPHGOPA = 0xaf
staticconstexpr

◆ AC_DAC_DAPHHPFC

constexpr uint8_t AC_DAC_DAPHHPFC = 0xa1
staticconstexpr

◆ AC_DAC_DAPLETHD

constexpr uint8_t AC_DAC_DAPLETHD = 0xac
staticconstexpr

◆ AC_DAC_DAPLGATC

constexpr uint8_t AC_DAC_DAPLGATC = 0xaa
staticconstexpr

◆ AC_DAC_DAPLGDEC

constexpr uint8_t AC_DAC_DAPLGDEC = 0xa8
staticconstexpr

◆ AC_DAC_DAPLGKPA

constexpr uint8_t AC_DAC_DAPLGKPA = 0xae
staticconstexpr

◆ AC_DAC_DAPLGOPA

constexpr uint8_t AC_DAC_DAPLGOPA = 0xb0
staticconstexpr

◆ AC_DAC_DAPLHAVC

constexpr uint8_t AC_DAC_DAPLHAVC = 0xa3
staticconstexpr

◆ AC_DAC_DAPLHPFC

constexpr uint8_t AC_DAC_DAPLHPFC = 0xa2
staticconstexpr

◆ AC_DAC_DAPLLAVC

constexpr uint8_t AC_DAC_DAPLLAVC = 0xa4
staticconstexpr

◆ AC_DAC_DAPOPT

constexpr uint8_t AC_DAC_DAPOPT = 0xb1
staticconstexpr

◆ AC_DAC_DAPRHAVC

constexpr uint8_t AC_DAC_DAPRHAVC = 0xa5
staticconstexpr

◆ AC_DAC_DAPRLAVC

constexpr uint8_t AC_DAC_DAPRLAVC = 0xa6
staticconstexpr

◆ ACK_CHECK_DIS

constexpr int ACK_CHECK_DIS = 0x0
staticconstexpr

◆ ACK_CHECK_EN

constexpr int ACK_CHECK_EN = 0x1
staticconstexpr

◆ ACK_VAL

constexpr int ACK_VAL = 0x0
staticconstexpr

◆ ADC_APC_CTRL

constexpr uint8_t ADC_APC_CTRL = 0x50
staticconstexpr

◆ ADC_DIG_CTRL

constexpr uint8_t ADC_DIG_CTRL = 0x40
staticconstexpr

◆ ADC_SRC

constexpr uint8_t ADC_SRC = 0x51
staticconstexpr

◆ ADC_SRCBST_CTRL

constexpr uint8_t ADC_SRCBST_CTRL = 0x52
staticconstexpr

◆ ADC_VOL_CTRL

constexpr uint8_t ADC_VOL_CTRL = 0x41
staticconstexpr

◆ CHIP_AUDIO_RS

constexpr uint8_t CHIP_AUDIO_RS = 0x00
staticconstexpr

◆ DAC_DAP_ENA

constexpr uint8_t DAC_DAP_ENA = 0xb5
staticconstexpr

◆ DAC_DIG_CTRL

constexpr uint8_t DAC_DIG_CTRL = 0x48
staticconstexpr

◆ DAC_MXR_GAIN

constexpr uint8_t DAC_MXR_GAIN = 0x4d
staticconstexpr

◆ DAC_MXR_SRC

constexpr uint8_t DAC_MXR_SRC = 0x4c
staticconstexpr

◆ DAC_VOL_CTRL

constexpr uint8_t DAC_VOL_CTRL = 0x49
staticconstexpr

◆ HMIC_CTRL1

constexpr uint8_t HMIC_CTRL1 = 0x44
staticconstexpr

◆ HMIC_CTRL2

constexpr uint8_t HMIC_CTRL2 = 0x45
staticconstexpr

◆ HMIC_STATUS

constexpr uint8_t HMIC_STATUS = 0x46
staticconstexpr

◆ HPOUT_CTRL

constexpr uint8_t HPOUT_CTRL = 0x56
staticconstexpr

◆ i2c_addr

int i2c_addr = AC101_ADDR
protected

◆ i2c_handle

i2c_bus_handle_t i2c_handle = nullptr
protected

◆ I2C_MASTER_READ

constexpr int I2C_MASTER_READ = 1
staticconstexpr

◆ I2C_MASTER_WRITE

constexpr int I2C_MASTER_WRITE = 0
staticconstexpr

◆ I2S1_MXR_GAIN

constexpr uint8_t I2S1_MXR_GAIN = 0x18
staticconstexpr

◆ I2S1_MXR_SRC

constexpr uint8_t I2S1_MXR_SRC = 0x13
staticconstexpr

◆ I2S1_SDIN_CTRL

constexpr uint8_t I2S1_SDIN_CTRL = 0x12
staticconstexpr

◆ I2S1_SDOUT_CTRL

constexpr uint8_t I2S1_SDOUT_CTRL = 0x11
staticconstexpr

◆ I2S1_VOL_CTRL1

constexpr uint8_t I2S1_VOL_CTRL1 = 0x14
staticconstexpr

◆ I2S1_VOL_CTRL2

constexpr uint8_t I2S1_VOL_CTRL2 = 0x15
staticconstexpr

◆ I2S1_VOL_CTRL3

constexpr uint8_t I2S1_VOL_CTRL3 = 0x16
staticconstexpr

◆ I2S1_VOL_CTRL4

constexpr uint8_t I2S1_VOL_CTRL4 = 0x17
staticconstexpr

◆ I2S1LCK_CTRL

constexpr uint8_t I2S1LCK_CTRL = 0x10
staticconstexpr

◆ I2S_SR_CTRL

constexpr uint8_t I2S_SR_CTRL = 0x06
staticconstexpr

◆ MOD_CLK_ENA

constexpr uint8_t MOD_CLK_ENA = 0x04
staticconstexpr

◆ MOD_RST_CTRL

constexpr uint8_t MOD_RST_CTRL = 0x05
staticconstexpr

◆ NACK_VAL

constexpr int NACK_VAL = 0x1
staticconstexpr

◆ OMIXER_BST1_CTRL

constexpr uint8_t OMIXER_BST1_CTRL = 0x55
staticconstexpr

◆ OMIXER_DACA_CTRL

constexpr uint8_t OMIXER_DACA_CTRL = 0x53
staticconstexpr

◆ OMIXER_SR

constexpr uint8_t OMIXER_SR = 0x54
staticconstexpr

◆ PLL_CTRL1

constexpr uint8_t PLL_CTRL1 = 0x01
staticconstexpr

◆ PLL_CTRL2

constexpr uint8_t PLL_CTRL2 = 0x02
staticconstexpr

◆ READ_BIT

constexpr int READ_BIT = 1
staticconstexpr

◆ SPKOUT_CTRL

constexpr uint8_t SPKOUT_CTRL = 0x58
staticconstexpr

◆ SYSCLK_CTRL

constexpr uint8_t SYSCLK_CTRL = 0x03
staticconstexpr

◆ WRITE_BIT

constexpr int WRITE_BIT = 0
staticconstexpr

The documentation for this class was generated from the following file: