PX4 Firmware
PX4 Autopilot Software http://px4.io
st24.h File Reference

RC protocol definition for Yuneec ST24 transmitter. More...

#include <stdint.h>
Include dependency graph for st24.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ReceiverFcPacket
 
struct  ChannelData12
 RC Channel data (12 channels). More...
 
struct  ChannelData24
 RC Channel data (12 channels). More...
 
struct  TelemetryData
 Telemetry packet. More...
 

Macros

#define ST24_DATA_LEN_MAX   64
 
#define ST24_STX1   0x55
 
#define ST24_STX2   0x55
 

Enumerations

enum  ST24_PACKET_TYPE { ST24_PACKET_TYPE_CHANNELDATA12 = 0, ST24_PACKET_TYPE_CHANNELDATA24, ST24_PACKET_TYPE_TRANSMITTERGPSDATA }
 
enum  ST24_DECODE_STATE {
  ST24_DECODE_STATE_UNSYNCED = 0, ST24_DECODE_STATE_GOT_STX1, ST24_DECODE_STATE_GOT_STX2, ST24_DECODE_STATE_GOT_LEN,
  ST24_DECODE_STATE_GOT_TYPE, ST24_DECODE_STATE_GOT_DATA
}
 

Functions

uint8_t st24_common_crc8 (uint8_t *ptr, uint8_t len)
 CRC8 implementation for ST24 protocol. More...
 
__EXPORT int st24_decode (uint8_t byte, uint8_t *rssi, uint8_t *lost_count, uint16_t *channel_count, uint16_t *channels, uint16_t max_chan_count)
 Decoder for ST24 protocol. More...
 

Detailed Description

RC protocol definition for Yuneec ST24 transmitter.

Author
Lorenz Meier lm@in.nosp@m.f.et.nosp@m.hz.ch

Definition in file st24.h.

Macro Definition Documentation

◆ ST24_DATA_LEN_MAX

#define ST24_DATA_LEN_MAX   64

Definition at line 48 of file st24.h.

◆ ST24_STX1

#define ST24_STX1   0x55

Definition at line 49 of file st24.h.

Referenced by st24_decode().

◆ ST24_STX2

#define ST24_STX2   0x55

Definition at line 50 of file st24.h.

Referenced by st24_decode().

Enumeration Type Documentation

◆ ST24_DECODE_STATE

Enumerator
ST24_DECODE_STATE_UNSYNCED 
ST24_DECODE_STATE_GOT_STX1 
ST24_DECODE_STATE_GOT_STX2 
ST24_DECODE_STATE_GOT_LEN 
ST24_DECODE_STATE_GOT_TYPE 
ST24_DECODE_STATE_GOT_DATA 

Definition at line 58 of file st24.h.

◆ ST24_PACKET_TYPE

Enumerator
ST24_PACKET_TYPE_CHANNELDATA12 
ST24_PACKET_TYPE_CHANNELDATA24 
ST24_PACKET_TYPE_TRANSMITTERGPSDATA 

Definition at line 52 of file st24.h.

Function Documentation

◆ st24_common_crc8()

uint8_t st24_common_crc8 ( uint8_t *  ptr,
uint8_t  len 
)

CRC8 implementation for ST24 protocol.

Parameters
prtPointer to the data to CRC
lennumber of bytes to accumulate in the checksum
Returns
the checksum of these bytes over len

Definition at line 71 of file st24.cpp.

Referenced by st24_decode().

Here is the caller graph for this function:

◆ st24_decode()

__EXPORT int st24_decode ( uint8_t  byte,
uint8_t *  rssi,
uint8_t *  lost_count,
uint16_t *  channel_count,
uint16_t *  channels,
uint16_t  max_chan_count 
)

Decoder for ST24 protocol.

Parameters
bytecurrent char to read
rssipointer to a byte where the RSSI value is written back to
lost_countpointer to a byte where the receive count of packets since last wireless frame is written back to ( > 0 if RC is lost)
channelspointer to a datastructure of size max_chan_count where channel values (12 bit) are written back to
max_chan_countmaximum channels to decode - if more channels are decoded, the last n are skipped and success (0) is returned
Returns
0 for success (a decoded packet), 1 for no packet yet (accumulating), 2 for unknown packet, 3 for out of sync, 4 for checksum error

Definition at line 98 of file st24.cpp.

References _decode_state, _rxlen, sbus_bit_pick::byte, ChannelData12::channel, ChannelData24::channel, ReceiverFcPacket::crc8, f(), ReceiverFcPacket::length, ChannelData12::lost_count, ChannelData24::lost_count, ChannelData12::rssi, ChannelData24::rssi, st24_common_crc8(), ReceiverFcPacket::st24_data, ST24_DECODE_STATE_GOT_DATA, ST24_DECODE_STATE_GOT_LEN, ST24_DECODE_STATE_GOT_STX1, ST24_DECODE_STATE_GOT_STX2, ST24_DECODE_STATE_GOT_TYPE, ST24_DECODE_STATE_UNSYNCED, ST24_PACKET_TYPE_CHANNELDATA12, ST24_PACKET_TYPE_CHANNELDATA24, ST24_PACKET_TYPE_TRANSMITTERGPSDATA, ST24_SCALE_FACTOR, ST24_SCALE_OFFSET, ST24_STX1, ST24_STX2, and ReceiverFcPacket::type.

Referenced by RCInput::cycle(), dsm_port_input(), and RCTest::st24Test().

Here is the call graph for this function:
Here is the caller graph for this function: