diff options
Diffstat (limited to 'project/Core/Src/Activties/activity13.c')
| -rw-r--r-- | project/Core/Src/Activties/activity13.c | 15 |
1 files changed, 11 insertions, 4 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); } } |
