aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-24 17:06:55 -0700
committerChristian Cunningham <cc@localhost>2022-03-24 17:06:55 -0700
commitc5f8eb6c35f6b3ca14c2a0e916fa835ed85cdfd6 (patch)
tree45fb49c0e82fbc48edd83b11a86b56206c6350c6
parentd7b3c5bdc5d59b908e1835839c124d6463a5f1e0 (diff)
Unsubscribe example
-rw-r--r--usr/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr/main.c b/usr/main.c
index 5a49f49..1743c33 100644
--- a/usr/main.c
+++ b/usr/main.c
@@ -66,7 +66,13 @@ void loop(void)
void loopt(void)
{
static char str[13];
+ static char cnt = 18;
draw_string(0, 14, ulong_to_string(*(volatile unsigned long*)SYS_TIMER_CHI, str));
+ cnt--;
+ if (cnt == 2)
+ unsubscribe_irq(SYS_TIMER_1_IRQ);
+ if (cnt == 0)
+ unsubscribe_irq(SYS_TIMER_0_IRQ);
}
static unsigned long TICK_RATE_0 = 5000000;