Use button module in main loop

This commit is contained in:
Mario Hüttel 2020-04-27 20:18:45 +02:00
parent 3834bd404c
commit 122a16ad4e

View File

@ -42,6 +42,7 @@
#include <stm-periph/uart.h> #include <stm-periph/uart.h>
#include <reflow-controller/shell-uart-config.h> #include <reflow-controller/shell-uart-config.h>
#include <helper-macros/helper-macros.h> #include <helper-macros/helper-macros.h>
#include <reflow-controller/button.h>
#include <fatfs/ff.h> #include <fatfs/ff.h>
static void setup_nvic_priorities() static void setup_nvic_priorities()
@ -130,6 +131,7 @@ static bool mount_sd_card_if_avail(bool mounted)
} }
const char *oven_controller_hello_world = "Hello world :)\n"; const char *oven_controller_hello_world = "Hello world :)\n";
static volatile enum button_state button;
int main() int main()
{ {
@ -152,6 +154,7 @@ int main()
led_setup(); led_setup();
loudspeaker_setup(); loudspeaker_setup();
rotary_encoder_setup(); rotary_encoder_setup();
button_init();
uart_gpio_config(); uart_gpio_config();
setup_sell_uart(&shell_uart); setup_sell_uart(&shell_uart);
@ -183,6 +186,7 @@ int main()
} }
} }
button = button_read_event();
rot = rotary_encoder_get_abs_val(); rot = rotary_encoder_get_abs_val();
uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len); uart_receive_status = uart_receive_data_with_dma(&shell_uart, &uart_input, &uart_input_len);
if (uart_receive_status >= 1) if (uart_receive_status >= 1)