summaryrefslogtreecommitdiff
path: root/project/Core/Src/Project/player_actions.c
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-12-14 00:21:02 -0500
committersowgro <tpoke.ferrari@gmail.com>2025-12-14 00:21:02 -0500
commite68a05b29de507a56b8747557707e8d6cdd68542 (patch)
tree1f7c457159af75ae198258a2301a55531d7baff5 /project/Core/Src/Project/player_actions.c
parent519f868c445a86b988772307ea1f1e2fc95fe54a (diff)
download340-repo-Sowgro-e68a05b29de507a56b8747557707e8d6cdd68542.tar.gz
340-repo-Sowgro-e68a05b29de507a56b8747557707e8d6cdd68542.tar.bz2
340-repo-Sowgro-e68a05b29de507a56b8747557707e8d6cdd68542.zip
Refactor
Diffstat (limited to 'project/Core/Src/Project/player_actions.c')
-rw-r--r--project/Core/Src/Project/player_actions.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/project/Core/Src/Project/player_actions.c b/project/Core/Src/Project/player_actions.c
deleted file mode 100644
index b486dd8..0000000
--- a/project/Core/Src/Project/player_actions.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * player_actions.c
- * Code related to the player states and actions
- *
- * Created on: Oct 17, 2025
- * Author: sowgro
- */
-
-#include <stdio.h>
-#include <stm32l4xx.h>
-#include "player_actions.h"
-#include "song_info.h"
-#include "song.h"
-#include "LED.h"
-#include "player.h"
-
-static uint8_t state = STOPPED_STATE;
-
-/**
- * Returns the current player state to other files
- */
-uint8_t player_get_state() {
- return state;
-}
-
-/**
- * Sets the current player state from other files
- */
-void player_set_state(uint8_t newState) {
- state = newState;
-}
-
-/**
- * Prints the help message
- */
-void player_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");
-}
-
-/**
- * Advances the player to the next song.
- */
-void player_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, &song_info);
-
- parse_song(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);
-}
-
-/**
- * Switches to the play state
- */
-void player_play() {
- state = PLAYING_STATE;
- LED_On();
-}
-
-/**
- * Switches to the pause state
- */
-void player_pause() {
- state = PAUSED_STATE;
-}
-
-/**
- * Switches to the stop state
- */
-void player_stop() {
- state = STOPPED_STATE;
- LED_Off();
-}
-
-/**
- * Toggles the LED every second if in pause mode
- */
-void player_action_tick(int count) {
- switch (state) {
- case PAUSED_STATE:
- if(!(count & 1023)) {
- LED_Toggle();
- }; break;
- case PLAYING_STATE:
- play_notes(count);
- }
-}