Add VDE
This commit is contained in:
		@ -10,12 +10,14 @@
 | 
			
		||||
#include "tx_api.h"
 | 
			
		||||
#include "vehicle.h"
 | 
			
		||||
 | 
			
		||||
#include "leds.h"
 | 
			
		||||
 | 
			
		||||
void ui_thread_entry(ULONG _) {
 | 
			
		||||
  GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
 | 
			
		||||
                                             BTN3_GPIO_Port, BTN4_GPIO_Port,
 | 
			
		||||
                                             BTN5_GPIO_Port, BTN6_GPIO_Port};
 | 
			
		||||
                                             BTN5_GPIO_Port, BTN6_GPIO_Port, SW_DRS_GPIO_Port};
 | 
			
		||||
  uint16_t button_pins[NUM_BUTTONS] = {BTN1_Pin, BTN2_Pin, BTN3_Pin,
 | 
			
		||||
                                       BTN4_Pin, BTN5_Pin, BTN6_Pin};
 | 
			
		||||
                                       BTN4_Pin, BTN5_Pin, BTN6_Pin, SW_DRS_Pin};
 | 
			
		||||
  GPIO_PinState button_states[NUM_BUTTONS] = {GPIO_PIN_RESET};
 | 
			
		||||
  uint32_t button_press_times[NUM_BUTTONS] = {HAL_GetTick()};
 | 
			
		||||
 | 
			
		||||
@ -44,6 +46,14 @@ void ui_thread_entry(ULONG _) {
 | 
			
		||||
      tx_event_flags_set(&gui_update_events, GUI_UPDATE_NEXT_SCREEN, TX_OR);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (button_states[6] == GPIO_PIN_SET) {
 | 
			
		||||
      // Set leftmost led to blue to indicate DRS activation
 | 
			
		||||
      led_set(0, 0, 0, 255);
 | 
			
		||||
    } else {
 | 
			
		||||
      // Turn it off if not active
 | 
			
		||||
      led_set(0, 0, 0, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    vehicle_broadcast_buttons(button_states);
 | 
			
		||||
 | 
			
		||||
    // Release so other threads can get scheduled
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user