cyanobyte
cyanobyte copied to clipboard
Add an enum lookup capability
Translate from an enum, which may come from a register, to the enum value.
For example, see ADS1015. Programmable gain is a 3-bit field, while each combination relates to a higher-level value.
Tasks for this:
- Create a '#/fields/<X>' getter
- Add a when to do a dict lookup based on value from variable
for
- programmableGain: '#/fields/ProgrammableGain'
- programmableGain:
when:
for: programmableGain
0b000: 6144
0b001: 4096
0b010: 2048
0b011: 1024
0b100: 512
0b101: 256