summaryrefslogtreecommitdiff
path: root/project/Core/Src/Activties/activity13.c
diff options
context:
space:
mode:
Diffstat (limited to 'project/Core/Src/Activties/activity13.c')
-rw-r--r--project/Core/Src/Activties/activity13.c26
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);
+ }
+}