Skip to content

Commit e71f0cd

Browse files
committed
remove set_i2c_handle
1 parent 965bd07 commit e71f0cd

File tree

4 files changed

+4
-24
lines changed

4 files changed

+4
-24
lines changed

src/Driver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,7 @@ class AudioDriverAC101Class : public AudioDriver {
273273

274274
protected:
275275
bool init(codec_config_t codec_cfg) {
276-
ac101_set_i2c_handle(getI2C());
277-
return ac101_init(&codec_cfg) == RESULT_OK;
276+
return ac101_init(&codec_cfg, getI2C()) == RESULT_OK;
278277
};
279278
bool deinit() { return ac101_deinit() == RESULT_OK; }
280279
bool controlState(codec_mode_t mode) {

src/Driver/ac101/ac101.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ static i2c_bus_handle_t i2c_handle = NULL;
1414
return b; \
1515
}
1616

17-
void ac101_set_i2c_handle(i2c_bus_handle_t handle){
18-
i2c_handle = handle;
19-
}
20-
2117

2218
static error_t ac101_write_reg(uint8_t reg_add, uint16_t data){
2319
uint8_t send_buff[2];
@@ -101,10 +97,10 @@ uint16_t get_src_value(input_device_t input_device){
10197
return src_value;
10298
}
10399

104-
error_t ac101_init(codec_config_t *codec_cfg)
100+
error_t ac101_init(codec_config_t *codec_cfg, i2c_bus_handle_t handle)
105101
{
106102
error_t res = RESULT_OK;
107-
103+
i2c_handle = handle;
108104

109105
res = ac101_write_reg(CHIP_AUDIO_RS, 0x123);
110106
delay(1000);

src/Driver/ac101/ac101.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ typedef struct {
166166
ac_i2s1_lrck_div_t lclk_div; /*!< WS clock divide */
167167
} ac_i2s_clock_t;
168168

169-
void ac101_set_i2c_handle(i2c_bus_handle_t i2c_handle);
170169

171-
error_t ac101_init(codec_config_t* codec_cfg);
170+
error_t ac101_init(codec_config_t* codec_cfg, i2c_bus_handle_t i2c_handle);
172171
error_t ac101_deinit(void);
173172
error_t ac101_ctrl_state_active(codec_mode_t mode, bool ctrl_state_active);
174173
error_t ac101_config_i2s(codec_mode_t mode, I2SDefinition* iface);

src/arduino-audio-driver.code-workspace

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)