In embedded systems, peripheral configuration registers commonly use bit flags to enable or disable features.
Your task is to declare a scoped enum class named AdcConfig that represents configuration flags for an ADC peripheral. Each flag occupies a single bit in an 8-bit configuration register.
The enum must contain the following values:
ChannelEnable → bit 0 (value 1)InterruptEnable → bit 1 (value 2)DMAEnable → bit 2 (value 4)You must also implement a helper function:
void printConfig(uint8_t cfg);
This function examines the configuration word and prints which features are enabled.
The program reads three integers, each being either 0 or 1, indicating whether the corresponding feature is enabled:
These inputs must be combined into a single 8-bit configuration word using bitwise operations, then passed to printConfig().
If no flags are enabled, print None.
Input Format
ch intr dma0 or 1ch → ChannelEnableintr → InterruptEnabledma → DMAEnableOutput Format
ChannelEnableInterruptEnableDMAEnableNone
Example 1
Input:
1 0 1
Output:
ChannelEnable DMAEnable
Example 2
Input:
0 0 0
Output:
None
Input
1 0 1
Expected Output
ChannelEnable DMAEnable