From d5dac33672ae1e940b3fda4ee4f4e940229d996f Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 4 Nov 2025 23:34:37 -0500 Subject: get most interrupt handlers working for project pt2 --- project/Core/Src/Project/remote_control.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'project/Core/Src/Project/remote_control.c') 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 +#include +#include +#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; } -- cgit v1.2.3