diff options
Diffstat (limited to 'Smol Watch Project/My Project/examples')
-rw-r--r-- | Smol Watch Project/My Project/examples/driver_examples.c | 27 | ||||
-rw-r--r-- | Smol Watch Project/My Project/examples/driver_examples.h | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Smol Watch Project/My Project/examples/driver_examples.c b/Smol Watch Project/My Project/examples/driver_examples.c index 19327003..122ac73f 100644 --- a/Smol Watch Project/My Project/examples/driver_examples.c +++ b/Smol Watch Project/My Project/examples/driver_examples.c @@ -97,6 +97,33 @@ void delay_example(void) delay_ms(5000); } +static struct timer_task TIMER_0_task1, TIMER_0_task2; + +/** + * Example of using TIMER_0. + */ +static void TIMER_0_task1_cb(const struct timer_task *const timer_task) +{ +} + +static void TIMER_0_task2_cb(const struct timer_task *const timer_task) +{ +} + +void TIMER_0_example(void) +{ + TIMER_0_task1.interval = 100; + TIMER_0_task1.cb = TIMER_0_task1_cb; + TIMER_0_task1.mode = TIMER_TASK_REPEAT; + TIMER_0_task2.interval = 200; + TIMER_0_task2.cb = TIMER_0_task2_cb; + TIMER_0_task2.mode = TIMER_TASK_REPEAT; + + timer_add_task(&TIMER_0, &TIMER_0_task1); + timer_add_task(&TIMER_0, &TIMER_0_task2); + timer_start(&TIMER_0); +} + /** * Example of using PWM_0. */ diff --git a/Smol Watch Project/My Project/examples/driver_examples.h b/Smol Watch Project/My Project/examples/driver_examples.h index 4295ca9f..59627ca9 100644 --- a/Smol Watch Project/My Project/examples/driver_examples.h +++ b/Smol Watch Project/My Project/examples/driver_examples.h @@ -22,6 +22,8 @@ void I2C_0_example(void); void delay_example(void); +void TIMER_0_example(void); + void PWM_0_example(void); void PWM_1_example(void); |