* @brief AVR-specific sleep method implementation using IDLE sleep mode * * This implementation uses the AVR's IDLE sleep mode which stops the CPU * but keeps all peripherals running. This allows timers to continue operating * and wake up the processor when needed. The sleep duration parameter is * ignored as the wake-up is controlled by timer interrupts. * * @param aDuration Duration param
| 75 | * - ATmega32U4: ~20mA active → ~8mA idle (60% power reduction) |
| 76 | */ |
| 77 | void SleepMethod( unsigned long aDuration ) { |
| 78 | set_sleep_mode(SLEEP_MODE_IDLE); |
| 79 | sleep_enable(); |
| 80 | /* Now enter sleep mode. */ |
| 81 | sleep_mode(); |
| 82 | |
| 83 | /* The program will continue from here after the timer timeout ~1 ms */ |
| 84 | sleep_disable(); /* First thing to do is disable sleep. */ |
| 85 | } |
| 86 | // ARDUINO_ARCH_AVR |
| 87 | |
| 88 |