Skip to content

Disable ADC missing #415

Open
Open
@Reneg973

Description

@Reneg973

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions