You are implementing a simulated 8-bit control register where each bit controls a feature. Rather than using masks, you’ll use a bitfield struct to access individual bits.
The register layout is as follows:
Bit
Field
Size
0
enable
1
1–2
mode
2
3
interrupt
1
4–7
reserved
4
Your task is to:
Define a union that overlays:
A struct with bitfields: enable, mode, interrupt
A raw uint8_t register
Read values for enable, mode, interrupt from input
Construct the struct, and print the final register as an 8-bit unsigned value