Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "pico/sleep.h"
#include "pico/stdlib.h"
#include "pico/runtime_init.h"
#include <stdint.h>
#include <string.h>
#include <stdio.h>
Expand Down Expand Up @@ -49,7 +50,10 @@ void recover_from_sleep(uint scb_orig, uint clock0_orig, uint clock1_orig){
clocks_hw->sleep_en1 = clock1_orig;

//reset clocks
clocks_init();
<<<<<<< Updated upstream
=======
runtime_init_clocks();
>>>>>>> Stashed changes
stdio_init_all();

return;
Expand Down Expand Up @@ -110,6 +114,7 @@ int main() {
while (true) {
gpio_put(LED_PIN, 1);
sleep_ms(2000);
// Current draw on a Pico is ~24.8 mA @ 3.3V

awake = false;
printf("Sleep from xosc\n");
Expand All @@ -120,6 +125,8 @@ int main() {
rtc_set_datetime(&t);
//sleep here, in this case for 1 min
rtc_sleep(46,0);
// During this one minute sleep, the current draw is 4.13 mA @ 3.3V.
// With the LED off, it would be only 1.47 mA!

//will return here and awake should be true
while (!awake) {
Expand All @@ -143,5 +150,6 @@ int main() {
printf("Sleep from sleep_ms\n");
uart_default_tx_wait_blocking();
sleep_ms(2000);
// During this 2 second not-so-deep sleep w/ the the LED off, the current consumption is 22.4 mA @ 3.3V
}
}