diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-11-18 15:10:55 -0500 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-11-18 15:10:55 -0500 |
| commit | cff905096851398315b22dca341e89ab657f12d8 (patch) | |
| tree | ed54c08d5abe79b44b63c2178c31d017321b87d8 /project/Core/Src/Activties/activity13.c | |
| parent | b1dbfba428fe51d17f4f99e843a37a2b4eff47b2 (diff) | |
| download | 340-repo-Sowgro-cff905096851398315b22dca341e89ab657f12d8.tar.gz 340-repo-Sowgro-cff905096851398315b22dca341e89ab657f12d8.tar.bz2 340-repo-Sowgro-cff905096851398315b22dca341e89ab657f12d8.zip | |
complete activity 13
Diffstat (limited to '')
| -rw-r--r-- | project/Core/Src/Activties/activity13.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/project/Core/Src/Activties/activity13.c b/project/Core/Src/Activties/activity13.c new file mode 100644 index 0000000..19eb0a4 --- /dev/null +++ b/project/Core/Src/Activties/activity13.c @@ -0,0 +1,26 @@ +/* + * activity13.c + * + * Created on: Nov 18, 2025 + * Author: sowgro + */ +#include <stdint.h> +#include <stdio.h> +#include "systick.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); + int count = systick_get_count(); + if ((count % rollover) < (rollover >> 1)) + printf("1"); + else + printf("0"); +} + +void activity13_run() { + init_systick(); + for(;;) { + play_freq(1); + } +} |
