2022-04-19 19:30:15 +02:00
|
|
|
// Copyright 2022 Darwin Schuppan <darwin@nobrain.org>
|
|
|
|
// SPDX license identifier: MIT
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <avr/interrupt.h>
|
|
|
|
#include <avr/io.h>
|
|
|
|
#include <avr/wdt.h>
|
|
|
|
#include <avr/sleep.h>
|
|
|
|
|
2022-04-19 19:45:13 +02:00
|
|
|
extern void (*full_reset)();
|
2022-04-19 19:30:15 +02:00
|
|
|
|
|
|
|
void low_power_sleep_minutes(unsigned long t);
|
|
|
|
|
|
|
|
static inline void wdt_enable_with_full_reset() {
|
|
|
|
wdt_enable(WDTO_8S); /* Start watchdog timer for 8s. */
|
|
|
|
WDTCSR |= (1 << WDIE); /* Enable watchdog interrupt. */
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void disable_recording_interrupts() {
|
|
|
|
TIMSK1 &= ~(_BV(OCIE1A) | _BV(OCIE1B));
|
|
|
|
}
|