add mock buttons
This commit is contained in:
parent
9ef44b8ebb
commit
6d92da3a10
|
@ -12,7 +12,10 @@
|
|||
|
||||
// TODO Remove for STW v2
|
||||
#define MOCK_NUM_BUTTONS 5
|
||||
#define MOCK_BUTTON_TICK_CHANGE 1000
|
||||
uint32_t last_tick = 0;
|
||||
uint8_t mock_button_counter = 0;
|
||||
// END TODO
|
||||
|
||||
void ui_thread_entry(ULONG _) {
|
||||
GPIO_TypeDef *button_ports[NUM_BUTTONS] = {BTN1_GPIO_Port, BTN2_GPIO_Port,
|
||||
|
@ -50,16 +53,23 @@ void ui_thread_entry(ULONG _) {
|
|||
|
||||
// TODO restore this for STW24-v2
|
||||
// vehicle_broadcast_buttons(button_states);
|
||||
// Release so other threads can get scheduled
|
||||
// tx_thread_sleep(1);
|
||||
// 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;
|
||||
mock_button_counter++;
|
||||
mock_button_counter %= MOCK_NUM_BUTTONS;
|
||||
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);
|
||||
tx_thread_sleep(1000);
|
||||
// END TODO
|
||||
|
||||
// Release so other threads can get scheduled
|
||||
tx_thread_sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue