summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-09-30 15:51:46 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-09-30 15:51:46 -0400
commite50a487f58941c49cace0783f80a3d4dc6de3c2a (patch)
treeb6c4fc715f8c12a5012c9ace62b5d66feae6299b /project
parentaff39df39db30502e03297d5754857b21e1a8455 (diff)
download340-repo-Sowgro-e50a487f58941c49cace0783f80a3d4dc6de3c2a.tar.gz
340-repo-Sowgro-e50a487f58941c49cace0783f80a3d4dc6de3c2a.tar.bz2
340-repo-Sowgro-e50a487f58941c49cace0783f80a3d4dc6de3c2a.zip
fix activity 6
Diffstat (limited to 'project')
-rw-r--r--project/Core/Src/Activties/activity6.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/project/Core/Src/Activties/activity6.c b/project/Core/Src/Activties/activity6.c
index c32c03e..53f8bb0 100644
--- a/project/Core/Src/Activties/activity6.c
+++ b/project/Core/Src/Activties/activity6.c
@@ -21,15 +21,20 @@ void activity6_run() {
printf("%lu\r\n", s->CVR);
s->RVR = 8000000;
- s->CSR = 1;
+ s->CSR |= 1; // Turn on systick timer
+ s->CSR |= 1<<2; // Use internal clock
+ int time = 0;
int count = 0;
for(;;) {
- if (!s->CVR) {
- printf("%i\r\n", count);
- count++;
- }
+ if (s->CSR & (1<<16)) {
+ count++;
+ if (count == 10) { // Count to 10 tenths then print next second
+ printf ("%d\r\n", time);
+ time++;
+ count = 0;
+ }
+
+ }
}
-
-
}