Skip to content

Consider ignoring indexer if the specified value is zero and the length of the register is equal to one #77

@glopesdev

Description

@glopesdev

Specifically in this generation step:

var memberIndexer = member.Value.Offset.HasValue ? $"[{member.Value.Offset}]" : string.Empty;

The advantage would be allowing reusable payloadSpec definitions shared across registers where one is single value and the other is array.

For example, in the below, StartPulseTrain could be defined by reusing the definition in StartPulse:

  StartPulse:
    address: 37
    type: U16
    access: Write
    description: Starts a single pulse on the specified digital output line.
    payloadSpec: &pulse
      DigitalOutput:
        offset: 0
        mask: 0xC00
        maskType: PwmOutput
        description: Specifies the digital output line on which to run each pulse.
      PulseWidth:
        offset: 0
        mask: 0x3FF
        interfaceType: ushort
        description: Specifies the duration in milliseconds that each pulse is HIGH.
  StartPulseTrain:
    address: 38
    type: U16
    length: 2
    access: Write
    description: Starts a pulse train on the specified digital output line.
    payloadSpec:
      <<: *pulse
      Frequency:
        offset: 1
        mask: 0xFF00
        minValue: 1
        maxValue: 255
        defaultValue: 1
        interfaceType: byte
        description: Specifies the rate in Hz of the pulses in the PWM pulse train.
      PulseCount:
        offset: 1
        mask: 0xFF
        interfaceType: byte
        description: Specifies the number of pulses in the PWM pulse train. A value of zero signifies an infinite pulse train.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalRequest for a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions