diff options
| author | sowgro <tpoke.ferrari@gmail.com> | 2025-10-09 21:43:08 -0400 |
|---|---|---|
| committer | sowgro <tpoke.ferrari@gmail.com> | 2025-10-09 21:43:08 -0400 |
| commit | 0e0f83905bb3ee79f4917927479cdaf710e8ac07 (patch) | |
| tree | d7c1184e0d6732e671f2c72fc2fc7a10231b8fda /project/Core/Src/System/systick.c | |
| parent | 003bf896a726b2e3496c7b429f648b8db9c36a3b (diff) | |
| download | 340-repo-Sowgro-0e0f83905bb3ee79f4917927479cdaf710e8ac07.tar.gz 340-repo-Sowgro-0e0f83905bb3ee79f4917927479cdaf710e8ac07.tar.bz2 340-repo-Sowgro-0e0f83905bb3ee79f4917927479cdaf710e8ac07.zip | |
Complete input and led part of project
Diffstat (limited to 'project/Core/Src/System/systick.c')
| -rw-r--r-- | project/Core/Src/System/systick.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/project/Core/Src/System/systick.c b/project/Core/Src/System/systick.c index 58ee2b1..a9e38c7 100644 --- a/project/Core/Src/System/systick.c +++ b/project/Core/Src/System/systick.c @@ -16,9 +16,9 @@ void init_systick() // Set the enable bit in the CTRL (CSR) to start the timer. systick_t *s = get_systick(); - s->CSR = 0; - s->RVR = 8000000; + s->CSR &= ~1; s->CSR |= 1<<2; + s->RVR = 8000000; // 100 ms s->CSR |= 1; } @@ -37,3 +37,19 @@ void delay_systick() ; } } + +int check_systick() { + static int i = 0; + + systick_t *s = get_systick(); + if (!(~s->CSR & (1<<16))) { + i++; + } + + if (i >= 10) { + i = 0; + return 1; + } else { + return 0; + } +} |
