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 {
273273
274274protected:
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) {
Original file line number Diff line number Diff 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
2218static 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 );
Original file line number Diff line number Diff 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 );
172171error_t ac101_deinit (void );
173172error_t ac101_ctrl_state_active (codec_mode_t mode , bool ctrl_state_active );
174173error_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