diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-12-13 22:13:27 -0500 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-12-13 22:13:27 -0500 |
| commit | 519f868c445a86b988772307ea1f1e2fc95fe54a (patch) | |
| tree | 3a73eb27a5473fc68e0cc8900fb29f05e13771f1 /project/Core/Src/Activties | |
| parent | 2fe47fb3bd700acebf07cd777e3a1ecb49fb9f46 (diff) | |
| download | 340-repo-Sowgro-519f868c445a86b988772307ea1f1e2fc95fe54a.tar.gz 340-repo-Sowgro-519f868c445a86b988772307ea1f1e2fc95fe54a.tar.bz2 340-repo-Sowgro-519f868c445a86b988772307ea1f1e2fc95fe54a.zip | |
all player code written but untested
Diffstat (limited to 'project/Core/Src/Activties')
| -rw-r--r-- | project/Core/Src/Activties/activity13.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/project/Core/Src/Activties/activity13.c b/project/Core/Src/Activties/activity13.c index 16c2c1b..a4dad21 100644 --- a/project/Core/Src/Activties/activity13.c +++ b/project/Core/Src/Activties/activity13.c @@ -11,23 +11,24 @@ #include "dac.h" //write 1s for half the freq and 0s for the other half -void play_freq(uint8_t hz) { - uint32_t rollover = hertz_to_systicks(hz); - int count = systick_get_count(); - if ((count % rollover) < (rollover >> 1)) { - DAC_Set_Value(3000); - printf("1"); - } - else { - DAC_Set_Value(0); - printf("0"); - } +void play_freq(uint16_t hz) { + uint32_t rollover = hertz_to_systicks (hz); + if ((systick_get_count () % rollover) < (rollover >> 1)) { + DAC_Set_Value(500); +// printf ("1"); + } + else { + DAC_Set_Value(0); +// printf ("0"); + } } void activity13_run() { init_systick(); DAC_Init(); + DAC_Start(); for(;;) { - play_freq(3000); + play_freq(500); } +// DAC_Set_Value(3000); } |
