diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-12-12 00:25:31 -0500 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-12-12 00:25:31 -0500 |
| commit | 2fe47fb3bd700acebf07cd777e3a1ecb49fb9f46 (patch) | |
| tree | 53a470470b92acbc417de577f12ebf68dfbcd17a /project/Core/Src/Activties | |
| parent | 29f69b5b7831c846cea1f61a7de4920fafa97ede (diff) | |
| download | 340-repo-Sowgro-2fe47fb3bd700acebf07cd777e3a1ecb49fb9f46.tar.gz 340-repo-Sowgro-2fe47fb3bd700acebf07cd777e3a1ecb49fb9f46.tar.bz2 340-repo-Sowgro-2fe47fb3bd700acebf07cd777e3a1ecb49fb9f46.zip | |
reduce warnings, try to get passive speaker to work
Diffstat (limited to 'project/Core/Src/Activties')
| -rw-r--r-- | project/Core/Src/Activties/activity13.c | 15 | ||||
| -rw-r--r-- | project/Core/Src/Activties/activity4.c | 10 |
2 files changed, 16 insertions, 9 deletions
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 <stdint.h> #include <stdio.h> #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) { |
