google / cyanobyte

Machine-readable datasheets
https://cyanobyte.dev
Apache License 2.0
80 stars 31 forks source link

Add an enum lookup capability #105

Open Fleker opened 4 years ago

Fleker commented 4 years ago

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.

Fleker commented 4 years ago

Tasks for this:

- programmableGain: '#/fields/ProgrammableGain'
- programmableGain:
  when:
    for: programmableGain
    0b000: 6144
    0b001: 4096
    0b010: 2048
    0b011: 1024
    0b100: 512
    0b101: 256