summaryrefslogtreecommitdiff
path: root/project/Core/Src/Activties/activity4.c
blob: 44653e178a16d277c7ad75ea76b7b701e5c79d6a (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
/*
 * 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 activity4_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);
}