SerialIO
Loading...
Searching...
No Matches
crsf_protocol.h File Reference

Header file for the CRSF protocol implementation. More...

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

Go to the source code of this file.

Classes

struct  crsf_header_s
 
struct  crsf_channels_s
 
struct  crsfPayloadLinkstatistics_s
 
struct  crsf_sensor_battery_s
 
struct  crsf_sensor_gps_s
 

Macros

#define CRSF_PROTOCOL_H
 
#define PACKED   __attribute__((packed))
 
#define CRSF_BAUDRATE   420000
 CRSF default baud rate.
 
#define CRSF_NUM_CHANNELS   16
 CRSF number of channels.
 
#define CRSF_CHANNEL_VALUE_MIN    172
 987us - actual CRSF min is 0 with E.Limits on
 
#define CRSF_CHANNEL_VALUE_1000   191
 
#define CRSF_CHANNEL_VALUE_MID   992
 mid value of channel
 
#define CRSF_CHANNEL_VALUE_2000   1792
 
#define CRSF_CHANNEL_VALUE_MAX    1811
 2012us - actual CRSF max is 1984 with E.Limits on
 
#define CRSF_CHANNEL_VALUE_SPAN    (CRSF_CHANNEL_VALUE_MAX - CRSF_CHANNEL_VALUE_MIN)
 
#define CRSF_MAX_PACKET_SIZE    64
 max declared len is 62+DEST+LEN on top of that = 64
 
#define CRSF_MAX_PAYLOAD_LEN
 Max size of payload in [dest] [len] [type] [payload] [crc8].
 

Typedefs

typedef struct crsf_header_s crsf_header_t
 
typedef struct crsf_channels_s crsf_channels_t
 
typedef struct crsfPayloadLinkstatistics_s crsfLinkStatistics_t
 
typedef struct crsf_sensor_battery_s crsf_sensor_battery_t
 
typedef struct crsf_sensor_gps_s crsf_sensor_gps_t
 

Enumerations

enum  {
  CRSF_FRAME_LENGTH_ADDRESS = 1 , CRSF_FRAME_LENGTH_FRAMELENGTH = 1 , CRSF_FRAME_LENGTH_TYPE = 1 , CRSF_FRAME_LENGTH_CRC = 1 ,
  CRSF_FRAME_LENGTH_TYPE_CRC = 2 , CRSF_FRAME_LENGTH_EXT_TYPE_CRC , CRSF_FRAME_LENGTH_NON_PAYLOAD
}
 
enum  {
  CRSF_FRAME_GPS_PAYLOAD_SIZE = 15 , CRSF_FRAME_BATTERY_SENSOR_PAYLOAD_SIZE = 8 , CRSF_FRAME_LINK_STATISTICS_PAYLOAD_SIZE = 10 , CRSF_FRAME_RC_CHANNELS_PAYLOAD_SIZE ,
  CRSF_FRAME_ATTITUDE_PAYLOAD_SIZE = 6
}
 
enum  crsf_frame_type_e {
  CRSF_FRAMETYPE_GPS = 0x02 , CRSF_FRAMETYPE_BATTERY_SENSOR = 0x08 , CRSF_FRAMETYPE_LINK_STATISTICS = 0x14 , CRSF_FRAMETYPE_OPENTX_SYNC = 0x10 ,
  CRSF_FRAMETYPE_RADIO_ID = 0x3A , CRSF_FRAMETYPE_RC_CHANNELS_PACKED = 0x16 , CRSF_FRAMETYPE_ATTITUDE = 0x1E , CRSF_FRAMETYPE_FLIGHT_MODE = 0x21 ,
  CRSF_FRAMETYPE_DEVICE_PING = 0x28 , CRSF_FRAMETYPE_DEVICE_INFO = 0x29 , CRSF_FRAMETYPE_PARAMETER_SETTINGS_ENTRY = 0x2B , CRSF_FRAMETYPE_PARAMETER_READ = 0x2C ,
  CRSF_FRAMETYPE_PARAMETER_WRITE = 0x2D , CRSF_FRAMETYPE_COMMAND = 0x32 , CRSF_FRAMETYPE_MSP_REQ , CRSF_FRAMETYPE_MSP_RESP = 0x7B ,
  CRSF_FRAMETYPE_MSP_WRITE = 0x7C
}
 
enum  crsf_addr_e {
  CRSF_ADDRESS_BROADCAST = 0x00 , CRSF_ADDRESS_USB = 0x10 , CRSF_ADDRESS_TBS_CORE_PNP_PRO = 0x80 , CRSF_ADDRESS_RESERVED1 = 0x8A ,
  CRSF_ADDRESS_CURRENT_SENSOR = 0xC0 , CRSF_ADDRESS_GPS = 0xC2 , CRSF_ADDRESS_TBS_BLACKBOX = 0xC4 , CRSF_ADDRESS_FLIGHT_CONTROLLER = 0xC8 ,
  CRSF_ADDRESS_RESERVED2 = 0xCA , CRSF_ADDRESS_RACE_TAG = 0xCC , CRSF_ADDRESS_RADIO_TRANSMITTER = 0xEA , CRSF_ADDRESS_CRSF_RECEIVER = 0xEC ,
  CRSF_ADDRESS_CRSF_TRANSMITTER = 0xEE
}
 

Detailed Description

Header file for the CRSF protocol implementation.

Macro Definition Documentation

◆ CRSF_MAX_PAYLOAD_LEN

#define CRSF_MAX_PAYLOAD_LEN
Value:
4)
#define CRSF_MAX_PACKET_SIZE
max declared len is 62+DEST+LEN on top of that = 64
Definition crsf_protocol.h:29

Max size of payload in [dest] [len] [type] [payload] [crc8].

Typedef Documentation

◆ crsf_channels_t

RC Packet Frame

◆ crsf_header_t

typedef struct crsf_header_s crsf_header_t

Heder of CRSF Packet

◆ crsf_sensor_battery_t

Battery Voltage parameters

◆ crsf_sensor_gps_t

GPS parameters

◆ crsfLinkStatistics_t

Payload Statics

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Length of different CRSF frame

◆ anonymous enum

anonymous enum

Length of CRSF frames

◆ crsf_addr_e

CRSF sensor address

◆ crsf_frame_type_e

CRSF Sensor frame type