summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/Core/Src/Activties/activity13.c26
-rw-r--r--project/Core/Src/System/systick.c4
-rw-r--r--project/Core/Src/main.c3
3 files changed, 30 insertions, 3 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);
+ }
+}
diff --git a/project/Core/Src/System/systick.c b/project/Core/Src/System/systick.c
index f9e2470..5d4d259 100644
--- a/project/Core/Src/System/systick.c
+++ b/project/Core/Src/System/systick.c
@@ -20,7 +20,7 @@ void init_systick()
s->CSR &= ~1;
s->CSR |= 1<<2;
s->CSR |= 1<<1; // enable interrupt
- s->RVR = 78124; // 100 ms
+ s->RVR = 79;
s->CSR |= 1;
}
@@ -60,7 +60,7 @@ int check_systick() {
static uint32_t count = 0;
void SysTick_Handler() {
- player_action_tick(count++);
+ count++;
}
uint32_t systick_get_count() {
diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c
index eaf1c63..60d5b3d 100644
--- a/project/Core/Src/main.c
+++ b/project/Core/Src/main.c
@@ -29,6 +29,7 @@ int main(void){
// project_run();
// activity10_run();
// hw6_run();
- activity12_run();
+// activity12_run();
+ activity13_run();
}