diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-05-02 15:45:40 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-05-02 15:45:40 -0400 |
commit | 88a38cc2352c2bd0ad2733093796f3d424ebcc9c (patch) | |
tree | ba6d58ae5e46a71094994a5de974672edf5866cb /Smol Watch Project/My Project/main.c | |
parent | 9b381ef6ae36844e32452047b05b01f15893a2dc (diff) | |
download | Sensor-Watch-88a38cc2352c2bd0ad2733093796f3d424ebcc9c.tar.gz Sensor-Watch-88a38cc2352c2bd0ad2733093796f3d424ebcc9c.tar.bz2 Sensor-Watch-88a38cc2352c2bd0ad2733093796f3d424ebcc9c.zip |
remove timer; tick based on RTC PER7 interrupt
Diffstat (limited to 'Smol Watch Project/My Project/main.c')
-rw-r--r-- | Smol Watch Project/My Project/main.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Smol Watch Project/My Project/main.c b/Smol Watch Project/My Project/main.c index 19fddb2f..45bb5dc0 100644 --- a/Smol Watch Project/My Project/main.c +++ b/Smol Watch Project/My Project/main.c @@ -29,9 +29,11 @@ static void light_callback() { static void alarm_callback() { } +int lightOn = 0; + static void tick_callback() { - gpio_set_pin_level(GREEN, true); - gpio_set_pin_level(GREEN, false); + gpio_set_pin_level(GREEN, lightOn == 0); + lightOn = (lightOn + 1) % 10; } int main(void) @@ -55,8 +57,6 @@ int main(void) watch_register_button_callback(&watch, BTN_ALARM, &alarm_callback); watch_register_button_callback(&watch, BTN_LIGHT, &light_callback); - watch_enable_tick(tick_callback); -/* watch_enable_date_time(&watch); struct calendar_date_time date_time; date_time.date.year = 2021; @@ -74,7 +74,8 @@ int main(void) alarm.callback = calendar_callback; update_display(&watch, date_time); calendar_set_alarm(&CALENDAR_0, &alarm, &calendar_callback); -*/ + watch_enable_tick(tick_callback); + while (1) { sleep(2); } |