From 2fe47fb3bd700acebf07cd777e3a1ecb49fb9f46 Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 12 Dec 2025 00:25:31 -0500 Subject: reduce warnings, try to get passive speaker to work --- project/Core/Src/Activties/activity13.c | 15 +++++++++++---- project/Core/Src/Activties/activity4.c | 10 +++++----- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'project/Core/Src/Activties') diff --git a/project/Core/Src/Activties/activity13.c b/project/Core/Src/Activties/activity13.c index 19eb0a4..16c2c1b 100644 --- a/project/Core/Src/Activties/activity13.c +++ b/project/Core/Src/Activties/activity13.c @@ -7,20 +7,27 @@ #include #include #include "systick.h" +#include "tone.h" +#include "dac.h" //write 1s for half the freq and 0s for the other half void play_freq(uint8_t hz) { - uint32_t rollover =herz_to_systicks(hz); + uint32_t rollover = hertz_to_systicks(hz); int count = systick_get_count(); - if ((count % rollover) < (rollover >> 1)) + if ((count % rollover) < (rollover >> 1)) { + DAC_Set_Value(3000); printf("1"); - else + } + else { + DAC_Set_Value(0); printf("0"); + } } void activity13_run() { init_systick(); + DAC_Init(); for(;;) { - play_freq(1); + play_freq(3000); } } diff --git a/project/Core/Src/Activties/activity4.c b/project/Core/Src/Activties/activity4.c index 898cd2d..c2a0d63 100644 --- a/project/Core/Src/Activties/activity4.c +++ b/project/Core/Src/Activties/activity4.c @@ -12,13 +12,13 @@ #include "activity4.h" void activity4_run() { - header_t* p_header = get_header(get_song(0).p_song); + header_t p_header = get_header(get_song(0).p_song); 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); + 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); } header_t get_header(uint8_t *p_song) { -- cgit v1.2.3