firmware: swap left and right channel

This commit is contained in:
Julian Daube 2019-10-22 00:09:51 +02:00
parent 7498016107
commit 6bf50707c4

View File

@ -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) { uint8_t bd_set_attenuation(I2C_HandleTypeDef * handle, uint8_t right_channel, uint8_t attenuation_in_db) {
if ((attenuation_in_db&0x7F) > 87) if ((attenuation_in_db&0x7F) > 87)
attenuation_in_db = BD_INF_ATTENUATION; 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; 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; if (gain > 0x07) gain = 0x07;
bd_write_reg(handle, 0x57, (gain == 0)?(0x80):(0x00) | (gain&0x07) << 1); bd_write_reg(handle, 0x57, (gain == 0)?(0x80):(0x00) | (gain&0x07) << 1);
return gain; return gain;
} }