Open
Description
According to datasheet 4.9.3
The ADC can be disabled again at any time by clearing CS.EN, to save power.
The implemenation for this is missing.
What would be the accepted implementation, #if or #else?
static inline void adc_set_enabled(bool enable) {
#if 0
adc_hw->cs = enable ? adc_hw->cs | ADC_CS_EN_BITS : adc_hw->cs &~ ADC_CS_EN_BITS;
#else
if (enable)
hw_set_bits(&adc_hw->cs, ADC_CS_EN_BITS)
else
hw_clear_bits(&adc_hw->cs, ADC_CS_EN_BITS);
#endif
}
Or maybe a 3rd variant?