Add VDE
This commit is contained in:
parent
f5027348d7
commit
0f5cfe56a9
|
@ -7,7 +7,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NUM_BUTTONS 6
|
#define NUM_BUTTONS 7
|
||||||
#define NUM_ENCS 2
|
#define NUM_ENCS 2
|
||||||
#define BUTTON_MIN_INTERVAL 50 // ms
|
#define BUTTON_MIN_INTERVAL 50 // ms
|
||||||
#define ENC_MAX_PHASE 50 // ms
|
#define ENC_MAX_PHASE 50 // ms
|
||||||
|
|
|
@ -10,12 +10,14 @@
|
||||||
#include "tx_api.h"
|
#include "tx_api.h"
|
||||||
#include "vehicle.h"
|
#include "vehicle.h"
|
||||||
|
|
||||||
|
#include "leds.h"
|
||||||
|
|
||||||
void ui_thread_entry(ULONG _) {
|
void ui_thread_entry(ULONG _) {
|
||||||
GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
|
GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
|
||||||
BTN3_GPIO_Port, BTN4_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,
|
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};
|
GPIO_PinState button_states[NUM_BUTTONS] = {GPIO_PIN_RESET};
|
||||||
uint32_t button_press_times[NUM_BUTTONS] = {HAL_GetTick()};
|
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);
|
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);
|
vehicle_broadcast_buttons(button_states);
|
||||||
|
|
||||||
// Release so other threads can get scheduled
|
// Release so other threads can get scheduled
|
||||||
|
|
Loading…
Reference in New Issue