diff options
Diffstat (limited to 'project/Core/Src/Project/remote_control.c')
| -rw-r--r-- | project/Core/Src/Project/remote_control.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/project/Core/Src/Project/remote_control.c b/project/Core/Src/Project/remote_control.c index 905f966..dd48cb7 100644 --- a/project/Core/Src/Project/remote_control.c +++ b/project/Core/Src/Project/remote_control.c @@ -5,9 +5,15 @@ * Author: sowgro */ +#include <stm32l4xx.h> +#include <stdio.h> +#include <string.h> +#include "player_actions.h" +#include "UART.h" +#include "project.h" + static char buffer[80]; static char* cur = buffer; -static uint8_t state = STOPPED_STATE; void remote_control_start() { NVIC_EnableIRQ (USART2_IRQn); @@ -24,7 +30,8 @@ void remote_control_stop() { } -static void parse_input(char buffer[], uint8_t *state) { +static void parse_input(char buffer[]) { + uint8_t *state = project_get_state(); if (!strcmp(buffer, "HELP")) { help(); } @@ -48,23 +55,24 @@ static void parse_input(char buffer[], uint8_t *state) { } } +#include "systick.h" void USART2_IRQHandler() { int ch = USART_Read(USART2); - remote_control_parse_input(ch); + putchar(ch); if (!ch) - continue; + return; if (ch == '\r') { *cur = 0; - handle_input(buffer, &state); + parse_input(buffer); cur = buffer; - continue; + return; } if (ch == 0x08 || ch == 0x7F) { if (cur <= buffer) - continue; + return; cur--; printf("\b \b"); - continue; + return; } *cur++ = ch; } |
