File tree Expand file tree Collapse file tree 4 files changed +4
-24
lines changed Expand file tree Collapse file tree 4 files changed +4
-24
lines changed Original file line number Diff line number Diff line change @@ -273,8 +273,7 @@ class AudioDriverAC101Class : public AudioDriver {
273
273
274
274
protected:
275
275
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;
278
277
};
279
278
bool deinit () { return ac101_deinit () == RESULT_OK; }
280
279
bool controlState (codec_mode_t mode) {
Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ static i2c_bus_handle_t i2c_handle = NULL;
14
14
return b; \
15
15
}
16
16
17
- void ac101_set_i2c_handle (i2c_bus_handle_t handle ){
18
- i2c_handle = handle ;
19
- }
20
-
21
17
22
18
static error_t ac101_write_reg (uint8_t reg_add , uint16_t data ){
23
19
uint8_t send_buff [2 ];
@@ -101,10 +97,10 @@ uint16_t get_src_value(input_device_t input_device){
101
97
return src_value ;
102
98
}
103
99
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 )
105
101
{
106
102
error_t res = RESULT_OK ;
107
-
103
+ i2c_handle = handle ;
108
104
109
105
res = ac101_write_reg (CHIP_AUDIO_RS , 0x123 );
110
106
delay (1000 );
Original file line number Diff line number Diff line change @@ -166,9 +166,8 @@ typedef struct {
166
166
ac_i2s1_lrck_div_t lclk_div ; /*!< WS clock divide */
167
167
} ac_i2s_clock_t ;
168
168
169
- void ac101_set_i2c_handle (i2c_bus_handle_t i2c_handle );
170
169
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 );
172
171
error_t ac101_deinit (void );
173
172
error_t ac101_ctrl_state_active (codec_mode_t mode , bool ctrl_state_active );
174
173
error_t ac101_config_i2s (codec_mode_t mode , I2SDefinition * iface );
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments