2019-10-20 20:05:13 +02:00
|
|
|
#ifndef _RESET_H
|
|
|
|
#define _RESET_H
|
|
|
|
|
|
|
|
#include <driver/rtc_io.h>
|
2022-08-19 18:18:47 +02:00
|
|
|
#include <soc/reset_reasons.h>
|
2020-03-29 18:08:52 +02:00
|
|
|
|
2019-10-20 20:05:13 +02:00
|
|
|
#include "i2c.h"
|
2020-03-29 18:08:52 +02:00
|
|
|
#include "lorawan.h"
|
|
|
|
#include "display.h"
|
|
|
|
#include "power.h"
|
2022-01-29 13:47:59 +01:00
|
|
|
#include "sdcard.h"
|
2022-01-29 13:49:12 +01:00
|
|
|
#include "sds011read.h"
|
2019-10-20 20:05:13 +02:00
|
|
|
|
2021-03-21 20:20:39 +01:00
|
|
|
void reset_rtc_vars(void);
|
2019-10-20 20:05:13 +02:00
|
|
|
void do_reset(bool warmstart);
|
2020-12-09 20:37:03 +01:00
|
|
|
void do_after_reset(void);
|
2023-03-08 15:53:30 +01:00
|
|
|
void enter_deepsleep(uint32_t wakeup_sec, const gpio_num_t wakeup_gpio);
|
2023-03-12 00:31:55 +01:00
|
|
|
uint64_t uptime(void);
|
2020-12-19 12:27:07 +01:00
|
|
|
|
2021-03-31 21:43:51 +02:00
|
|
|
enum runmode_t {
|
|
|
|
RUNMODE_POWERCYCLE,
|
|
|
|
RUNMODE_NORMAL,
|
|
|
|
RUNMODE_WAKEUP,
|
|
|
|
RUNMODE_UPDATE,
|
|
|
|
RUNMODE_SLEEP,
|
|
|
|
RUNMODE_MAINTENANCE
|
|
|
|
};
|
|
|
|
|
2021-03-20 21:31:04 +01:00
|
|
|
extern RTC_NOINIT_ATTR runmode_t RTC_runmode;
|
2021-03-21 20:20:39 +01:00
|
|
|
extern RTC_NOINIT_ATTR uint32_t RTC_restarts;
|
2021-03-20 21:31:04 +01:00
|
|
|
|
2019-10-20 20:05:13 +02:00
|
|
|
#endif // _RESET_H
|