summaryrefslogtreecommitdiff
path: root/project/Core/Src/Activties/midi_header.c
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-09-22 23:40:06 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-09-22 23:40:06 -0400
commit73a76acef4aa14b042c9c56eef0fd19164afff42 (patch)
treef9e173aed8bfe646a54555441dae5bbbf3c1090e /project/Core/Src/Activties/midi_header.c
parent158dd4d597ebd2ccfd97c43aac699899144fa31f (diff)
download340-repo-Sowgro-73a76acef4aa14b042c9c56eef0fd19164afff42.tar.gz
340-repo-Sowgro-73a76acef4aa14b042c9c56eef0fd19164afff42.tar.bz2
340-repo-Sowgro-73a76acef4aa14b042c9c56eef0fd19164afff42.zip
Submit endian converters
Diffstat (limited to 'project/Core/Src/Activties/midi_header.c')
-rw-r--r--project/Core/Src/Activties/midi_header.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/project/Core/Src/Activties/midi_header.c b/project/Core/Src/Activties/midi_header.c
new file mode 100644
index 0000000..de3dc68
--- /dev/null
+++ b/project/Core/Src/Activties/midi_header.c
@@ -0,0 +1,37 @@
+/*
+ * activity4.c
+ *
+ * Created on: Sep 16, 2025
+ * Author: sowgro
+ */
+
+#include "song.h"
+#include <printf.h>
+#include <endian_converters.h>
+#include <stdint.h>
+
+typedef struct {
+ char chunk_type[4];
+ uint32_t length;
+ uint16_t format;
+ uint16_t ntrcks;
+ uint16_t division;
+} header;
+
+void run() {
+ header* p_header;
+
+ p_header = (header *) (get_song(0).p_song);
+
+ p_header->length = convert_to_uint32((uint8_t*) &p_header->length);
+ p_header->format = convert_to_uint16((uint8_t*) &p_header->format);
+ p_header->ntrcks = convert_to_uint16((uint8_t*) &p_header->ntrcks);
+ p_header->division = convert_to_uint16((uint8_t*) &p_header->division);
+
+ printf ("Header: \r\n");
+ printf ("\tLength: %lu\r\n", p_header->length);
+ printf ("\tFormat: %u\r\n", p_header->format);
+ printf ("\tNum Tracks: %u\r\n", p_header->ntrcks);
+ printf ("\tDivision: %u\r\n", p_header->division);
+}
+