firmware: fix input numberingch5 was shorting all inputs
This commit is contained in:
parent
95f4f5dd71
commit
d28508f7bf
@ -6,6 +6,11 @@
|
||||
|
||||
#include "stm32f1xx_hal.h"
|
||||
|
||||
#define BD_INPUT_MUTE (1<<4)
|
||||
#define BD_INPUT_ALL (1<<5)
|
||||
|
||||
// number can either be 0-5 (meaning CHANNEL1 to CHANNEL 6)
|
||||
// or BD_INPUT_MUTE or BD_INPUT_SHORT
|
||||
void bd_set_input(I2C_HandleTypeDef * handle, uint8_t number);
|
||||
|
||||
#define BD_MAX_GAIN 20 // gain in db
|
||||
|
@ -17,12 +17,24 @@ void bd_write_reg(I2C_HandleTypeDef * handle, uint8_t reg, uint8_t data) {
|
||||
HAL_I2C_Master_Transmit(handle, 0b10000010, out, sizeof(out), HAL_MAX_DELAY);
|
||||
}
|
||||
|
||||
void bd_set_input(I2C_HandleTypeDef * handle, uint8_t number) {
|
||||
if (number > 5) {
|
||||
return;
|
||||
}
|
||||
|
||||
bd_write_reg(handle, 0x04, number);
|
||||
#define BD_INPUT_TABLE(a) \
|
||||
a(0, 0) \
|
||||
a(1, 1) \
|
||||
a(2, 2) \
|
||||
a(3, 3) \
|
||||
a(4, 4) \
|
||||
a(5, 6) \
|
||||
a(BD_INPUT_ALL, 5) \
|
||||
a(BD_INPUT_MUTE, 7)
|
||||
|
||||
|
||||
void bd_set_input(I2C_HandleTypeDef * handle, uint8_t number) {
|
||||
#define INPUT_CASE(num, out) case num: bd_write_reg(handle, 0x04, out); break;
|
||||
switch(number) {
|
||||
BD_INPUT_TABLE(INPUT_CASE)
|
||||
}
|
||||
#undef INPUT_CASE
|
||||
}
|
||||
|
||||
#define BD_GAIN_TABLE(a) \
|
||||
|
Loading…
Reference in New Issue
Block a user