WIP: trying to deep sleep
This commit is contained in:
parent
377dd3c4e6
commit
ce08d17a11
1 changed files with 10 additions and 2 deletions
|
@ -9,8 +9,13 @@
|
||||||
#include "hardware/pio.h"
|
#include "hardware/pio.h"
|
||||||
#include "hardware/rtc.h"
|
#include "hardware/rtc.h"
|
||||||
#include "hardware/structs/scb.h"
|
#include "hardware/structs/scb.h"
|
||||||
|
// #include "hardware/xosc.h"
|
||||||
|
// #nclude "hardware/rosc.h"
|
||||||
|
// #include "hardware/clocks.h"
|
||||||
|
// #include "hardware/pll.h"
|
||||||
|
|
||||||
#include "pico/cyw43_arch.h"
|
#include "pico/cyw43_arch.h"
|
||||||
|
#include "pico/sleep.h"
|
||||||
#include "pico/stdlib.h"
|
#include "pico/stdlib.h"
|
||||||
#include "pico/util/datetime.h"
|
#include "pico/util/datetime.h"
|
||||||
|
|
||||||
|
@ -33,8 +38,6 @@ int main() {
|
||||||
#endif
|
#endif
|
||||||
printf("Firmware version: %s\n", PROJECT_VERSION);
|
printf("Firmware version: %s\n", PROJECT_VERSION);
|
||||||
|
|
||||||
WS2812 led(WS2812_PIN);
|
|
||||||
|
|
||||||
wifi_enable(); // Enable Wifi in order to set time and retrieve data
|
wifi_enable(); // Enable Wifi in order to set time and retrieve data
|
||||||
|
|
||||||
NtpClient::setDateTime();
|
NtpClient::setDateTime();
|
||||||
|
@ -75,6 +78,10 @@ int main() {
|
||||||
uint scb_orig = scb_hw->scr;
|
uint scb_orig = scb_hw->scr;
|
||||||
uint clock0_orig = clocks_hw->sleep_en0;
|
uint clock0_orig = clocks_hw->sleep_en0;
|
||||||
uint clock1_orig = clocks_hw->sleep_en1;
|
uint clock1_orig = clocks_hw->sleep_en1;
|
||||||
|
uart_default_tx_wait_blocking();
|
||||||
|
sleep_run_from_xosc();
|
||||||
|
|
||||||
|
WS2812 led(WS2812_PIN);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
auto timestamp = time_us_64() + 60'000'000ull;
|
auto timestamp = time_us_64() + 60'000'000ull;
|
||||||
|
@ -138,6 +145,7 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
led.blinkReady();
|
led.blinkReady();
|
||||||
|
sleep_ms(800);
|
||||||
|
|
||||||
datetime_t dtUntil = dt;
|
datetime_t dtUntil = dt;
|
||||||
add_one_hour(dtUntil); // next hour
|
add_one_hour(dtUntil); // next hour
|
||||||
|
|
Loading…
Reference in a new issue