summaryrefslogtreecommitdiff
path: root/project/Core/Src/Project/player_actions.c
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-11-06 22:09:21 -0500
committersowgro <tpoke.ferrari@gmail.com>2025-11-06 22:09:21 -0500
commitff93296322bcff19d9983c3d800bffbd08a35941 (patch)
tree6eac8d5080bafbe101b5103ee95f3a8445b21bd7 /project/Core/Src/Project/player_actions.c
parent843e263ac896fae11b8c176810bab4866eb8b2a8 (diff)
download340-repo-Sowgro-ff93296322bcff19d9983c3d800bffbd08a35941.tar.gz
340-repo-Sowgro-ff93296322bcff19d9983c3d800bffbd08a35941.tar.bz2
340-repo-Sowgro-ff93296322bcff19d9983c3d800bffbd08a35941.zip
add comments, fix remote control, work on local control
Diffstat (limited to 'project/Core/Src/Project/player_actions.c')
-rw-r--r--project/Core/Src/Project/player_actions.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/project/Core/Src/Project/player_actions.c b/project/Core/Src/Project/player_actions.c
index 4fc29a1..8318e08 100644
--- a/project/Core/Src/Project/player_actions.c
+++ b/project/Core/Src/Project/player_actions.c
@@ -1,5 +1,6 @@
/*
* player_actions.c
+ * Code related to the player states and actions
*
* Created on: Oct 17, 2025
* Author: sowgro
@@ -15,14 +16,23 @@
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");
@@ -32,6 +42,9 @@ void player_help() {
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++;
@@ -50,21 +63,33 @@ void player_next() {
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;
init_systick();
}
+/**
+ * Switches to the stop state
+ */
void player_stop() {
state = STOPPED_STATE;
LED_Off();
}
+/**
+ * Toggles the LED every second if in pause mode
+ */
void SysTick_Handler2(int count) {
if (state != PAUSED_STATE)
return;