diff --git a/firmware/Src/main.c b/firmware/Src/main.c index 03971ab..2f137f3 100644 --- a/firmware/Src/main.c +++ b/firmware/Src/main.c @@ -63,20 +63,20 @@ void SystemClock_Config(void); /* USER CODE BEGIN 0 */ #define OUTPUT_MAP(a) \ - a(0, SW3) \ - a(1, SW2) \ - a(2, SW5) \ - a(3, SW6) \ - a(4, SW4) \ - a(5, SW7) + a(5, SW3) \ + a(4, SW2) \ + a(3, SW5) \ + a(2, SW6) \ + a(1, SW4) \ + a(0, SW7) #define OUTPUT_LED(a) \ - a(0, SW5) \ - a(1, SW2) \ - a(2, SW3) \ - a(3, SW6) \ - a(4, SW4) \ - a(5, SW7) + a(5, SW5) \ + a(4, SW2) \ + a(3, SW3) \ + a(2, SW6) \ + a(1, SW4) \ + a(0, SW7) void set_input_led(int number, int value) { switch(number) { @@ -108,9 +108,12 @@ void set_input(uint8_t channel) { if (channel == oldchannel || channel >= 6) return; + channel = channel; set_input_led(oldchannel, 0); set_input_led(channel, 1); - bd_set_input(&hi2c1, channel); + + // invert bd inputs to match the numbers on the case + bd_set_input(&hi2c1, 5-channel); oldchannel = channel; printf("C%d\n", channel); @@ -160,7 +163,7 @@ int main(void) HAL_GPIO_TogglePin(USER_LED_GPIO_Port, USER_LED_Pin); HAL_Delay(100); HAL_GPIO_TogglePin(USER_LED_GPIO_Port, USER_LED_Pin); - uint8_t input = 5; + uint8_t input = 0; // reset set input set_input(input);