summaryrefslogtreecommitdiff
path: root/project/Core/Src/Project/player_actions.c
blob: 4ee2dfbc5614afbd01a3553376932facd18d2722 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * player_actions.c
 *
 *  Created on: Oct 17, 2025
 *      Author: sowgro
 */

#include <stdio.h>
#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();
}