diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-12-14 00:21:02 -0500 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-12-14 00:21:02 -0500 |
| commit | e68a05b29de507a56b8747557707e8d6cdd68542 (patch) | |
| tree | 1f7c457159af75ae198258a2301a55531d7baff5 /project/Core/Inc | |
| parent | 519f868c445a86b988772307ea1f1e2fc95fe54a (diff) | |
| download | 340-repo-Sowgro-e68a05b29de507a56b8747557707e8d6cdd68542.tar.gz 340-repo-Sowgro-e68a05b29de507a56b8747557707e8d6cdd68542.tar.bz2 340-repo-Sowgro-e68a05b29de507a56b8747557707e8d6cdd68542.zip | |
Refactor
Diffstat (limited to 'project/Core/Inc')
| -rw-r--r-- | project/Core/Inc/Project/parser.h | 46 | ||||
| -rw-r--r-- | project/Core/Inc/Project/player.h | 30 | ||||
| -rw-r--r-- | project/Core/Inc/Project/player_actions.h | 26 | ||||
| -rw-r--r-- | project/Core/Inc/Project/song_info.h | 19 |
4 files changed, 60 insertions, 61 deletions
diff --git a/project/Core/Inc/Project/parser.h b/project/Core/Inc/Project/parser.h new file mode 100644 index 0000000..356a4ad --- /dev/null +++ b/project/Core/Inc/Project/parser.h @@ -0,0 +1,46 @@ +/* + * player.h + * + * Created on: Dec 10, 2025 + * Author: sowgro + */ + +#ifndef INC_PROJECT_PARSER_H_ +#define INC_PROJECT_PARSER_H_ + +#include <stdint.h> + +#define NOTE_OFF_EVENT (0) +#define NOTE_ON_EVENT (1) +#define KEY_PRESSURE (2) + +typedef struct { + uint8_t ev_type; + uint32_t abs_time; + uint8_t key_number; + uint8_t value; +} note_event_t; + +typedef struct { + note_event_t events[1024]; + int nEvents; + int curEventIndex; +} track_t; + +typedef struct { + char *title; + char *copyright; + int tempo; +} song_info_t; + +void parser_play_notes(); + +void parse_song(uint8_t *p_song); + +uint8_t *parse_track(uint8_t *p_song, track_t *track); + +uint8_t *parse_song_info(uint8_t *p_song, song_info_t *ret); + +song_info_t parser_get_song_info(); + +#endif /* INC_PROJECT_PARSER_H_ */ diff --git a/project/Core/Inc/Project/player.h b/project/Core/Inc/Project/player.h index 1b1d308..5e3f454 100644 --- a/project/Core/Inc/Project/player.h +++ b/project/Core/Inc/Project/player.h @@ -1,30 +1,28 @@ /* - * player.h + * player_actions.h * - * Created on: Dec 10, 2025 + * Created on: Oct 17, 2025 * Author: sowgro */ #ifndef INC_PROJECT_PLAYER_H_ #define INC_PROJECT_PLAYER_H_ -typedef struct { - uint8_t ev_type; - uint32_t abs_time; - uint8_t key_number; - uint8_t value; -} note_event_t; +#include <stdint.h> -typedef struct { - note_event_t events[1024]; - int nEvents; - int curEventIndex; -} track_t; +#define PLAYING_STATE (1) +#define PAUSED_STATE (2) +#define STOPPED_STATE (3) -void play_notes(int count); +uint8_t player_get_state(); +void player_set_state(uint8_t newState); -void parse_song(uint8_t *p_song); +void player_help(); +void player_next(); +void player_play(); +void player_pause(); +void player_stop(); -uint8_t *parse_track(uint8_t *p_song, track_t *track); +void player_tick(); #endif /* INC_PROJECT_PLAYER_H_ */ diff --git a/project/Core/Inc/Project/player_actions.h b/project/Core/Inc/Project/player_actions.h deleted file mode 100644 index 8f8fa1d..0000000 --- a/project/Core/Inc/Project/player_actions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * player_actions.h - * - * Created on: Oct 17, 2025 - * Author: sowgro - */ - -#ifndef INC_PROJECT_PLAYER_ACTIONS_H_ -#define INC_PROJECT_PLAYER_ACTIONS_H_ - -#define PLAYING_STATE (1) -#define PAUSED_STATE (2) -#define STOPPED_STATE (3) - -uint8_t player_get_state(); -void player_set_state(uint8_t newState); - -void player_help(); -void player_next(); -void player_play(); -void player_pause(); -void player_stop(); - -void player_action_tick(int count); - -#endif /* INC_PROJECT_PLAYER_ACTIONS_H_ */ diff --git a/project/Core/Inc/Project/song_info.h b/project/Core/Inc/Project/song_info.h deleted file mode 100644 index 9d6d5e6..0000000 --- a/project/Core/Inc/Project/song_info.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * song_info.h - * - * Created on: Oct 15, 2025 - * Author: sowgro - */ - -#ifndef INC_PROJECT_SONG_INFO_H_ -#define INC_PROJECT_SONG_INFO_H_ - -typedef struct { - char *title; - char *copyright; - int tempo; -} song_info_t; - -uint8_t *get_song_info(uint8_t *p_song, song_info_t *ret); - -#endif /* INC_PROJECT_SONG_INFO_H_ */ |
