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 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'project/Core/Src/Activties/activity13.c') 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); } } -- cgit v1.2.3