Compare commits

..

No commits in common. "6d92da3a1012fd29dc6aa16d06baf0b2da1b4c6f" and "3f67d1571b970cc92105376972664b754785dfe4" have entirely different histories.

2 changed files with 8 additions and 32 deletions

View File

@ -1,21 +1,14 @@
#include "ui.h" #include "ui.h"
#include <stdint.h>
#include "hx8357d.h"
#include "main.h"
#include "stm32h7a3xx.h" #include "stm32h7a3xx.h"
#include "stm32h7xx_hal.h" #include "stm32h7xx_hal.h"
#include "stm32h7xx_hal_gpio.h" #include "stm32h7xx_hal_gpio.h"
#include "tx_api.h" #include "tx_api.h"
#include "vehicle.h"
// TODO Remove for STW v2 #include "hx8357d.h"
#define MOCK_NUM_BUTTONS 5 #include "main.h"
#define MOCK_BUTTON_TICK_CHANGE 1000 #include "vehicle.h"
uint32_t last_tick = 0; #include <stdint.h>
uint8_t mock_button_counter = 0;
// END TODO
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,
@ -50,24 +43,7 @@ void ui_thread_entry(ULONG _) {
if (press_event == 1 && button_states[1]) { if (press_event == 1 && button_states[1]) {
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);
} }
vehicle_broadcast_buttons(button_states);
// TODO restore this for STW24-v2
// vehicle_broadcast_buttons(button_states);
// END TODO
// TODO (STW24) Remove for STW24-v2 !!
GPIO_PinState mock_button_states[MOCK_NUM_BUTTONS] = {mock_button_states};
mock_button_states[mock_button_counter] = GPIO_PIN_SET;
uint32_t now = HAL_GetTick();
// Wait 1s before moving to the next button
if (abs(now - last_tick) >= MOCK_BUTTON_TICK_CHANGE) {
mock_button_counter++;
mock_button_counter %= MOCK_NUM_BUTTONS;
}
vehicle_broadcast_buttons(mock_button_states);
// END TODO
// Release so other threads can get scheduled // Release so other threads can get scheduled
tx_thread_sleep(1); tx_thread_sleep(1);
} }