Skip to content

File syn_ibus.h

FileList > proto > syn_ibus.h

Go to the source code of this file

Zero-Heap IBUS (FlySky) 14-Channel Receiver Decoder. More...

  • #include "syntropic/common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_IBUS_Frame
struct SYN_IBUS_Parser

Public Functions

Type Name
uint16_t syn_ibus_calc_checksum (const uint8_t buf)
Calculate IBUS 16-bit checksum.
SYN_Status syn_ibus_init (SYN_IBUS_Parser * parser)
Initialize IBUS parser.
SYN_Status syn_ibus_parse_byte (SYN_IBUS_Parser * parser, uint8_t byte, SYN_IBUS_Frame * frame)
Process single byte from serial RX stream.

Macros

Type Name
define SYN_IBUS_FRAME_SIZE 32U
define SYN_IBUS_HEADER1 0x20U
define SYN_IBUS_HEADER2 0x40U
define SYN_IBUS_NUM_CHANNELS 14U

Detailed Description

IBUS Protocol Specifications: * Baud rate: 115,200 bps, 8N1. * Frame length: 32 bytes. * Header: 0x20 0x40 * Channels: 14 16-bit little-endian channels (bytes 2..29, raw 1000..2000 us). * Checksum: 16-bit sum checksum (0xFFFF - sum(bytes[0..29])).

Public Functions Documentation

function syn_ibus_calc_checksum

Calculate IBUS 16-bit checksum.

uint16_t syn_ibus_calc_checksum (
    const uint8_t buf
) 

Parameters:

  • buf Pointer to 30 data bytes.

Returns:

16-bit expected checksum (0xFFFF - sum(bytes)).


function syn_ibus_init

Initialize IBUS parser.

SYN_Status syn_ibus_init (
    SYN_IBUS_Parser * parser
) 

Parameters:

  • parser Pointer to parser struct.

Returns:

SYN_OK on success.


function syn_ibus_parse_byte

Process single byte from serial RX stream.

SYN_Status syn_ibus_parse_byte (
    SYN_IBUS_Parser * parser,
    uint8_t byte,
    SYN_IBUS_Frame * frame
) 

Parameters:

  • parser Pointer to parser struct.
  • byte Incoming byte.
  • frame Pointer to output frame struct (populated when a valid 32-byte frame is decoded).

Returns:

SYN_OK on complete frame, SYN_BUSY if byte accepted but incomplete, SYN_ERROR on bad header/checksum.


Macro Definition Documentation

define SYN_IBUS_FRAME_SIZE

#define SYN_IBUS_FRAME_SIZE `32U`

IBUS frame size in bytes (32)


define SYN_IBUS_HEADER1

#define SYN_IBUS_HEADER1 `0x20U`

First header byte of IBUS frame (0x20)


define SYN_IBUS_HEADER2

#define SYN_IBUS_HEADER2 `0x40U`

Second header byte of IBUS frame (0x40)


define SYN_IBUS_NUM_CHANNELS

#define SYN_IBUS_NUM_CHANNELS `14U`

Number of RC channels in IBUS frame (14)



The documentation for this class was generated from the following file src/syntropic/proto/syn_ibus.h