arduino-audio-driver
Loading...
Searching...
No Matches
ES8156 Class Reference

Header-only driver class for the ES8156 DAC chip. More...

#include <ES8156.h>

Public Member Functions

 ES8156 ()=default
error_t configI2S (codec_mode_t mode, I2SDefinition *iface)
 Configure ES8156 codec mode and I2S interface.
error_t ctrlStateActive (codec_mode_t mode, bool ctrl_state_active)
 Control ES8156 codec chip.
error_t deinit (void)
 Deinitialize ES8156 codec chip.
error_t getVoiceVolume (int *volume)
 Get voice volume (0~100).
error_t init (codec_config_t *cfg)
 Initialize ES8156 codec chip.
int readReg (uint8_t reg_addr)
error_t resume (void)
void setAddress (int addr)
 Defines the I2C device address.
error_t setVoiceMute (bool enable)
 Configure ES8156 DAC mute or not.
error_t setVoiceVolume (int volume)
 Set voice volume.
void setWire (i2c_bus_handle_t handle)
 Defines the I2C bus instance to be used.
error_t standby (void)
error_t writeReg (uint8_t reg_addr, uint8_t data)

Static Public Member Functions

static constexpr int bitVal (int nr)

Static Public Attributes

static constexpr int ES8156_ADDR = 0x8
static constexpr uint8_t ES8156_ALC_CONFIG1_REG15 = 0x15
static constexpr uint8_t ES8156_ALC_CONFIG2_REG16 = 0x16
static constexpr uint8_t ES8156_ALC_CONFIG3_REG17 = 0x17
static constexpr uint8_t ES8156_ANALOG_LP_REG24 = 0x24
static constexpr uint8_t ES8156_ANALOG_SYS1_REG20 = 0x20
static constexpr uint8_t ES8156_ANALOG_SYS2_REG21 = 0x21
static constexpr uint8_t ES8156_ANALOG_SYS3_REG22 = 0x22
static constexpr uint8_t ES8156_ANALOG_SYS4_REG23 = 0x23
static constexpr uint8_t ES8156_ANALOG_SYS5_REG25 = 0x25
static constexpr uint8_t ES8156_AUTOMUTE_SET_REG12 = 0x12
static constexpr uint8_t ES8156_CHIP_STATUS_REG0C = 0x0c
static constexpr uint8_t ES8156_CHIP_VERSION_REGFF = 0xFF
static constexpr uint8_t ES8156_CHIPID0_REGFE = 0xFE
static constexpr uint8_t ES8156_CHIPID1_REGFD = 0xFD
static constexpr uint8_t ES8156_CLOCK_ON_OFF_REG08 = 0x08
static constexpr uint8_t ES8156_DAC_MUTE_REG13 = 0x13
static constexpr uint8_t ES8156_DAC_OSR_COUNTER_REG10 = 0x10
static constexpr uint8_t ES8156_DAC_SDP_REG11 = 0x11
static constexpr uint8_t ES8156_EQ_CONTROL1_REG19 = 0x19
static constexpr uint8_t ES8156_EQ_CONTROL2_REG1A = 0x1a
static constexpr uint8_t ES8156_I2C_PAGESEL_REGFC = 0xFC
static constexpr uint8_t ES8156_LRCLK_DIV_H_REG03 = 0x03
static constexpr uint8_t ES8156_LRCLK_DIV_L_REG04 = 0x04
static constexpr uint8_t ES8156_MAINCLOCK_CTL_REG01 = 0x01
static constexpr uint8_t ES8156_MISC_CONTROL1_REG07 = 0x07
static constexpr uint8_t ES8156_MISC_CONTROL2_REG09 = 0x09
static constexpr uint8_t ES8156_MISC_CONTROL3_REG18 = 0x18
static constexpr uint8_t ES8156_NFS_CONFIG_REG06 = 0x06
static constexpr uint8_t ES8156_P2S_CONTROL_REG0D = 0x0d
static constexpr uint8_t ES8156_RESET_REG00 = 0x00
static constexpr uint8_t ES8156_SCLK_DIV_REG05 = 0x05
static constexpr uint8_t ES8156_SCLK_MODE_REG02 = 0x02
static constexpr uint8_t ES8156_TIME_CONTROL1_REG0A = 0x0a
static constexpr uint8_t ES8156_TIME_CONTROL2_REG0B = 0x0b
static constexpr uint8_t ES8156_VOLUME_CONTROL_REG14 = 0x14

Protected Attributes

codec_dac_volume_config_t * dac_vol_handle
int i2c_addr = ES8156_ADDR
i2c_bus_handle_t i2c_handle = nullptr
bool initialized = false

Detailed Description

Header-only driver class for the ES8156 DAC chip.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ ES8156()

ES8156 ( )
default

Member Function Documentation

◆ bitVal()

constexpr int bitVal ( int nr)
inlinestaticconstexpr

◆ configI2S()

error_t configI2S ( codec_mode_t mode,
I2SDefinition * iface )
inline

Configure ES8156 codec mode and I2S interface.

◆ ctrlStateActive()

error_t ctrlStateActive ( codec_mode_t mode,
bool ctrl_state_active )
inline

Control ES8156 codec chip.

◆ deinit()

error_t deinit ( void )
inline

Deinitialize ES8156 codec chip.

◆ getVoiceVolume()

error_t getVoiceVolume ( int * volume)
inline

Get voice volume (0~100).

◆ init()

error_t init ( codec_config_t * cfg)
inline

Initialize ES8156 codec chip.

◆ readReg()

int readReg ( uint8_t reg_addr)
inline

◆ resume()

error_t resume ( void )
inline

◆ setAddress()

void setAddress ( int addr)
inline

Defines the I2C device address.

◆ setVoiceMute()

error_t setVoiceMute ( bool enable)
inline

Configure ES8156 DAC mute or not.

◆ setVoiceVolume()

error_t setVoiceVolume ( int volume)
inline

Set voice volume.

Note
Register values. 0x00: -95.5 dB, 0x5B: -50 dB, 0xBF: 0 dB, 0xFF: 32 dB
Accuracy of gain is 0.5 dB
Parameters
volumevoice volume (0~100)

◆ setWire()

void setWire ( i2c_bus_handle_t handle)
inline

Defines the I2C bus instance to be used.

◆ standby()

error_t standby ( void )
inline

◆ writeReg()

error_t writeReg ( uint8_t reg_addr,
uint8_t data )
inline

Member Data Documentation

◆ dac_vol_handle

codec_dac_volume_config_t* dac_vol_handle
protected

◆ ES8156_ADDR

int ES8156_ADDR = 0x8
staticconstexpr

◆ ES8156_ALC_CONFIG1_REG15

uint8_t ES8156_ALC_CONFIG1_REG15 = 0x15
staticconstexpr

◆ ES8156_ALC_CONFIG2_REG16

uint8_t ES8156_ALC_CONFIG2_REG16 = 0x16
staticconstexpr

◆ ES8156_ALC_CONFIG3_REG17

uint8_t ES8156_ALC_CONFIG3_REG17 = 0x17
staticconstexpr

◆ ES8156_ANALOG_LP_REG24

uint8_t ES8156_ANALOG_LP_REG24 = 0x24
staticconstexpr

◆ ES8156_ANALOG_SYS1_REG20

uint8_t ES8156_ANALOG_SYS1_REG20 = 0x20
staticconstexpr

◆ ES8156_ANALOG_SYS2_REG21

uint8_t ES8156_ANALOG_SYS2_REG21 = 0x21
staticconstexpr

◆ ES8156_ANALOG_SYS3_REG22

uint8_t ES8156_ANALOG_SYS3_REG22 = 0x22
staticconstexpr

◆ ES8156_ANALOG_SYS4_REG23

uint8_t ES8156_ANALOG_SYS4_REG23 = 0x23
staticconstexpr

◆ ES8156_ANALOG_SYS5_REG25

uint8_t ES8156_ANALOG_SYS5_REG25 = 0x25
staticconstexpr

◆ ES8156_AUTOMUTE_SET_REG12

uint8_t ES8156_AUTOMUTE_SET_REG12 = 0x12
staticconstexpr

