[324] | 1 | // MESSAGE RC_CHANNELS_RAW PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_RC_CHANNELS_RAW 35
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_rc_channels_raw_t
|
---|
| 6 | {
|
---|
| 7 | uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
|
---|
| 8 | uint16_t chan1_raw; /*< RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 9 | uint16_t chan2_raw; /*< RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 10 | uint16_t chan3_raw; /*< RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 11 | uint16_t chan4_raw; /*< RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 12 | uint16_t chan5_raw; /*< RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 13 | uint16_t chan6_raw; /*< RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 14 | uint16_t chan7_raw; /*< RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 15 | uint16_t chan8_raw; /*< RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.*/
|
---|
| 16 | uint8_t port; /*< Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.*/
|
---|
| 17 | uint8_t rssi; /*< Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.*/
|
---|
| 18 | } mavlink_rc_channels_raw_t;
|
---|
| 19 |
|
---|
| 20 | #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN 22
|
---|
| 21 | #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN 22
|
---|
| 22 | #define MAVLINK_MSG_ID_35_LEN 22
|
---|
| 23 | #define MAVLINK_MSG_ID_35_MIN_LEN 22
|
---|
| 24 |
|
---|
| 25 | #define MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC 244
|
---|
| 26 | #define MAVLINK_MSG_ID_35_CRC 244
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | #if MAVLINK_COMMAND_24BIT
|
---|
| 31 | #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW { \
|
---|
| 32 | 35, \
|
---|
| 33 | "RC_CHANNELS_RAW", \
|
---|
| 34 | 11, \
|
---|
| 35 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_raw_t, time_boot_ms) }, \
|
---|
| 36 | { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_raw_t, chan1_raw) }, \
|
---|
| 37 | { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_raw_t, chan2_raw) }, \
|
---|
| 38 | { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_raw_t, chan3_raw) }, \
|
---|
| 39 | { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_raw_t, chan4_raw) }, \
|
---|
| 40 | { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_raw_t, chan5_raw) }, \
|
---|
| 41 | { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_raw_t, chan6_raw) }, \
|
---|
| 42 | { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_rc_channels_raw_t, chan7_raw) }, \
|
---|
| 43 | { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_rc_channels_raw_t, chan8_raw) }, \
|
---|
| 44 | { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_raw_t, port) }, \
|
---|
| 45 | { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_raw_t, rssi) }, \
|
---|
| 46 | } \
|
---|
| 47 | }
|
---|
| 48 | #else
|
---|
| 49 | #define MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW { \
|
---|
| 50 | "RC_CHANNELS_RAW", \
|
---|
| 51 | 11, \
|
---|
| 52 | { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_rc_channels_raw_t, time_boot_ms) }, \
|
---|
| 53 | { "chan1_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_rc_channels_raw_t, chan1_raw) }, \
|
---|
| 54 | { "chan2_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_rc_channels_raw_t, chan2_raw) }, \
|
---|
| 55 | { "chan3_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_rc_channels_raw_t, chan3_raw) }, \
|
---|
| 56 | { "chan4_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_rc_channels_raw_t, chan4_raw) }, \
|
---|
| 57 | { "chan5_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_rc_channels_raw_t, chan5_raw) }, \
|
---|
| 58 | { "chan6_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_rc_channels_raw_t, chan6_raw) }, \
|
---|
| 59 | { "chan7_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_rc_channels_raw_t, chan7_raw) }, \
|
---|
| 60 | { "chan8_raw", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_rc_channels_raw_t, chan8_raw) }, \
|
---|
| 61 | { "port", NULL, MAVLINK_TYPE_UINT8_T, 0, 20, offsetof(mavlink_rc_channels_raw_t, port) }, \
|
---|
| 62 | { "rssi", NULL, MAVLINK_TYPE_UINT8_T, 0, 21, offsetof(mavlink_rc_channels_raw_t, rssi) }, \
|
---|
| 63 | } \
|
---|
| 64 | }
|
---|
| 65 | #endif
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | * @brief Pack a rc_channels_raw message
|
---|
| 69 | * @param system_id ID of this system
|
---|
| 70 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 71 | * @param msg The MAVLink message to compress the data into
|
---|
| 72 | *
|
---|
| 73 | * @param time_boot_ms Timestamp (milliseconds since system boot)
|
---|
| 74 | * @param port Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
|
---|
| 75 | * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 76 | * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 77 | * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 78 | * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 79 | * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 80 | * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 81 | * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 82 | * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 83 | * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
|
---|
| 84 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 85 | */
|
---|
| 86 | static inline uint16_t mavlink_msg_rc_channels_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 87 | uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
|
---|
| 88 | {
|
---|
| 89 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 90 | char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN];
|
---|
| 91 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 92 | _mav_put_uint16_t(buf, 4, chan1_raw);
|
---|
| 93 | _mav_put_uint16_t(buf, 6, chan2_raw);
|
---|
| 94 | _mav_put_uint16_t(buf, 8, chan3_raw);
|
---|
| 95 | _mav_put_uint16_t(buf, 10, chan4_raw);
|
---|
| 96 | _mav_put_uint16_t(buf, 12, chan5_raw);
|
---|
| 97 | _mav_put_uint16_t(buf, 14, chan6_raw);
|
---|
| 98 | _mav_put_uint16_t(buf, 16, chan7_raw);
|
---|
| 99 | _mav_put_uint16_t(buf, 18, chan8_raw);
|
---|
| 100 | _mav_put_uint8_t(buf, 20, port);
|
---|
| 101 | _mav_put_uint8_t(buf, 21, rssi);
|
---|
| 102 |
|
---|
| 103 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
|
---|
| 104 | #else
|
---|
| 105 | mavlink_rc_channels_raw_t packet;
|
---|
| 106 | packet.time_boot_ms = time_boot_ms;
|
---|
| 107 | packet.chan1_raw = chan1_raw;
|
---|
| 108 | packet.chan2_raw = chan2_raw;
|
---|
| 109 | packet.chan3_raw = chan3_raw;
|
---|
| 110 | packet.chan4_raw = chan4_raw;
|
---|
| 111 | packet.chan5_raw = chan5_raw;
|
---|
| 112 | packet.chan6_raw = chan6_raw;
|
---|
| 113 | packet.chan7_raw = chan7_raw;
|
---|
| 114 | packet.chan8_raw = chan8_raw;
|
---|
| 115 | packet.port = port;
|
---|
| 116 | packet.rssi = rssi;
|
---|
| 117 |
|
---|
| 118 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
|
---|
| 119 | #endif
|
---|
| 120 |
|
---|
| 121 | msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW;
|
---|
| 122 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | /**
|
---|
| 126 | * @brief Pack a rc_channels_raw message on a channel
|
---|
| 127 | * @param system_id ID of this system
|
---|
| 128 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 129 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 130 | * @param msg The MAVLink message to compress the data into
|
---|
| 131 | * @param time_boot_ms Timestamp (milliseconds since system boot)
|
---|
| 132 | * @param port Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
|
---|
| 133 | * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 134 | * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 135 | * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 136 | * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 137 | * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 138 | * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 139 | * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 140 | * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 141 | * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
|
---|
| 142 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 143 | */
|
---|
| 144 | static inline uint16_t mavlink_msg_rc_channels_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 145 | mavlink_message_t* msg,
|
---|
| 146 | uint32_t time_boot_ms,uint8_t port,uint16_t chan1_raw,uint16_t chan2_raw,uint16_t chan3_raw,uint16_t chan4_raw,uint16_t chan5_raw,uint16_t chan6_raw,uint16_t chan7_raw,uint16_t chan8_raw,uint8_t rssi)
|
---|
| 147 | {
|
---|
| 148 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 149 | char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN];
|
---|
| 150 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 151 | _mav_put_uint16_t(buf, 4, chan1_raw);
|
---|
| 152 | _mav_put_uint16_t(buf, 6, chan2_raw);
|
---|
| 153 | _mav_put_uint16_t(buf, 8, chan3_raw);
|
---|
| 154 | _mav_put_uint16_t(buf, 10, chan4_raw);
|
---|
| 155 | _mav_put_uint16_t(buf, 12, chan5_raw);
|
---|
| 156 | _mav_put_uint16_t(buf, 14, chan6_raw);
|
---|
| 157 | _mav_put_uint16_t(buf, 16, chan7_raw);
|
---|
| 158 | _mav_put_uint16_t(buf, 18, chan8_raw);
|
---|
| 159 | _mav_put_uint8_t(buf, 20, port);
|
---|
| 160 | _mav_put_uint8_t(buf, 21, rssi);
|
---|
| 161 |
|
---|
| 162 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
|
---|
| 163 | #else
|
---|
| 164 | mavlink_rc_channels_raw_t packet;
|
---|
| 165 | packet.time_boot_ms = time_boot_ms;
|
---|
| 166 | packet.chan1_raw = chan1_raw;
|
---|
| 167 | packet.chan2_raw = chan2_raw;
|
---|
| 168 | packet.chan3_raw = chan3_raw;
|
---|
| 169 | packet.chan4_raw = chan4_raw;
|
---|
| 170 | packet.chan5_raw = chan5_raw;
|
---|
| 171 | packet.chan6_raw = chan6_raw;
|
---|
| 172 | packet.chan7_raw = chan7_raw;
|
---|
| 173 | packet.chan8_raw = chan8_raw;
|
---|
| 174 | packet.port = port;
|
---|
| 175 | packet.rssi = rssi;
|
---|
| 176 |
|
---|
| 177 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
|
---|
| 178 | #endif
|
---|
| 179 |
|
---|
| 180 | msg->msgid = MAVLINK_MSG_ID_RC_CHANNELS_RAW;
|
---|
| 181 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | /**
|
---|
| 185 | * @brief Encode a rc_channels_raw struct
|
---|
| 186 | *
|
---|
| 187 | * @param system_id ID of this system
|
---|
| 188 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 189 | * @param msg The MAVLink message to compress the data into
|
---|
| 190 | * @param rc_channels_raw C-struct to read the message contents from
|
---|
| 191 | */
|
---|
| 192 | static inline uint16_t mavlink_msg_rc_channels_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_rc_channels_raw_t* rc_channels_raw)
|
---|
| 193 | {
|
---|
| 194 | return mavlink_msg_rc_channels_raw_pack(system_id, component_id, msg, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi);
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | /**
|
---|
| 198 | * @brief Encode a rc_channels_raw struct on a channel
|
---|
| 199 | *
|
---|
| 200 | * @param system_id ID of this system
|
---|
| 201 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 202 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 203 | * @param msg The MAVLink message to compress the data into
|
---|
| 204 | * @param rc_channels_raw C-struct to read the message contents from
|
---|
| 205 | */
|
---|
| 206 | static inline uint16_t mavlink_msg_rc_channels_raw_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_rc_channels_raw_t* rc_channels_raw)
|
---|
| 207 | {
|
---|
| 208 | return mavlink_msg_rc_channels_raw_pack_chan(system_id, component_id, chan, msg, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi);
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | /**
|
---|
| 212 | * @brief Send a rc_channels_raw message
|
---|
| 213 | * @param chan MAVLink channel to send the message
|
---|
| 214 | *
|
---|
| 215 | * @param time_boot_ms Timestamp (milliseconds since system boot)
|
---|
| 216 | * @param port Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
|
---|
| 217 | * @param chan1_raw RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 218 | * @param chan2_raw RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 219 | * @param chan3_raw RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 220 | * @param chan4_raw RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 221 | * @param chan5_raw RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 222 | * @param chan6_raw RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 223 | * @param chan7_raw RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 224 | * @param chan8_raw RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 225 | * @param rssi Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
|
---|
| 226 | */
|
---|
| 227 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 228 |
|
---|
| 229 | static inline void mavlink_msg_rc_channels_raw_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
|
---|
| 230 | {
|
---|
| 231 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 232 | char buf[MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN];
|
---|
| 233 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 234 | _mav_put_uint16_t(buf, 4, chan1_raw);
|
---|
| 235 | _mav_put_uint16_t(buf, 6, chan2_raw);
|
---|
| 236 | _mav_put_uint16_t(buf, 8, chan3_raw);
|
---|
| 237 | _mav_put_uint16_t(buf, 10, chan4_raw);
|
---|
| 238 | _mav_put_uint16_t(buf, 12, chan5_raw);
|
---|
| 239 | _mav_put_uint16_t(buf, 14, chan6_raw);
|
---|
| 240 | _mav_put_uint16_t(buf, 16, chan7_raw);
|
---|
| 241 | _mav_put_uint16_t(buf, 18, chan8_raw);
|
---|
| 242 | _mav_put_uint8_t(buf, 20, port);
|
---|
| 243 | _mav_put_uint8_t(buf, 21, rssi);
|
---|
| 244 |
|
---|
| 245 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 246 | #else
|
---|
| 247 | mavlink_rc_channels_raw_t packet;
|
---|
| 248 | packet.time_boot_ms = time_boot_ms;
|
---|
| 249 | packet.chan1_raw = chan1_raw;
|
---|
| 250 | packet.chan2_raw = chan2_raw;
|
---|
| 251 | packet.chan3_raw = chan3_raw;
|
---|
| 252 | packet.chan4_raw = chan4_raw;
|
---|
| 253 | packet.chan5_raw = chan5_raw;
|
---|
| 254 | packet.chan6_raw = chan6_raw;
|
---|
| 255 | packet.chan7_raw = chan7_raw;
|
---|
| 256 | packet.chan8_raw = chan8_raw;
|
---|
| 257 | packet.port = port;
|
---|
| 258 | packet.rssi = rssi;
|
---|
| 259 |
|
---|
| 260 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)&packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 261 | #endif
|
---|
| 262 | }
|
---|
| 263 |
|
---|
| 264 | /**
|
---|
| 265 | * @brief Send a rc_channels_raw message
|
---|
| 266 | * @param chan MAVLink channel to send the message
|
---|
| 267 | * @param struct The MAVLink struct to serialize
|
---|
| 268 | */
|
---|
| 269 | static inline void mavlink_msg_rc_channels_raw_send_struct(mavlink_channel_t chan, const mavlink_rc_channels_raw_t* rc_channels_raw)
|
---|
| 270 | {
|
---|
| 271 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 272 | mavlink_msg_rc_channels_raw_send(chan, rc_channels_raw->time_boot_ms, rc_channels_raw->port, rc_channels_raw->chan1_raw, rc_channels_raw->chan2_raw, rc_channels_raw->chan3_raw, rc_channels_raw->chan4_raw, rc_channels_raw->chan5_raw, rc_channels_raw->chan6_raw, rc_channels_raw->chan7_raw, rc_channels_raw->chan8_raw, rc_channels_raw->rssi);
|
---|
| 273 | #else
|
---|
| 274 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)rc_channels_raw, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 275 | #endif
|
---|
| 276 | }
|
---|
| 277 |
|
---|
| 278 | #if MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 279 | /*
|
---|
| 280 | This varient of _send() can be used to save stack space by re-using
|
---|
| 281 | memory from the receive buffer. The caller provides a
|
---|
| 282 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 283 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 284 | incoming message with minimum stack space usage.
|
---|
| 285 | */
|
---|
| 286 | static inline void mavlink_msg_rc_channels_raw_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port, uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw, uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw, uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
|
---|
| 287 | {
|
---|
| 288 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 289 | char *buf = (char *)msgbuf;
|
---|
| 290 | _mav_put_uint32_t(buf, 0, time_boot_ms);
|
---|
| 291 | _mav_put_uint16_t(buf, 4, chan1_raw);
|
---|
| 292 | _mav_put_uint16_t(buf, 6, chan2_raw);
|
---|
| 293 | _mav_put_uint16_t(buf, 8, chan3_raw);
|
---|
| 294 | _mav_put_uint16_t(buf, 10, chan4_raw);
|
---|
| 295 | _mav_put_uint16_t(buf, 12, chan5_raw);
|
---|
| 296 | _mav_put_uint16_t(buf, 14, chan6_raw);
|
---|
| 297 | _mav_put_uint16_t(buf, 16, chan7_raw);
|
---|
| 298 | _mav_put_uint16_t(buf, 18, chan8_raw);
|
---|
| 299 | _mav_put_uint8_t(buf, 20, port);
|
---|
| 300 | _mav_put_uint8_t(buf, 21, rssi);
|
---|
| 301 |
|
---|
| 302 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, buf, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 303 | #else
|
---|
| 304 | mavlink_rc_channels_raw_t *packet = (mavlink_rc_channels_raw_t *)msgbuf;
|
---|
| 305 | packet->time_boot_ms = time_boot_ms;
|
---|
| 306 | packet->chan1_raw = chan1_raw;
|
---|
| 307 | packet->chan2_raw = chan2_raw;
|
---|
| 308 | packet->chan3_raw = chan3_raw;
|
---|
| 309 | packet->chan4_raw = chan4_raw;
|
---|
| 310 | packet->chan5_raw = chan5_raw;
|
---|
| 311 | packet->chan6_raw = chan6_raw;
|
---|
| 312 | packet->chan7_raw = chan7_raw;
|
---|
| 313 | packet->chan8_raw = chan8_raw;
|
---|
| 314 | packet->port = port;
|
---|
| 315 | packet->rssi = rssi;
|
---|
| 316 |
|
---|
| 317 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RC_CHANNELS_RAW, (const char *)packet, MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN, MAVLINK_MSG_ID_RC_CHANNELS_RAW_CRC);
|
---|
| 318 | #endif
|
---|
| 319 | }
|
---|
| 320 | #endif
|
---|
| 321 |
|
---|
| 322 | #endif
|
---|
| 323 |
|
---|
| 324 | // MESSAGE RC_CHANNELS_RAW UNPACKING
|
---|
| 325 |
|
---|
| 326 |
|
---|
| 327 | /**
|
---|
| 328 | * @brief Get field time_boot_ms from rc_channels_raw message
|
---|
| 329 | *
|
---|
| 330 | * @return Timestamp (milliseconds since system boot)
|
---|
| 331 | */
|
---|
| 332 | static inline uint32_t mavlink_msg_rc_channels_raw_get_time_boot_ms(const mavlink_message_t* msg)
|
---|
| 333 | {
|
---|
| 334 | return _MAV_RETURN_uint32_t(msg, 0);
|
---|
| 335 | }
|
---|
| 336 |
|
---|
| 337 | /**
|
---|
| 338 | * @brief Get field port from rc_channels_raw message
|
---|
| 339 | *
|
---|
| 340 | * @return Servo output port (set of 8 outputs = 1 port). Most MAVs will just use one, but this allows for more than 8 servos.
|
---|
| 341 | */
|
---|
| 342 | static inline uint8_t mavlink_msg_rc_channels_raw_get_port(const mavlink_message_t* msg)
|
---|
| 343 | {
|
---|
| 344 | return _MAV_RETURN_uint8_t(msg, 20);
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | /**
|
---|
| 348 | * @brief Get field chan1_raw from rc_channels_raw message
|
---|
| 349 | *
|
---|
| 350 | * @return RC channel 1 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 351 | */
|
---|
| 352 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan1_raw(const mavlink_message_t* msg)
|
---|
| 353 | {
|
---|
| 354 | return _MAV_RETURN_uint16_t(msg, 4);
|
---|
| 355 | }
|
---|
| 356 |
|
---|
| 357 | /**
|
---|
| 358 | * @brief Get field chan2_raw from rc_channels_raw message
|
---|
| 359 | *
|
---|
| 360 | * @return RC channel 2 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 361 | */
|
---|
| 362 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan2_raw(const mavlink_message_t* msg)
|
---|
| 363 | {
|
---|
| 364 | return _MAV_RETURN_uint16_t(msg, 6);
|
---|
| 365 | }
|
---|
| 366 |
|
---|
| 367 | /**
|
---|
| 368 | * @brief Get field chan3_raw from rc_channels_raw message
|
---|
| 369 | *
|
---|
| 370 | * @return RC channel 3 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 371 | */
|
---|
| 372 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan3_raw(const mavlink_message_t* msg)
|
---|
| 373 | {
|
---|
| 374 | return _MAV_RETURN_uint16_t(msg, 8);
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 | /**
|
---|
| 378 | * @brief Get field chan4_raw from rc_channels_raw message
|
---|
| 379 | *
|
---|
| 380 | * @return RC channel 4 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 381 | */
|
---|
| 382 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan4_raw(const mavlink_message_t* msg)
|
---|
| 383 | {
|
---|
| 384 | return _MAV_RETURN_uint16_t(msg, 10);
|
---|
| 385 | }
|
---|
| 386 |
|
---|
| 387 | /**
|
---|
| 388 | * @brief Get field chan5_raw from rc_channels_raw message
|
---|
| 389 | *
|
---|
| 390 | * @return RC channel 5 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 391 | */
|
---|
| 392 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan5_raw(const mavlink_message_t* msg)
|
---|
| 393 | {
|
---|
| 394 | return _MAV_RETURN_uint16_t(msg, 12);
|
---|
| 395 | }
|
---|
| 396 |
|
---|
| 397 | /**
|
---|
| 398 | * @brief Get field chan6_raw from rc_channels_raw message
|
---|
| 399 | *
|
---|
| 400 | * @return RC channel 6 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 401 | */
|
---|
| 402 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan6_raw(const mavlink_message_t* msg)
|
---|
| 403 | {
|
---|
| 404 | return _MAV_RETURN_uint16_t(msg, 14);
|
---|
| 405 | }
|
---|
| 406 |
|
---|
| 407 | /**
|
---|
| 408 | * @brief Get field chan7_raw from rc_channels_raw message
|
---|
| 409 | *
|
---|
| 410 | * @return RC channel 7 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 411 | */
|
---|
| 412 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan7_raw(const mavlink_message_t* msg)
|
---|
| 413 | {
|
---|
| 414 | return _MAV_RETURN_uint16_t(msg, 16);
|
---|
| 415 | }
|
---|
| 416 |
|
---|
| 417 | /**
|
---|
| 418 | * @brief Get field chan8_raw from rc_channels_raw message
|
---|
| 419 | *
|
---|
| 420 | * @return RC channel 8 value, in microseconds. A value of UINT16_MAX implies the channel is unused.
|
---|
| 421 | */
|
---|
| 422 | static inline uint16_t mavlink_msg_rc_channels_raw_get_chan8_raw(const mavlink_message_t* msg)
|
---|
| 423 | {
|
---|
| 424 | return _MAV_RETURN_uint16_t(msg, 18);
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | /**
|
---|
| 428 | * @brief Get field rssi from rc_channels_raw message
|
---|
| 429 | *
|
---|
| 430 | * @return Receive signal strength indicator, 0: 0%, 100: 100%, 255: invalid/unknown.
|
---|
| 431 | */
|
---|
| 432 | static inline uint8_t mavlink_msg_rc_channels_raw_get_rssi(const mavlink_message_t* msg)
|
---|
| 433 | {
|
---|
| 434 | return _MAV_RETURN_uint8_t(msg, 21);
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 | /**
|
---|
| 438 | * @brief Decode a rc_channels_raw message into a struct
|
---|
| 439 | *
|
---|
| 440 | * @param msg The message to decode
|
---|
| 441 | * @param rc_channels_raw C-struct to decode the message contents into
|
---|
| 442 | */
|
---|
| 443 | static inline void mavlink_msg_rc_channels_raw_decode(const mavlink_message_t* msg, mavlink_rc_channels_raw_t* rc_channels_raw)
|
---|
| 444 | {
|
---|
| 445 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 446 | rc_channels_raw->time_boot_ms = mavlink_msg_rc_channels_raw_get_time_boot_ms(msg);
|
---|
| 447 | rc_channels_raw->chan1_raw = mavlink_msg_rc_channels_raw_get_chan1_raw(msg);
|
---|
| 448 | rc_channels_raw->chan2_raw = mavlink_msg_rc_channels_raw_get_chan2_raw(msg);
|
---|
| 449 | rc_channels_raw->chan3_raw = mavlink_msg_rc_channels_raw_get_chan3_raw(msg);
|
---|
| 450 | rc_channels_raw->chan4_raw = mavlink_msg_rc_channels_raw_get_chan4_raw(msg);
|
---|
| 451 | rc_channels_raw->chan5_raw = mavlink_msg_rc_channels_raw_get_chan5_raw(msg);
|
---|
| 452 | rc_channels_raw->chan6_raw = mavlink_msg_rc_channels_raw_get_chan6_raw(msg);
|
---|
| 453 | rc_channels_raw->chan7_raw = mavlink_msg_rc_channels_raw_get_chan7_raw(msg);
|
---|
| 454 | rc_channels_raw->chan8_raw = mavlink_msg_rc_channels_raw_get_chan8_raw(msg);
|
---|
| 455 | rc_channels_raw->port = mavlink_msg_rc_channels_raw_get_port(msg);
|
---|
| 456 | rc_channels_raw->rssi = mavlink_msg_rc_channels_raw_get_rssi(msg);
|
---|
| 457 | #else
|
---|
| 458 | uint8_t len = msg->len < MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN? msg->len : MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN;
|
---|
| 459 | memset(rc_channels_raw, 0, MAVLINK_MSG_ID_RC_CHANNELS_RAW_LEN);
|
---|
| 460 | memcpy(rc_channels_raw, _MAV_PAYLOAD(msg), len);
|
---|
| 461 | #endif
|
---|
| 462 | }
|
---|