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

Header-only driver class for the ES7210 ADC chip. More...

#include <ES7210.h>

Public Member Functions

 ES7210 ()=default
 
error_t configFmt (i2s_format_t fmt)
 
error_t configI2S (codec_mode_t mode, I2SDefinition *iface)
 Configure ES7210 ADC mode and I2S interface.
 
error_t configSample (samplerate_t sample)
 
error_t ctrlStateActive (codec_mode_t mode, bool ctrl_state_active)
 Control ES7210 ADC chip.
 
error_t deinit ()
 Deinitialize ES7210 ADC chip.
 
int getCoeff (uint32_t mclk, uint32_t lrck)
 
error_t getGain (void)
 Get gain.
 
int8_t getMclkSrc (void)
 
error_t init (codec_config_t *codec_cfg)
 Initialize ES7210 ADC chip.
 
error_t micSelect (es7210_input_mics_t mic)
 Select ES7210 mic.
 
void readAll (void)
 Read all regs of ES7210.
 
int readReg (uint8_t reg_addr)
 Read regs of ES7210.
 
void setAddress (int addr)
 Defines the I2C device address.
 
error_t setBits (sample_bits_t bits)
 
error_t setGain (es7210_gain_value_t gain)
 Set gain (Note: the enabled microphone sets the same gain)
 
error_t setMicsForChannels (channels_t ch)
 
error_t setMute (bool enable)
 Set ES7210 ADC mute status.
 
error_t setVolume (int volume)
 Set volume.
 
void setWire (i2c_bus_handle_t handle)
 Defines the I2C bus instance to be used.
 
error_t start (uint8_t clock_reg_value)
 
error_t stop (void)
 
error_t updateRegBit (uint8_t reg_addr, uint8_t update_bits, uint8_t data)
 
error_t writeReg (uint8_t reg_addr, uint8_t data)
 

Static Public Attributes

static constexpr uint8_t ES7210_ADC12_HPF1_REG22 = 0x22
 
static constexpr uint8_t ES7210_ADC12_HPF2_REG23 = 0x23
 
static constexpr uint8_t ES7210_ADC34_HPF1_REG21 = 0x21
 
static constexpr uint8_t ES7210_ADC34_HPF2_REG20 = 0x20
 
static constexpr uint8_t ES7210_ADC34_MUTERANGE_REG14 = 0x14
 
static constexpr uint8_t ES7210_ADC_AUTOMUTE_REG13 = 0x13
 
static constexpr int ES7210_ADDR = ES7210_AD1_AD0_00 >> 1
 
static constexpr uint8_t ES7210_ANALOG_REG40 = 0x40
 
static constexpr uint8_t ES7210_CLOCK_OFF_REG01 = 0x01
 
static constexpr uint8_t ES7210_LRCK_DIVH_REG04 = 0x04
 
static constexpr uint8_t ES7210_LRCK_DIVL_REG05 = 0x05
 
static constexpr uint8_t ES7210_MAINCLK_REG02 = 0x02
 
static constexpr uint8_t ES7210_MASTER_CLK_REG03 = 0x03
 
static constexpr int ES7210_MCLK_SOURCE = FROM_CLOCK_DOUBLE_PIN
 
static constexpr uint8_t ES7210_MIC12_BIAS_REG41 = 0x41
 
static constexpr uint8_t ES7210_MIC12_POWER_REG4B = 0x4B
 
static constexpr uint8_t ES7210_MIC1_ES7210_GAIN_REG43 = 0x43
 
static constexpr uint8_t ES7210_MIC1_POWER_REG47 = 0x47
 
static constexpr uint8_t ES7210_MIC2_ES7210_GAIN_REG44 = 0x44
 
static constexpr uint8_t ES7210_MIC2_POWER_REG48 = 0x48
 
static constexpr uint8_t ES7210_MIC34_BIAS_REG42 = 0x42
 
static constexpr uint8_t ES7210_MIC34_POWER_REG4C = 0x4C
 
static constexpr uint8_t ES7210_MIC3_ES7210_GAIN_REG45 = 0x45
 
static constexpr uint8_t ES7210_MIC3_POWER_REG49 = 0x49
 
static constexpr uint8_t ES7210_MIC4_ES7210_GAIN_REG46 = 0x46
 
static constexpr uint8_t ES7210_MIC4_POWER_REG4A = 0x4A
 
static constexpr uint8_t ES7210_MODE_CONFIG_REG08 = 0x08
 
static constexpr uint8_t ES7210_OSR_REG07 = 0x07
 
static constexpr uint8_t ES7210_POWER_DOWN_REG06 = 0x06
 
static constexpr uint8_t ES7210_RESET_REG00 = 0x00
 
static constexpr uint8_t ES7210_SDP_INTERFACE1_REG11 = 0x11
 
static constexpr uint8_t ES7210_SDP_INTERFACE2_REG12 = 0x12
 
static constexpr uint8_t ES7210_TIME_CONTROL0_REG09 = 0x09
 
static constexpr uint8_t ES7210_TIME_CONTROL1_REG0A = 0x0A
 
static constexpr int FROM_CLOCK_DOUBLE_PIN = 1
 
static constexpr int FROM_PAD_PIN = 0
 
static constexpr int I2S_DSP_MODE = 0
 
static constexpr int MCLK_DIV_FRE = 256
 
static constexpr const char * TAG_ES7210 = "ES7210"
 

Protected Attributes

int i2c_addr = ES7210_ADDR
 
i2c_bus_handle_t i2c_handle = nullptr
 
es7210_input_mics_t mic_select
 

Detailed Description

Header-only driver class for the ES7210 ADC chip.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ ES7210()

ES7210 ( )
default

Member Function Documentation

◆ configFmt()

error_t configFmt ( i2s_format_t  fmt)
inline

◆ configI2S()

error_t configI2S ( codec_mode_t  mode,
I2SDefinition *  iface 
)
inline

Configure ES7210 ADC mode and I2S interface.

◆ configSample()

error_t configSample ( samplerate_t  sample)
inline

◆ ctrlStateActive()

error_t ctrlStateActive ( codec_mode_t  mode,
bool  ctrl_state_active 
)
inline

Control ES7210 ADC chip.

◆ deinit()

error_t deinit ( )
inline

Deinitialize ES7210 ADC chip.

◆ getCoeff()

int getCoeff ( uint32_t  mclk,
uint32_t  lrck 
)
inline

◆ getGain()

error_t getGain ( void  )
inline

Get gain.

◆ getMclkSrc()

int8_t getMclkSrc ( void  )
inline

◆ init()

error_t init ( codec_config_t *  codec_cfg)
inline

Initialize ES7210 ADC chip.

◆ micSelect()

error_t micSelect ( es7210_input_mics_t  mic)
inline

Select ES7210 mic.

◆ readAll()

void readAll ( void  )
inline

Read all regs of ES7210.

◆ readReg()

int readReg ( uint8_t  reg_addr)
inline

Read regs of ES7210.

◆ setAddress()

void setAddress ( int  addr)
inline

Defines the I2C device address.

◆ setBits()

error_t setBits ( sample_bits_t  bits)
inline

◆ setGain()

error_t setGain ( es7210_gain_value_t  gain)
inline

Set gain (Note: the enabled microphone sets the same gain)

◆ setMicsForChannels()

error_t setMicsForChannels ( channels_t  ch)
inline

◆ setMute()

error_t setMute ( bool  enable)
inline

Set ES7210 ADC mute status.

◆ setVolume()

error_t setVolume ( int  volume)
inline

Set volume.

◆ setWire()

void setWire ( i2c_bus_handle_t  handle)
inline

Defines the I2C bus instance to be used.

◆ start()

error_t start ( uint8_t  clock_reg_value)
inline

◆ stop()

error_t stop ( void  )
inline

◆ updateRegBit()

error_t updateRegBit ( uint8_t  reg_addr,
uint8_t  update_bits,
uint8_t  data 
)
inline

◆ writeReg()

error_t writeReg ( uint8_t  reg_addr,
uint8_t  data 
)
inline

Member Data Documentation

◆ ES7210_ADC12_HPF1_REG22

constexpr uint8_t ES7210_ADC12_HPF1_REG22 = 0x22
staticconstexpr

◆ ES7210_ADC12_HPF2_REG23

constexpr uint8_t ES7210_ADC12_HPF2_REG23 = 0x23
staticconstexpr

◆ ES7210_ADC34_HPF1_REG21

constexpr uint8_t ES7210_ADC34_HPF1_REG21 = 0x21
staticconstexpr

◆ ES7210_ADC34_HPF2_REG20

constexpr uint8_t ES7210_ADC34_HPF2_REG20 = 0x20
staticconstexpr

◆ ES7210_ADC34_MUTERANGE_REG14

constexpr uint8_t ES7210_ADC34_MUTERANGE_REG14 = 0x14
staticconstexpr

◆ ES7210_ADC_AUTOMUTE_REG13

constexpr uint8_t ES7210_ADC_AUTOMUTE_REG13 = 0x13
staticconstexpr

◆ ES7210_ADDR

constexpr int ES7210_ADDR = ES7210_AD1_AD0_00 >> 1
staticconstexpr

◆ ES7210_ANALOG_REG40

constexpr uint8_t ES7210_ANALOG_REG40 = 0x40
staticconstexpr

◆ ES7210_CLOCK_OFF_REG01

constexpr uint8_t ES7210_CLOCK_OFF_REG01 = 0x01
staticconstexpr

◆ ES7210_LRCK_DIVH_REG04

constexpr uint8_t ES7210_LRCK_DIVH_REG04 = 0x04
staticconstexpr

◆ ES7210_LRCK_DIVL_REG05

constexpr uint8_t ES7210_LRCK_DIVL_REG05 = 0x05
staticconstexpr

◆ ES7210_MAINCLK_REG02

constexpr uint8_t ES7210_MAINCLK_REG02 = 0x02
staticconstexpr

◆ ES7210_MASTER_CLK_REG03

constexpr uint8_t ES7210_MASTER_CLK_REG03 = 0x03
staticconstexpr

◆ ES7210_MCLK_SOURCE

constexpr int ES7210_MCLK_SOURCE = FROM_CLOCK_DOUBLE_PIN
staticconstexpr

◆ ES7210_MIC12_BIAS_REG41

constexpr uint8_t ES7210_MIC12_BIAS_REG41 = 0x41
staticconstexpr

◆ ES7210_MIC12_POWER_REG4B

constexpr uint8_t ES7210_MIC12_POWER_REG4B = 0x4B
staticconstexpr

◆ ES7210_MIC1_ES7210_GAIN_REG43

constexpr uint8_t ES7210_MIC1_ES7210_GAIN_REG43 = 0x43
staticconstexpr

◆ ES7210_MIC1_POWER_REG47

constexpr uint8_t ES7210_MIC1_POWER_REG47 = 0x47
staticconstexpr

◆ ES7210_MIC2_ES7210_GAIN_REG44

constexpr uint8_t ES7210_MIC2_ES7210_GAIN_REG44 = 0x44
staticconstexpr

◆ ES7210_MIC2_POWER_REG48

constexpr uint8_t ES7210_MIC2_POWER_REG48 = 0x48
staticconstexpr

◆ ES7210_MIC34_BIAS_REG42

constexpr uint8_t ES7210_MIC34_BIAS_REG42 = 0x42
staticconstexpr

◆ ES7210_MIC34_POWER_REG4C

constexpr uint8_t ES7210_MIC34_POWER_REG4C = 0x4C
staticconstexpr

◆ ES7210_MIC3_ES7210_GAIN_REG45

constexpr uint8_t ES7210_MIC3_ES7210_GAIN_REG45 = 0x45
staticconstexpr

◆ ES7210_MIC3_POWER_REG49

constexpr uint8_t ES7210_MIC3_POWER_REG49 = 0x49
staticconstexpr

◆ ES7210_MIC4_ES7210_GAIN_REG46

constexpr uint8_t ES7210_MIC4_ES7210_GAIN_REG46 = 0x46
staticconstexpr

◆ ES7210_MIC4_POWER_REG4A

constexpr uint8_t ES7210_MIC4_POWER_REG4A = 0x4A
staticconstexpr

◆ ES7210_MODE_CONFIG_REG08

constexpr uint8_t ES7210_MODE_CONFIG_REG08 = 0x08
staticconstexpr

◆ ES7210_OSR_REG07

constexpr uint8_t ES7210_OSR_REG07 = 0x07
staticconstexpr

◆ ES7210_POWER_DOWN_REG06

constexpr uint8_t ES7210_POWER_DOWN_REG06 = 0x06
staticconstexpr

◆ ES7210_RESET_REG00

constexpr uint8_t ES7210_RESET_REG00 = 0x00
staticconstexpr

◆ ES7210_SDP_INTERFACE1_REG11

constexpr uint8_t ES7210_SDP_INTERFACE1_REG11 = 0x11
staticconstexpr

◆ ES7210_SDP_INTERFACE2_REG12

constexpr uint8_t ES7210_SDP_INTERFACE2_REG12 = 0x12
staticconstexpr

◆ ES7210_TIME_CONTROL0_REG09

constexpr uint8_t ES7210_TIME_CONTROL0_REG09 = 0x09
staticconstexpr

◆ ES7210_TIME_CONTROL1_REG0A

constexpr uint8_t ES7210_TIME_CONTROL1_REG0A = 0x0A
staticconstexpr

◆ FROM_CLOCK_DOUBLE_PIN

constexpr int FROM_CLOCK_DOUBLE_PIN = 1
staticconstexpr

◆ FROM_PAD_PIN

constexpr int FROM_PAD_PIN = 0
staticconstexpr

◆ i2c_addr

int i2c_addr = ES7210_ADDR
protected

◆ i2c_handle

i2c_bus_handle_t i2c_handle = nullptr
protected

◆ I2S_DSP_MODE

constexpr int I2S_DSP_MODE = 0
staticconstexpr

◆ MCLK_DIV_FRE

constexpr int MCLK_DIV_FRE = 256
staticconstexpr

◆ mic_select

es7210_input_mics_t mic_select
protected
Initial value:
= static_cast<es7210_input_mics_t>(
es7210_input_mics_t
Definition ES7210.h:46
@ ES7210_INPUT_MIC2
Definition ES7210.h:48
@ ES7210_INPUT_MIC1
Definition ES7210.h:47

◆ TAG_ES7210

constexpr const char* TAG_ES7210 = "ES7210"
staticconstexpr

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