Handle buttons & encoders in View, not Model
This commit is contained in:
@ -25,8 +25,8 @@ void ui_thread_entry(ULONG _) {
|
||||
uint32_t now = HAL_GetTick();
|
||||
if (state == GPIO_PIN_RESET && now - button_change_times[i]) {
|
||||
// Button release event!
|
||||
UIMessage msg = {.kind = UMK_BTN_RELEASED, .number = i};
|
||||
tx_queue_send(&ui_queue, &msg, TX_NO_WAIT);
|
||||
ButtonMessage msg = {.kind = UMK_BTN_RELEASED, .number = i};
|
||||
tx_queue_send(&gui_button_queue, &msg, TX_NO_WAIT);
|
||||
}
|
||||
button_change_times[i] = now;
|
||||
button_states[i] = state;
|
||||
@ -52,7 +52,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||
|
||||
uint16_t pin_a, pin_b;
|
||||
int idx_a, idx_b;
|
||||
UIMessage msg;
|
||||
ButtonMessage msg;
|
||||
if (GPIO_Pin == ENC1A_Pin || GPIO_Pin == ENC1B_Pin) {
|
||||
pin_a = ENC1A_Pin;
|
||||
pin_b = ENC1B_Pin;
|
||||
@ -92,6 +92,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||
// This shouldn't happen. Ignore this event.
|
||||
return;
|
||||
}
|
||||
tx_queue_send(&ui_queue, &msg, TX_NO_WAIT);
|
||||
tx_queue_send(&gui_button_queue, &msg, TX_NO_WAIT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user