Skip to content

Commit 3c88371

Browse files
committed
Migrate ESP32 I2C port numbers to Arduino Port Numbers
1 parent 9e060ae commit 3c88371

File tree

12 files changed

+21
-19
lines changed

12 files changed

+21
-19
lines changed

src/Driver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class AudioDriverAC101Class : public AudioDriver {
291291
*/
292292
class AudioDriverCS43l22Class : public AudioDriver {
293293
public:
294-
AudioDriverCS43l22Class(uint16_t deviceAddr = 0x94 ) {
294+
AudioDriverCS43l22Class(uint16_t deviceAddr = 0x4A) {
295295
this->deviceAddr = deviceAddr;
296296
}
297297

@@ -829,7 +829,7 @@ class AudioDriverWM8960Class : public AudioDriver {
829829
*/
830830
class AudioDriverWM8994Class : public AudioDriver {
831831
public:
832-
AudioDriverWM8994Class(uint16_t deviceAddr = 0x34) {
832+
AudioDriverWM8994Class(uint16_t deviceAddr = 0x1A) {
833833
this->deviceAddr = deviceAddr;
834834
}
835835

src/Driver/ac101/ac101.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define I2C_MASTER_READ 1
1212

1313

14-
#define AC101_ADDR 0x34 /*!< Device address 0x1a/0x34 */
14+
#define AC101_ADDR 0x1A /*!< Device address 0x1a/0x34 */
1515

1616
#undef READ_BIT
1717
#define WRITE_BIT I2C_MASTER_WRITE /*!< I2C master write */

src/Driver/es7210/es7210.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define TAG_ES7210 "ES7210"
3131

3232
/* ES7210 address*/
33-
#define ES7210_ADDR ES7210_AD1_AD0_00
33+
#define ES7210_ADDR ES7210_AD1_AD0_00>>1
3434
#define ES7210_MCLK_SOURCE FROM_CLOCK_DOUBLE_PIN /* In master mode, 0 : MCLK from pad 1 : MCLK from clock doubler */
3535
#define FROM_PAD_PIN 0
3636
#define FROM_CLOCK_DOUBLE_PIN 1

src/Driver/es7243/es7243.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
}
3636

3737
static i2c_bus_handle_t i2c_handle;
38-
static int es7243_addr = 0x26;
38+
static int es7243_addr = 0x13; // 0x26>>1;
3939
static int mclk_gpio = 0;
4040

4141
// func_t AUDIO_CODEC_ES7243_DEFAULT_HANDLE = {

src/Driver/es7243e/es7243e.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
//static char *TAG = "DRV7243E";
2929
static i2c_bus_handle_t i2c_handle;
30-
static int es7243e_addr = 0x20;
30+
static int es7243e_addr = 0x10; //0x20 >> 1;
3131

3232
// func_t AUDIO_CODEC_ES7243E_DEFAULT_HANDLE = {
3333
// .audio_codec_initialize = es7243e_adc_init,

src/Driver/es8156/es8156.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
#include "es8156.h"
2828

2929
#define BIT(nr) (1 << (nr))
30-
#define ES8156_ADDR 0x10
31-
#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */
30+
// 0x8 = 0x10>>1
31+
#define ES8156_ADDR 0x8
32+
#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */
3233

3334
//static const char *TAG = "DRV8156";
3435
static bool codec_init_flag = 0;

src/Driver/es8311/es8311.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030

3131
/* ES8311 address
3232
* 0x32:CE=1;0x30:CE=0
33+
* 0x30>>1 = 0x18
3334
*/
34-
#define ES8311_ADDR 0x30
35+
#define ES8311_ADDR 0x18
3536

3637
/*
3738
* to define the clock soure of MCLK

src/Driver/es8374/es8374.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
extern "C" {
3434
#endif
3535

36-
/* ES8374 address */
37-
#define ES8374_ADDR 0x20 // 0x22:CE=1;0x20:CE=0
36+
/* ES8374 address 0x22:CE=1;0x20:CE=0 / 0x20>>1 = 0x10 */
37+
#define ES8374_ADDR 0x10
3838

3939
/**
4040
* @brief Initialize ES8374 codec chip

src/Driver/es8388/es8388.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
extern "C" {
3434
#endif
3535

36-
/* ES8388 address */
37-
#define ES8388_ADDR 0x20 /*!< 0x22:CE=1;0x20:CE=0*/
38-
36+
/* ES8388 address 0x22:CE=1;0x20:CE=0 */
37+
#define ES8388_ADDR 0x10
3938
/* ES8388 register */
4039
#define ES8388_CONTROL1 0x00
4140
#define ES8388_CONTROL2 0x01

src/Driver/tas5805m/tas5805m.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
#include "tas5805m.h"
2727
#include "tas5805m_reg_cfg.h"
2828
#include "Utils/etc.h"
29+
// 0x5c>>1 = 0x2E
2930

30-
#define TAS5805M_ADDR 0x5c
31+
#define TAS5805M_ADDR 0x2E
3132
//#define TAS5805M_RST_GPIO get_pa_enable_gpio()
3233
#define TAS5805M_VOLUME_MAX 100
3334
#define TAS5805M_VOLUME_MIN 0

src/Driver/wm8960/mtb_wm8960.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ extern "C"
4949
{
5050
#endif
5151

52-
#define WM8960_I2C_ADDRESS (0x1A)
53-
52+
// (0x1A>>1) = 0xD
53+
#define WM8960_I2C_ADDRESS 0xD
5454
#ifdef ARDUINO
5555
# define WM8960_LOG(msg) Serial.println(msg)
5656
#else

src/Utils/I2C.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ error_t i2c_bus_read_bytes(i2c_bus_handle_t bus, int addr, uint8_t *reg,
4242
memset(outdata,0,datalen);
4343
int result = RESULT_OK;
4444

45-
p_wire->beginTransmission(addr >> 1);
45+
p_wire->beginTransmission(addr);
4646
p_wire->write(reg, reglen);
4747
int rc = p_wire->endTransmission();
4848
if (rc != 0) {
4949
AD_LOGE("->p_wire->endTransmission: %d", rc);
5050
}
5151

52-
uint8_t result_len = p_wire->requestFrom((addr >> 1), datalen, (int) true);
52+
uint8_t result_len = p_wire->requestFrom((addr), datalen, (int) true);
5353
if (result_len > 0) {
5454
result_len = p_wire->readBytes(outdata, datalen);
5555
} else {

0 commit comments

Comments
 (0)