From ee7b45c7c30860d8dda3613e21ff682fffc28392 Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 17 Oct 2025 22:13:59 -0400 Subject: Organize project --- project/Core/Src/Project/player_actions.c | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 project/Core/Src/Project/player_actions.c (limited to 'project/Core/Src/Project/player_actions.c') diff --git a/project/Core/Src/Project/player_actions.c b/project/Core/Src/Project/player_actions.c new file mode 100644 index 0000000..4ee2dfb --- /dev/null +++ b/project/Core/Src/Project/player_actions.c @@ -0,0 +1,58 @@ +/* + * player_actions.c + * + * Created on: Oct 17, 2025 + * Author: sowgro + */ + +#include +#include "player_actions.h" +#include "song_info.h" +#include "song.h" +#include "LED.h" +#include "systick.h" + +void help() { + printf("\r***REMOTE LED CONTROL MENU***\r\n"); + printf("Available User Commands:\r\n"); + printf("NEXT - Show next song info\r\n"); + printf("PLAY - Play the song (LED on)\r\n"); + printf("PAUSE - Pause the song (LED flash)\r\n"); + printf("STOP - Stop the song (LED off)\r\n"); +} + +void next() { + static int current_song = -1; + current_song++; + if (current_song > 4) + current_song = 0; + + void *song = get_song(current_song).p_song; + song_info_t song_info = get_song_info(song); + + printf("Song #%i\r\n", current_song + 1); + if (song_info.title) + printf("Title: %s\r\n", song_info.title); + if (song_info.copyright) + printf("Copyright: %s\r\n", song_info.copyright); + if (song_info.tempo) + printf("Tempo: %i\r\n", song_info.tempo); +} + +void play() { + LED_On(); +} + +void pause() { + init_systick(); +} + +void pause_loop() { + if (check_systick()) { + LED_Toggle(); + } +} + +void stop() { + LED_Off(); +} -- cgit v1.2.3