# Packages define a logical collection of SBP messages. Packages can
# in turn include other packages in the directory hierarchy. A package
# identifier specifies a directory path for the generated code,
# followed by an optional description used for documentation. By
# convention, packages marked as "stable" are unlikely to change much
# in the future, whereas unstable messages may change with future
# firmware development. Some packages are purely informative and are
# omitted from code generation using "render_source".

package: example
description: Geodetic navigation messages and friends.
render_source: True
stable: True
include:
  - types.yaml

definitions:

 - MSG_BASELINE_NED:
    id: 0x0203
    short_desc: Baseline in NED
    desc: |
        Baseline in local North East Down (NED) coordinates.

    fields:
          - tow:
              type: u32
              units: ms
              desc: GPS Time of Week
          - n:
              type: s32
              units: mm
              desc: Baseline North coordinate
          - e:
              type: s32
              units: mm
              desc: Baseline East coordinate
          - d:
              type: s32
              units: mm
              desc: Baseline Down coordinate
          - n_sats:
              type: u8
              desc: Number of satellites used in solution

          - flags:
              type: u8
              desc: Status flags
              fields:
                - 4-7: # MSGBREAK
                    desc: Reserved
                - 0-3:
                    desc: Fix mode
                    values:
                        - 0: Float RTK
                        - 1: Fixed RTK

 # Defitions lacking an id are not treated as SBP messages, but are
 # structured types that can be embedded into SBP definitions. Here,
 # UARTChannel is a struct composed of primitive types...

 - UARTChannel:
    desc: State of the UART channel.
    fields:
        - tx_throughput:
            type: float
            desc: UART transmit throughput.
        - crc_error_count:
            type: u16
            desc: UART CRC error count.
        - tx_buffer_level:
            type: u8
            desc: UART transmit usage percentage.

 # ... that can be used as a field in an actual SBP message...

 - MSG_UART_STATE:
    id: 0x0018
    desc: Piksi message about the state of UART0.
    fields:
        - uart0:
            type: UARTChannel
            desc: State of the UART0 channel.

        # You can also define fixed-size strings and
        # fixed/variable-size arrays!

        - info:
            type: string
            size: 20
            desc: Info string of length 20 (bytes).
        - remaining_uart_array:
            type: array
            fill: UARTChannel
            desc: Array of UART channels.
