Code cleanup

This commit is contained in:
Christoffer Martinsson 2025-03-08 20:20:52 +01:00
parent bffb927088
commit 9fb53dd88d

View File

@ -272,6 +272,9 @@ fn main() -> ! {
clocks.peripheral_clock.freq(),
);
// Set red color to statusled indicating error if not reaching assumed state (USB connect)
status_led.update(StatusMode::Error);
let mut delay = Delay::new(core.SYST, clocks.system_clock.freq().to_Hz());
// Scan matrix to get initial state and check if bootloader should be entered
@ -315,13 +318,13 @@ fn main() -> ! {
pub const TH_BUTTON: u8 = 5;
pub const TH_BUTTON_TRIGGER: u8 = 0;
// Set up usb button layout
buttons[0].usb_button = 0; // Fn
// Set up usb button layout (button 0 to 15, 20, 25 and 26)
buttons[0].usb_button = 0; // Fn. Setting to 0 to disable USB button generation
buttons[1].usb_button = 2;
buttons[1].usb_button_sec_enable = true;
buttons[1].usb_button_sec = 21;
buttons[1].usb_button_sec_trigger_index = 0;
buttons[2].usb_button = 3;
buttons[2].usb_button = 3; // Button used as global config. Do not define secondary USB button!
buttons[3].usb_button = 4;
buttons[3].usb_button_sec_enable = true;
buttons[3].usb_button_sec = 22;
@ -331,11 +334,9 @@ fn main() -> ! {
buttons[4].usb_button_sec = 32;
buttons[4].usb_button_sec_trigger_index = 0;
buttons[5].usb_button = 1;
buttons[5].usb_button_sec_enable = true;
// Dummy definition to inhibit button press on throttle hold
buttons[5].usb_button_sec = 0;
buttons[5].usb_button_sec_trigger_index = 0;
// Dummy end -----------------------------------------------
buttons[5].usb_button_sec_enable = true; // Set TH_BUTTON to inhibit button press on throttle hold
buttons[5].usb_button_sec = 0; // Setting to 0 to disable USB buttton generation
buttons[5].usb_button_sec_trigger_index = 0; // Set same as TH_BUTTON_TRIGGER
buttons[6].usb_button = 6;
buttons[6].usb_button_sec_enable = true;
buttons[6].usb_button_sec = 7;