diff options
author | ConfuSomu | 2021-04-08 14:26:51 -0400 |
---|---|---|
committer | ConfuSomu | 2021-04-08 14:26:51 -0400 |
commit | 058ba7c550e1007db7f937e53619f669294377f4 (patch) | |
tree | f793594aa1e5208eafccbd8cd563d211e77da74b | |
parent | 4dd7d6d83247d39272d1d82cae9099efe471255f (diff) | |
download | pico-watch-058ba7c550e1007db7f937e53619f669294377f4.tar pico-watch-058ba7c550e1007db7f937e53619f669294377f4.tar.gz pico-watch-058ba7c550e1007db7f937e53619f669294377f4.zip |
WFI in rendering loop when sleeping
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | pico-watch.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bcb8b4c..a921604 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ target_link_libraries(pico-watch pico_stdlib) target_link_libraries(pico-watch Oled hardware_rtc -# hardware_clocks + hardware_sync # For use of __wfi() ) pico_add_extra_outputs(pico-watch) diff --git a/pico-watch.cpp b/pico-watch.cpp index e36c211..e04be23 100644 --- a/pico-watch.cpp +++ b/pico-watch.cpp @@ -1,6 +1,7 @@ #include <stdio.h> #include "pico/stdlib.h" #include "hardware/i2c.h" +#include "hardware/sync.h" #include "hardware/rtc.h" #include "pico/util/datetime.h" @@ -125,7 +126,8 @@ int main() { app_api.display_write_backbuffer(); app_rendering = false; } - sleep_ms(app_api.performance_render_interval_get()); + if (is_sleeping) __wfi(); + else sleep_ms(app_api.performance_render_interval_get()); } return 0; } |