66. ADC Config Flags

 Your task is to declare a scoped enum class named AdcConfig with three bit-flag values:

  • ChannelEnable = 1
  • InterruptEnable = 2
  • DMAEnable = 4

     

Also, implement a helper function named printConfig(uint8_t cfg) that prints which features are enabled in the configuration word.

The program will read three integers (0 or 1) representing whether each flag is set, combine them into a single configuration word, and then print the enabled features.

Example
 Input:

1 0 1

Output:

ChannelEnable DMAEnable

 

Input:

0 0 0

Output:

None
Loading...

Input

1 0 1

Expected Output

ChannelEnable DMAEnable