BresserWeatherSensorLW
Bresser 868 MHz Weather Sensor Radio Receiver based on ESP32/RP2040 and SX1262/SX1276/LR1121 - sends data to a LoRaWAN Network
Loading...
Searching...
No Matches
pico_sleep.h
1/*
2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#if defined(ARDUINO_ARCH_RP2040)
7
8#ifndef _PICO_SLEEP_H_
9#define _PICO_SLEEP_H_
10
11#include "pico.h"
12#include "hardware/rtc.h"
13#include "hardware/clocks.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
35typedef enum {
36 DORMANT_SOURCE_NONE,
37 DORMANT_SOURCE_XOSC,
38 DORMANT_SOURCE_ROSC
39} dormant_source_t;
40
46void sleep_run_from_dormant_source(dormant_source_t dormant_source);
47
51static inline void sleep_run_from_xosc(void) {
52 sleep_run_from_dormant_source(DORMANT_SOURCE_XOSC);
53}
54
58static inline void sleep_run_from_rosc(void) {
59 sleep_run_from_dormant_source(DORMANT_SOURCE_ROSC);
60}
61
70void sleep_goto_sleep_until(datetime_t *t, rtc_callback_t callback);
71
81void sleep_goto_dormant_until_pin(uint gpio_pin, bool edge, bool high);
82
90static inline void sleep_goto_dormant_until_edge_high(uint gpio_pin) {
91 sleep_goto_dormant_until_pin(gpio_pin, true, true);
92}
93
101static inline void sleep_goto_dormant_until_level_high(uint gpio_pin) {
102 sleep_goto_dormant_until_pin(gpio_pin, false, true);
103}
104
105#ifdef __cplusplus
106}
107#endif
108
109#endif
110#endif /* ARDUINO_ARCH_RP2040 */