50 #define ST24_DATA_LEN_MAX 64 51 #define ST24_STX1 0x55 52 #define ST24_STX2 0x55 153 #define ST24_RANGE_MIN 0.0f 154 #define ST24_RANGE_MAX 4096.0f 156 #define ST24_TARGET_MIN 1000.0f 157 #define ST24_TARGET_MAX 2000.0f 160 #define ST24_SCALE_FACTOR ((ST24_TARGET_MAX - ST24_TARGET_MIN) / (ST24_RANGE_MAX - ST24_RANGE_MIN)) 161 #define ST24_SCALE_OFFSET (int)(ST24_TARGET_MIN - (ST24_SCALE_FACTOR * ST24_RANGE_MIN + 0.5f)) 174 for (i = 0x80; i != 0; i >>= 1) {
175 if ((crc & 0x80) != 0) {
183 if ((*ptr & i) != 0) {
196 uint16_t max_chan_count)
225 if ((
unsigned)byte <=
sizeof(_rxpacket.
length) +
sizeof(_rxpacket.
type) +
sizeof(_rxpacket.
st24_data)) {
262 switch (_rxpacket.
type) {
271 *channel_count = (max_chan_count < 12) ? max_chan_count : 12;
273 unsigned stride_count = (*channel_count * 3) / 2;
274 unsigned chan_index = 0;
276 for (
unsigned i = 0; i < stride_count; i += 3) {
277 channels[chan_index] = ((uint16_t)d->
channel[i] << 4);
278 channels[chan_index] |= ((uint16_t)(0xF0 & d->
channel[i + 1]) >> 4);
283 channels[chan_index] = ((uint16_t)d->
channel[i + 2]);
284 channels[chan_index] |= (((uint16_t)(0x0F & d->
channel[i + 1])) << 8);
299 *channel_count = (max_chan_count < 24) ? max_chan_count : 24;
301 unsigned stride_count = (*channel_count * 3) / 2;
302 unsigned chan_index = 0;
304 for (
unsigned i = 0; i < stride_count; i += 3) {
305 channels[chan_index] = ((uint16_t)d->
channel[i] << 4);
306 channels[chan_index] |= ((uint16_t)(0xF0 & d->
channel[i + 1]) >> 4);
311 channels[chan_index] = ((uint16_t)d->
channel[i + 2]);
312 channels[chan_index] |= (((uint16_t)(0x0F & d->
channel[i + 1])) << 8);
int16_t yaw
0.01 degree resolution
uint8_t st24_data[ST24_DATA_LEN_MAX]
uint8_t length
length includes type, data, and crc = sizeof(type)+sizeof(data[payload_len])+sizeof(crc8) ...
int32_t lat
lattitude (degrees) +/- 90 deg
uint16_t t
packet counter or clock
int32_t alt
0.01m resolution, altitude (meters)
uint16_t t
packet counter or clock
uint8_t nsat
number of satellites
int16_t vz
velocity 0.01m res, +/-320.00 North-East- Down
#define ST24_SCALE_OFFSET
static uint8_t st24_common_crc8(uint8_t *ptr, uint8_t len)
static uint16_t channels[SRXL_MAX_CHANNELS]
static enum ST24_DECODE_STATE _decode_state
uint8_t imuStatus
inertial measurement unit status
uint8_t rssi
signal strength
uint8_t current
0.5A resolution
uint8_t header2
0x55 for a valid packet
uint8_t channel[36]
channel data, 24 channels (12 bit numbers)
uint8_t header1
0x55 for a valid packet
uint8_t packet_count
Number of UART packets sent since reception of last RF frame (this tells something about age / rate) ...
uint8_t pressCompassStatus
baro / compass status
uint8_t crc8
crc8 checksum, calculated by st24_common_crc8 and including fields length, type and st24_data ...
uint16_t t
packet counter or clock
static ReceiverFcPacket _rxpacket
uint8_t channel[18]
channel data, 12 channels (12 bit numbers)
int st24_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channel_count, uint16_t *channels, uint16_t max_chan_count)
uint8_t rssi
signal strength
uint8_t packet_count
Number of UART packets sent since reception of last RF frame (this tells something about age / rate) ...
uint8_t voltage
25.4V voltage = 5 + 255*0.1 = 30.5V, min=5V
uint8_t motorStatus
1 bit per motor for status 1=good, 0= fail
int32_t lon
longitude (degrees) +/- 180 deg
#define ST24_DATA_LEN_MAX
#define ST24_SCALE_FACTOR
uint8_t type
from enum ST24_PACKET_TYPE