got it to work with sleep, vcc, bme measurement and radio out

This commit is contained in:
2021-12-14 19:43:39 +01:00
parent 5b3b9fdfc9
commit 64c257a2ba
9 changed files with 209 additions and 24 deletions

View File

@@ -55,6 +55,21 @@
delay(10); \
SPCR = (1<<SPE)
// go into sleep mode, keep SPI running
// disable ADC
// wait a little for the last serial out (if any) to flush
// set all bits in power reduction register to one (shutdown everything)
// actually sleep
// wake up after WDT timeout
// wait a little
#define sleep_enter_keep_spi() \
adc_disable(); \
delay(10); \
PRR = 0xFF; \
sleep_mode(); \
PRR = 0x00; \
delay(10);
// nothing extra to do on wake up, just wake up
#define sleep_vect() ISR(WDT_vect){}