◆ ES8156_CHIP_STATUS_REG0C

uint8_t ES8156_CHIP_STATUS_REG0C = 0x0c
staticconstexpr

◆ ES8156_CHIP_VERSION_REGFF

uint8_t ES8156_CHIP_VERSION_REGFF = 0xFF
staticconstexpr

◆ ES8156_CHIPID0_REGFE

uint8_t ES8156_CHIPID0_REGFE = 0xFE
staticconstexpr

◆ ES8156_CHIPID1_REGFD

uint8_t ES8156_CHIPID1_REGFD = 0xFD
staticconstexpr

◆ ES8156_CLOCK_ON_OFF_REG08

uint8_t ES8156_CLOCK_ON_OFF_REG08 = 0x08
staticconstexpr

◆ ES8156_DAC_MUTE_REG13

uint8_t ES8156_DAC_MUTE_REG13 = 0x13
staticconstexpr

◆ ES8156_DAC_OSR_COUNTER_REG10

uint8_t ES8156_DAC_OSR_COUNTER_REG10 = 0x10
staticconstexpr

◆ ES8156_DAC_SDP_REG11

uint8_t ES8156_DAC_SDP_REG11 = 0x11
staticconstexpr

◆ ES8156_EQ_CONTROL1_REG19

uint8_t ES8156_EQ_CONTROL1_REG19 = 0x19
staticconstexpr

◆ ES8156_EQ_CONTROL2_REG1A

uint8_t ES8156_EQ_CONTROL2_REG1A = 0x1a
staticconstexpr

◆ ES8156_I2C_PAGESEL_REGFC

uint8_t ES8156_I2C_PAGESEL_REGFC = 0xFC
staticconstexpr

◆ ES8156_LRCLK_DIV_H_REG03

uint8_t ES8156_LRCLK_DIV_H_REG03 = 0x03
staticconstexpr

◆ ES8156_LRCLK_DIV_L_REG04

uint8_t ES8156_LRCLK_DIV_L_REG04 = 0x04
staticconstexpr

◆ ES8156_MAINCLOCK_CTL_REG01

uint8_t ES8156_MAINCLOCK_CTL_REG01 = 0x01
staticconstexpr

◆ ES8156_MISC_CONTROL1_REG07

uint8_t ES8156_MISC_CONTROL1_REG07 = 0x07
staticconstexpr

◆ ES8156_MISC_CONTROL2_REG09

uint8_t ES8156_MISC_CONTROL2_REG09 = 0x09
staticconstexpr

◆ ES8156_MISC_CONTROL3_REG18

uint8_t ES8156_MISC_CONTROL3_REG18 = 0x18
staticconstexpr

◆ ES8156_NFS_CONFIG_REG06

uint8_t ES8156_NFS_CONFIG_REG06 = 0x06
staticconstexpr

◆ ES8156_P2S_CONTROL_REG0D

uint8_t ES8156_P2S_CONTROL_REG0D = 0x0d
staticconstexpr

◆ ES8156_RESET_REG00

uint8_t ES8156_RESET_REG00 = 0x00
staticconstexpr

◆ ES8156_SCLK_DIV_REG05

uint8_t ES8156_SCLK_DIV_REG05 = 0x05
staticconstexpr

◆ ES8156_SCLK_MODE_REG02

uint8_t ES8156_SCLK_MODE_REG02 = 0x02
staticconstexpr

◆ ES8156_TIME_CONTROL1_REG0A

uint8_t ES8156_TIME_CONTROL1_REG0A = 0x0a
staticconstexpr

◆ ES8156_TIME_CONTROL2_REG0B

uint8_t ES8156_TIME_CONTROL2_REG0B = 0x0b
staticconstexpr

◆ ES8156_VOLUME_CONTROL_REG14

uint8_t ES8156_VOLUME_CONTROL_REG14 = 0x14
staticconstexpr

◆ i2c_addr

int i2c_addr = ES8156_ADDR
protected

◆ i2c_handle

i2c_bus_handle_t i2c_handle = nullptr
protected

◆ initialized

bool initialized = false
protected

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