Files
2026-08-31 23:12:28 -04:00

26 lines
672 B
C

// One-shot clock gating for every peripheral this firmware never uses (and
// the ADC, which adc_Enable()/adc_Disable() power up only around a reading).
// In use and left alone: SPI1 (radio + EEPROM), TWI0 (RTC + NFC tag), and
// USART0 when serial logging is compiled in.
#include "power_mgmt.h"
void shutdown_all_peripherals(void)
{
power_adc_disable();
power_timer0_disable();
power_timer1_disable();
power_timer2_disable();
power_timer3_disable();
power_usart1_disable();
#ifdef power_spi0_disable
power_spi0_disable();
#endif
#ifdef power_twi1_disable
power_twi1_disable();
#endif
#if !DO_UART
power_usart0_disable();
#endif
}