APM:Libraries
telem_structure.h
Go to the documentation of this file.
1 /*
2  structures for telemetry packets
3  This header is common to ArduPilot AP_Radio and STM8 TX code
4  */
5 
6 #pragma once
7 
8 enum telem_type {
9  TELEM_STATUS= 0, // a telem_status packet
10  TELEM_PLAY = 1, // play a tune
11  TELEM_FW = 2, // update new firmware
12 };
13 
14 // flags in telem_status structure
15 #define TELEM_FLAG_GPS_OK (1U<<0)
16 #define TELEM_FLAG_ARM_OK (1U<<1)
17 #define TELEM_FLAG_BATT_OK (1U<<2)
18 #define TELEM_FLAG_ARMED (1U<<4)
19 #define TELEM_FLAG_POS_OK (1U<<5)
20 #define TELEM_FLAG_VIDEO (1U<<6)
21 #define TELEM_FLAG_HYBRID (1U<<7)
22 
24  uint8_t pps; // packets per second received
25  uint8_t rssi; // lowpass rssi
26  uint8_t flags; // TELEM_FLAG_*
27  uint8_t flight_mode; // flight mode
28  uint8_t wifi_chan; // wifi channel number on Sonix
29  uint8_t tx_max; // max TX power
30  uint8_t note_adjust; // buzzer tone adjustment
31 };
32 
33 // write to new firmware. This is also used to play a tune
35  uint8_t seq;
36  uint8_t len;
37  uint16_t offset;
38  uint8_t data[8];
39 };
40 
41 /*
42  telemetry packet from RX to TX for cypress
43  */
45  uint8_t crc; // simple CRC
46  enum telem_type type;
47  union {
48  uint8_t pkt[14];
49  struct telem_status status;
50  struct telem_firmware fw;
51  } payload;
52 };
53 
54 /*
55  telemetry packet from RX to TX for cc2500
56  */
58  uint8_t length;
59  uint8_t type;
60  uint8_t txid[2];
61  union {
62  uint8_t pkt[12];
63  struct telem_status status;
64  struct telem_firmware fw;
65  } payload;
66  uint8_t crc[2];
67 };
68 
69 /*
70  packet type - controls data field. We have 4 bits, giving 16 possible
71  data field types
72  */
82  PKTYPE_NUM_TYPES = 8 // used for modulus
83 };
84 
85 /*
86  skyrocket specific packet for cc2500
87  */
89  uint8_t length; // required for cc2500 FIFO
90  uint8_t txid[2];
91  uint8_t version:4; // protocol version
92  uint8_t pkt_type:4; // packet type
93  uint8_t chan1;
94  uint8_t chan2;
95  uint8_t chan3;
96  uint8_t chan4;
97  uint8_t chan_high;
98  uint8_t data; // data according to pkt_type
99  uint8_t buttons; // see channels.h
100  uint8_t channr;
101  uint8_t chanskip;
102  uint8_t crc[2];
103 };
uint8_t length
uint8_t note_adjust
uint8_t chan_high
packet_type
uint8_t flight_mode
uint8_t chan2
telem_type
uint8_t chanskip
uint8_t buttons
uint8_t channr
#define PACKED
Definition: AP_Common.h:28
uint8_t chan1
uint8_t pkt_type
uint8_t wifi_chan
uint8_t chan4
uint8_t version
uint8_t chan3
uint8_t data