Compare commits

...

2 Commits

Author SHA1 Message Date
r4 25d7967d69 error on incompatible hardware 2022-04-18 23:04:53 +02:00
r4 6599bf151d consistency 2022-04-18 23:02:12 +02:00
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}