Compare commits
2 Commits
b6004c42e0
...
25d7967d69
Author | SHA1 | Date | |
---|---|---|---|
|
25d7967d69 | ||
|
6599bf151d |
@ -61,6 +61,10 @@
|
||||
END USER CONFIGURATION
|
||||
**********************/
|
||||
|
||||
#if !defined(__AVR_ATmega328P__) || F_CPU != 16000000
|
||||
#error "This program only works on ATmega328P devices with a clock frequency of 16MHz!"
|
||||
#endif
|
||||
|
||||
void (*full_reset)() = nullptr;
|
||||
|
||||
static int serial_putch(char c, FILE *f) {
|
||||
@ -130,7 +134,7 @@ ISR (WDT_vect) {
|
||||
/* Based on https://github.com/rocketscream/Low-Power. */
|
||||
static void low_power_sleep_minutes(unsigned long t) {
|
||||
wdt_int_sleep_mode = true;
|
||||
ADCSRA &= ~(1 << ADEN); /* Disable ADC. */
|
||||
ADCSRA &= ~_BV(ADEN); /* Disable ADC. */
|
||||
for (unsigned long i = 0; 8ul * i < 60ul * t; i++) {
|
||||
// Power Down for 8s
|
||||
wdt_enable(WDTO_8S); /* Start watchdog timer for 8s. */
|
||||
@ -146,7 +150,7 @@ static void low_power_sleep_minutes(unsigned long t) {
|
||||
sei();
|
||||
} while (0);
|
||||
}
|
||||
ADCSRA |= (1 << ADEN); /* Re-enable ADC. */
|
||||
ADCSRA |= _BV(ADEN); /* Re-enable ADC. */
|
||||
wdt_int_sleep_mode = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user