diff options
Diffstat (limited to 'project/Core/Src/Project/remote_control.c')
| -rw-r--r-- | project/Core/Src/Project/remote_control.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/project/Core/Src/Project/remote_control.c b/project/Core/Src/Project/remote_control.c index 2153a4a..c8c1f73 100644 --- a/project/Core/Src/Project/remote_control.c +++ b/project/Core/Src/Project/remote_control.c @@ -11,6 +11,8 @@ #include "player_actions.h" #include "UART.h" #include "project.h" +#include "systick.h" +#include "player_actions.h" static char buffer[80]; static char* cur = buffer; @@ -19,7 +21,7 @@ void remote_control_init() { NVIC_EnableIRQ (USART2_IRQn); USART2->CR1 |= USART_CR1_RXNEIE; // 1 << 5 - help(); + player_help(); } void remote_control_loop() { @@ -27,36 +29,33 @@ void remote_control_loop() { } static void parse_input(char buffer[]) { - uint8_t *state = project_get_state(); if (!strcmp(buffer, "HELP")) { - help(); + player_help(); } else if (!strcmp(buffer, "NEXT")) { - next(); + player_next(); } else if (!strcmp(buffer, "PLAY")) { - play(); - *state = PLAYING_STATE; + player_play(); } else if (!strcmp(buffer, "PAUSE")) { - pause(); - *state = PAUSED_STATE; + player_pause(); } else if (!strcmp(buffer, "STOP")) { - stop(); - *state = STOPPED_STATE; + player_stop(); } else { printf("Unknown command \"%s\"\n\r", buffer); } } -#include "systick.h" void USART2_IRQHandler() { int ch = USART_Read(USART2); - if (project_get_mode() != REMOTE_MODE) + if (project_get_mode() != REMOTE_MODE) { + cur = buffer; return; + } putchar(ch); if (!ch) |
