diff --git a/firmware/Src/bd3491.c b/firmware/Src/bd3491.c index 0cac892..9ac070b 100644 --- a/firmware/Src/bd3491.c +++ b/firmware/Src/bd3491.c @@ -64,8 +64,11 @@ int bd_set_gain(I2C_HandleTypeDef * handle, uint8_t gain_in_db) { uint8_t bd_set_attenuation(I2C_HandleTypeDef * handle, uint8_t right_channel, uint8_t attenuation_in_db) { if ((attenuation_in_db&0x7F) > 87) attenuation_in_db = BD_INF_ATTENUATION; - - bd_write_reg(handle, 0x21 + right_channel, attenuation_in_db | 0x80); + + if (right_channel) + right_channel = 1; + + bd_write_reg(handle, 0x22 - right_channel, attenuation_in_db | 0x80); return attenuation_in_db; } @@ -83,7 +86,7 @@ uint8_t bd_set_treble_boost(I2C_HandleTypeDef * handle, uint8_t gain) { if (gain > 0x07) gain = 0x07; bd_write_reg(handle, 0x57, (gain == 0)?(0x80):(0x00) | (gain&0x07) << 1); - + return gain; }