2019-03-09 06:12:13 +08:00
|
|
|
#pragma once
|
|
|
|
|
// MESSAGE XYK_CMD_RC_CHANNELS PACKING
|
|
|
|
|
|
|
|
|
|
#define MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS 30021
|
|
|
|
|
|
|
|
|
|
MAVPACKED(
|
|
|
|
|
typedef struct __mavlink_xyk_cmd_rc_channels_t {
|
2019-03-09 18:16:52 +08:00
|
|
|
int16_t chan_elevator; /*< RC chan_elevator,0.1%,-1000~1000*/
|
2019-03-09 06:12:13 +08:00
|
|
|
int16_t chan_rudder; /*< RC chan_rudder,0.1%,-1000~1000*/
|
2019-03-09 18:16:52 +08:00
|
|
|
int16_t chan_aileron; /*< RC chan_aileron,0.1%,-1000~1000*/
|
2019-03-09 06:12:13 +08:00
|
|
|
int16_t chan_throttle; /*< RC chan_throttle,0.1%,0~2000*/
|
|
|
|
|
uint8_t target_system; /*< PLANE ID*/
|
2019-03-09 18:16:52 +08:00
|
|
|
uint8_t target_component; /*< Component ID*/
|
2019-03-09 06:12:13 +08:00
|
|
|
uint8_t command_word; /*< command_word*/
|
|
|
|
|
uint8_t chan_onoff; /*< RC control word of on-off state ,bit0~bit3 corresponding to switch4~switch1,*/
|
|
|
|
|
uint8_t chan_keyword; /*< RC control word of keyword state ,bit0~bit3 corresponding to key4~key1*/
|
|
|
|
|
uint8_t chan_reserved; /*< RC channel reserved*/
|
|
|
|
|
uint8_t chan_reserved1; /*< RC channel reserved*/
|
|
|
|
|
uint8_t chan_reserved2; /*< RC channel reserved*/
|
|
|
|
|
}) mavlink_xyk_cmd_rc_channels_t;
|
|
|
|
|
|
|
|
|
|
#define MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN 16
|
|
|
|
|
#define MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN 16
|
|
|
|
|
#define MAVLINK_MSG_ID_30021_LEN 16
|
|
|
|
|
#define MAVLINK_MSG_ID_30021_MIN_LEN 16
|
|
|
|
|
|
2019-03-09 18:16:52 +08:00
|
|
|
#define MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC 197
|
|
|
|
|
#define MAVLINK_MSG_ID_30021_CRC 197
|
2019-03-09 06:12:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if MAVLINK_COMMAND_24BIT
|
|
|
|
|
#define MAVLINK_MESSAGE_INFO_XYK_CMD_RC_CHANNELS { \
|
|
|
|
|
30021, \
|
|
|
|
|
"XYK_CMD_RC_CHANNELS", \
|
|
|
|
|
12, \
|
|
|
|
|
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_xyk_cmd_rc_channels_t, target_system) }, \
|
2019-03-09 18:16:52 +08:00
|
|
|
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_xyk_cmd_rc_channels_t, target_component) }, \
|
2019-03-09 06:12:13 +08:00
|
|
|
{ "command_word", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_xyk_cmd_rc_channels_t, command_word) }, \
|
2019-03-09 18:16:52 +08:00
|
|
|
{ "chan_elevator", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_elevator) }, \
|
2019-03-09 06:12:13 +08:00
|
|
|
{ "chan_rudder", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_rudder) }, \
|
2019-03-09 18:16:52 +08:00
|
|
|
{ "chan_aileron", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_aileron) }, \
|
2019-03-09 06:12:13 +08:00
|
|
|
{ "chan_throttle", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_throttle) }, \
|
|
|
|
|
{ "chan_onoff", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_onoff) }, \
|
|
|
|
|
{ "chan_keyword", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_keyword) }, \
|
|
|
|
|
{ "chan_reserved", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_reserved) }, \
|
|
|
|
|
{ "chan_reserved1", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_reserved1) }, \
|
|
|
|
|
{ "chan_reserved2", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_reserved2) }, \
|
|
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
#define MAVLINK_MESSAGE_INFO_XYK_CMD_RC_CHANNELS { \
|
|
|
|
|
"XYK_CMD_RC_CHANNELS", \
|
|
|
|
|
12, \
|
|
|
|
|
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_xyk_cmd_rc_channels_t, target_system) }, \
|
2019-03-09 18:16:52 +08:00
|
|
|
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_xyk_cmd_rc_channels_t, target_component) }, \
|
2019-03-09 06:12:13 +08:00
|
|
|
{ "command_word", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_xyk_cmd_rc_channels_t, command_word) }, \
|
2019-03-09 18:16:52 +08:00
|
|
|
{ "chan_elevator", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_elevator) }, \
|
2019-03-09 06:12:13 +08:00
|
|
|
{ "chan_rudder", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_rudder) }, \
|
2019-03-09 18:16:52 +08:00
|
|
|
{ "chan_aileron", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_aileron) }, \
|
2019-03-09 06:12:13 +08:00
|
|
|
{ "chan_throttle", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_throttle) }, \
|
|
|
|
|
{ "chan_onoff", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_onoff) }, \
|
|
|
|
|
{ "chan_keyword", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_keyword) }, \
|
|
|
|
|
{ "chan_reserved", NULL, MAVLINK_TYPE_UINT8_T, 0, 13, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_reserved) }, \
|
|
|
|
|
{ "chan_reserved1", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_reserved1) }, \
|
|
|
|
|
{ "chan_reserved2", NULL, MAVLINK_TYPE_UINT8_T, 0, 15, offsetof(mavlink_xyk_cmd_rc_channels_t, chan_reserved2) }, \
|
|
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Pack a xyk_cmd_rc_channels message
|
|
|
|
|
* @param system_id ID of this system
|
|
|
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
|
|
|
|
* @param msg The MAVLink message to compress the data into
|
|
|
|
|
*
|
|
|
|
|
* @param target_system PLANE ID
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param target_component Component ID
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param command_word command_word
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param chan_elevator RC chan_elevator,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param chan_rudder RC chan_rudder,0.1%,-1000~1000
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param chan_aileron RC chan_aileron,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param chan_throttle RC chan_throttle,0.1%,0~2000
|
|
|
|
|
* @param chan_onoff RC control word of on-off state ,bit0~bit3 corresponding to switch4~switch1,
|
|
|
|
|
* @param chan_keyword RC control word of keyword state ,bit0~bit3 corresponding to key4~key1
|
|
|
|
|
* @param chan_reserved RC channel reserved
|
|
|
|
|
* @param chan_reserved1 RC channel reserved
|
|
|
|
|
* @param chan_reserved2 RC channel reserved
|
|
|
|
|
* @return length of the message in bytes (excluding serial stream start sign)
|
|
|
|
|
*/
|
|
|
|
|
static inline uint16_t mavlink_msg_xyk_cmd_rc_channels_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
2019-03-09 18:16:52 +08:00
|
|
|
uint8_t target_system, uint8_t target_component, uint8_t command_word, int16_t chan_elevator, int16_t chan_rudder, int16_t chan_aileron, int16_t chan_throttle, uint8_t chan_onoff, uint8_t chan_keyword, uint8_t chan_reserved, uint8_t chan_reserved1, uint8_t chan_reserved2)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
|
|
char buf[MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN];
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 0, chan_elevator);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 2, chan_rudder);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 4, chan_aileron);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 6, chan_throttle);
|
|
|
|
|
_mav_put_uint8_t(buf, 8, target_system);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_uint8_t(buf, 9, target_component);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_uint8_t(buf, 10, command_word);
|
|
|
|
|
_mav_put_uint8_t(buf, 11, chan_onoff);
|
|
|
|
|
_mav_put_uint8_t(buf, 12, chan_keyword);
|
|
|
|
|
_mav_put_uint8_t(buf, 13, chan_reserved);
|
|
|
|
|
_mav_put_uint8_t(buf, 14, chan_reserved1);
|
|
|
|
|
_mav_put_uint8_t(buf, 15, chan_reserved2);
|
|
|
|
|
|
|
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN);
|
|
|
|
|
#else
|
|
|
|
|
mavlink_xyk_cmd_rc_channels_t packet;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.chan_elevator = chan_elevator;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.chan_rudder = chan_rudder;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.chan_aileron = chan_aileron;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.chan_throttle = chan_throttle;
|
|
|
|
|
packet.target_system = target_system;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.target_component = target_component;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.command_word = command_word;
|
|
|
|
|
packet.chan_onoff = chan_onoff;
|
|
|
|
|
packet.chan_keyword = chan_keyword;
|
|
|
|
|
packet.chan_reserved = chan_reserved;
|
|
|
|
|
packet.chan_reserved1 = chan_reserved1;
|
|
|
|
|
packet.chan_reserved2 = chan_reserved2;
|
|
|
|
|
|
|
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
msg->msgid = MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS;
|
|
|
|
|
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Pack a xyk_cmd_rc_channels message on a channel
|
|
|
|
|
* @param system_id ID of this system
|
|
|
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
|
|
|
|
* @param chan The MAVLink channel this message will be sent over
|
|
|
|
|
* @param msg The MAVLink message to compress the data into
|
|
|
|
|
* @param target_system PLANE ID
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param target_component Component ID
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param command_word command_word
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param chan_elevator RC chan_elevator,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param chan_rudder RC chan_rudder,0.1%,-1000~1000
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param chan_aileron RC chan_aileron,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param chan_throttle RC chan_throttle,0.1%,0~2000
|
|
|
|
|
* @param chan_onoff RC control word of on-off state ,bit0~bit3 corresponding to switch4~switch1,
|
|
|
|
|
* @param chan_keyword RC control word of keyword state ,bit0~bit3 corresponding to key4~key1
|
|
|
|
|
* @param chan_reserved RC channel reserved
|
|
|
|
|
* @param chan_reserved1 RC channel reserved
|
|
|
|
|
* @param chan_reserved2 RC channel reserved
|
|
|
|
|
* @return length of the message in bytes (excluding serial stream start sign)
|
|
|
|
|
*/
|
|
|
|
|
static inline uint16_t mavlink_msg_xyk_cmd_rc_channels_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
|
|
|
|
mavlink_message_t* msg,
|
2019-03-09 18:16:52 +08:00
|
|
|
uint8_t target_system,uint8_t target_component,uint8_t command_word,int16_t chan_elevator,int16_t chan_rudder,int16_t chan_aileron,int16_t chan_throttle,uint8_t chan_onoff,uint8_t chan_keyword,uint8_t chan_reserved,uint8_t chan_reserved1,uint8_t chan_reserved2)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
|
|
char buf[MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN];
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 0, chan_elevator);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 2, chan_rudder);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 4, chan_aileron);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 6, chan_throttle);
|
|
|
|
|
_mav_put_uint8_t(buf, 8, target_system);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_uint8_t(buf, 9, target_component);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_uint8_t(buf, 10, command_word);
|
|
|
|
|
_mav_put_uint8_t(buf, 11, chan_onoff);
|
|
|
|
|
_mav_put_uint8_t(buf, 12, chan_keyword);
|
|
|
|
|
_mav_put_uint8_t(buf, 13, chan_reserved);
|
|
|
|
|
_mav_put_uint8_t(buf, 14, chan_reserved1);
|
|
|
|
|
_mav_put_uint8_t(buf, 15, chan_reserved2);
|
|
|
|
|
|
|
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN);
|
|
|
|
|
#else
|
|
|
|
|
mavlink_xyk_cmd_rc_channels_t packet;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.chan_elevator = chan_elevator;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.chan_rudder = chan_rudder;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.chan_aileron = chan_aileron;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.chan_throttle = chan_throttle;
|
|
|
|
|
packet.target_system = target_system;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.target_component = target_component;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.command_word = command_word;
|
|
|
|
|
packet.chan_onoff = chan_onoff;
|
|
|
|
|
packet.chan_keyword = chan_keyword;
|
|
|
|
|
packet.chan_reserved = chan_reserved;
|
|
|
|
|
packet.chan_reserved1 = chan_reserved1;
|
|
|
|
|
packet.chan_reserved2 = chan_reserved2;
|
|
|
|
|
|
|
|
|
|
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
msg->msgid = MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS;
|
|
|
|
|
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Encode a xyk_cmd_rc_channels struct
|
|
|
|
|
*
|
|
|
|
|
* @param system_id ID of this system
|
|
|
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
|
|
|
|
* @param msg The MAVLink message to compress the data into
|
|
|
|
|
* @param xyk_cmd_rc_channels C-struct to read the message contents from
|
|
|
|
|
*/
|
|
|
|
|
static inline uint16_t mavlink_msg_xyk_cmd_rc_channels_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_xyk_cmd_rc_channels_t* xyk_cmd_rc_channels)
|
|
|
|
|
{
|
2019-03-09 18:16:52 +08:00
|
|
|
return mavlink_msg_xyk_cmd_rc_channels_pack(system_id, component_id, msg, xyk_cmd_rc_channels->target_system, xyk_cmd_rc_channels->target_component, xyk_cmd_rc_channels->command_word, xyk_cmd_rc_channels->chan_elevator, xyk_cmd_rc_channels->chan_rudder, xyk_cmd_rc_channels->chan_aileron, xyk_cmd_rc_channels->chan_throttle, xyk_cmd_rc_channels->chan_onoff, xyk_cmd_rc_channels->chan_keyword, xyk_cmd_rc_channels->chan_reserved, xyk_cmd_rc_channels->chan_reserved1, xyk_cmd_rc_channels->chan_reserved2);
|
2019-03-09 06:12:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Encode a xyk_cmd_rc_channels struct on a channel
|
|
|
|
|
*
|
|
|
|
|
* @param system_id ID of this system
|
|
|
|
|
* @param component_id ID of this component (e.g. 200 for IMU)
|
|
|
|
|
* @param chan The MAVLink channel this message will be sent over
|
|
|
|
|
* @param msg The MAVLink message to compress the data into
|
|
|
|
|
* @param xyk_cmd_rc_channels C-struct to read the message contents from
|
|
|
|
|
*/
|
|
|
|
|
static inline uint16_t mavlink_msg_xyk_cmd_rc_channels_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_xyk_cmd_rc_channels_t* xyk_cmd_rc_channels)
|
|
|
|
|
{
|
2019-03-09 18:16:52 +08:00
|
|
|
return mavlink_msg_xyk_cmd_rc_channels_pack_chan(system_id, component_id, chan, msg, xyk_cmd_rc_channels->target_system, xyk_cmd_rc_channels->target_component, xyk_cmd_rc_channels->command_word, xyk_cmd_rc_channels->chan_elevator, xyk_cmd_rc_channels->chan_rudder, xyk_cmd_rc_channels->chan_aileron, xyk_cmd_rc_channels->chan_throttle, xyk_cmd_rc_channels->chan_onoff, xyk_cmd_rc_channels->chan_keyword, xyk_cmd_rc_channels->chan_reserved, xyk_cmd_rc_channels->chan_reserved1, xyk_cmd_rc_channels->chan_reserved2);
|
2019-03-09 06:12:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Send a xyk_cmd_rc_channels message
|
|
|
|
|
* @param chan MAVLink channel to send the message
|
|
|
|
|
*
|
|
|
|
|
* @param target_system PLANE ID
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param target_component Component ID
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param command_word command_word
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param chan_elevator RC chan_elevator,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param chan_rudder RC chan_rudder,0.1%,-1000~1000
|
2019-03-09 18:16:52 +08:00
|
|
|
* @param chan_aileron RC chan_aileron,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
* @param chan_throttle RC chan_throttle,0.1%,0~2000
|
|
|
|
|
* @param chan_onoff RC control word of on-off state ,bit0~bit3 corresponding to switch4~switch1,
|
|
|
|
|
* @param chan_keyword RC control word of keyword state ,bit0~bit3 corresponding to key4~key1
|
|
|
|
|
* @param chan_reserved RC channel reserved
|
|
|
|
|
* @param chan_reserved1 RC channel reserved
|
|
|
|
|
* @param chan_reserved2 RC channel reserved
|
|
|
|
|
*/
|
|
|
|
|
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
|
|
|
|
|
2019-03-09 18:16:52 +08:00
|
|
|
static inline void mavlink_msg_xyk_cmd_rc_channels_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command_word, int16_t chan_elevator, int16_t chan_rudder, int16_t chan_aileron, int16_t chan_throttle, uint8_t chan_onoff, uint8_t chan_keyword, uint8_t chan_reserved, uint8_t chan_reserved1, uint8_t chan_reserved2)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
|
|
char buf[MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN];
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 0, chan_elevator);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 2, chan_rudder);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 4, chan_aileron);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 6, chan_throttle);
|
|
|
|
|
_mav_put_uint8_t(buf, 8, target_system);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_uint8_t(buf, 9, target_component);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_uint8_t(buf, 10, command_word);
|
|
|
|
|
_mav_put_uint8_t(buf, 11, chan_onoff);
|
|
|
|
|
_mav_put_uint8_t(buf, 12, chan_keyword);
|
|
|
|
|
_mav_put_uint8_t(buf, 13, chan_reserved);
|
|
|
|
|
_mav_put_uint8_t(buf, 14, chan_reserved1);
|
|
|
|
|
_mav_put_uint8_t(buf, 15, chan_reserved2);
|
|
|
|
|
|
|
|
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS, buf, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
#else
|
|
|
|
|
mavlink_xyk_cmd_rc_channels_t packet;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.chan_elevator = chan_elevator;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.chan_rudder = chan_rudder;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.chan_aileron = chan_aileron;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.chan_throttle = chan_throttle;
|
|
|
|
|
packet.target_system = target_system;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet.target_component = target_component;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet.command_word = command_word;
|
|
|
|
|
packet.chan_onoff = chan_onoff;
|
|
|
|
|
packet.chan_keyword = chan_keyword;
|
|
|
|
|
packet.chan_reserved = chan_reserved;
|
|
|
|
|
packet.chan_reserved1 = chan_reserved1;
|
|
|
|
|
packet.chan_reserved2 = chan_reserved2;
|
|
|
|
|
|
|
|
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS, (const char *)&packet, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Send a xyk_cmd_rc_channels message
|
|
|
|
|
* @param chan MAVLink channel to send the message
|
|
|
|
|
* @param struct The MAVLink struct to serialize
|
|
|
|
|
*/
|
|
|
|
|
static inline void mavlink_msg_xyk_cmd_rc_channels_send_struct(mavlink_channel_t chan, const mavlink_xyk_cmd_rc_channels_t* xyk_cmd_rc_channels)
|
|
|
|
|
{
|
|
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
2019-03-09 18:16:52 +08:00
|
|
|
mavlink_msg_xyk_cmd_rc_channels_send(chan, xyk_cmd_rc_channels->target_system, xyk_cmd_rc_channels->target_component, xyk_cmd_rc_channels->command_word, xyk_cmd_rc_channels->chan_elevator, xyk_cmd_rc_channels->chan_rudder, xyk_cmd_rc_channels->chan_aileron, xyk_cmd_rc_channels->chan_throttle, xyk_cmd_rc_channels->chan_onoff, xyk_cmd_rc_channels->chan_keyword, xyk_cmd_rc_channels->chan_reserved, xyk_cmd_rc_channels->chan_reserved1, xyk_cmd_rc_channels->chan_reserved2);
|
2019-03-09 06:12:13 +08:00
|
|
|
#else
|
|
|
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS, (const char *)xyk_cmd_rc_channels, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
|
|
|
|
/*
|
|
|
|
|
This varient of _send() can be used to save stack space by re-using
|
|
|
|
|
memory from the receive buffer. The caller provides a
|
|
|
|
|
mavlink_message_t which is the size of a full mavlink message. This
|
|
|
|
|
is usually the receive buffer for the channel, and allows a reply to an
|
|
|
|
|
incoming message with minimum stack space usage.
|
|
|
|
|
*/
|
2019-03-09 18:16:52 +08:00
|
|
|
static inline void mavlink_msg_xyk_cmd_rc_channels_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command_word, int16_t chan_elevator, int16_t chan_rudder, int16_t chan_aileron, int16_t chan_throttle, uint8_t chan_onoff, uint8_t chan_keyword, uint8_t chan_reserved, uint8_t chan_reserved1, uint8_t chan_reserved2)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
|
|
|
|
char *buf = (char *)msgbuf;
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 0, chan_elevator);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 2, chan_rudder);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_int16_t(buf, 4, chan_aileron);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_int16_t(buf, 6, chan_throttle);
|
|
|
|
|
_mav_put_uint8_t(buf, 8, target_system);
|
2019-03-09 18:16:52 +08:00
|
|
|
_mav_put_uint8_t(buf, 9, target_component);
|
2019-03-09 06:12:13 +08:00
|
|
|
_mav_put_uint8_t(buf, 10, command_word);
|
|
|
|
|
_mav_put_uint8_t(buf, 11, chan_onoff);
|
|
|
|
|
_mav_put_uint8_t(buf, 12, chan_keyword);
|
|
|
|
|
_mav_put_uint8_t(buf, 13, chan_reserved);
|
|
|
|
|
_mav_put_uint8_t(buf, 14, chan_reserved1);
|
|
|
|
|
_mav_put_uint8_t(buf, 15, chan_reserved2);
|
|
|
|
|
|
|
|
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS, buf, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
#else
|
|
|
|
|
mavlink_xyk_cmd_rc_channels_t *packet = (mavlink_xyk_cmd_rc_channels_t *)msgbuf;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet->chan_elevator = chan_elevator;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet->chan_rudder = chan_rudder;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet->chan_aileron = chan_aileron;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet->chan_throttle = chan_throttle;
|
|
|
|
|
packet->target_system = target_system;
|
2019-03-09 18:16:52 +08:00
|
|
|
packet->target_component = target_component;
|
2019-03-09 06:12:13 +08:00
|
|
|
packet->command_word = command_word;
|
|
|
|
|
packet->chan_onoff = chan_onoff;
|
|
|
|
|
packet->chan_keyword = chan_keyword;
|
|
|
|
|
packet->chan_reserved = chan_reserved;
|
|
|
|
|
packet->chan_reserved1 = chan_reserved1;
|
|
|
|
|
packet->chan_reserved2 = chan_reserved2;
|
|
|
|
|
|
|
|
|
|
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS, (const char *)packet, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_MIN_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_CRC);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// MESSAGE XYK_CMD_RC_CHANNELS UNPACKING
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field target_system from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return PLANE ID
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_target_system(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 8);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-03-09 18:16:52 +08:00
|
|
|
* @brief Get field target_component from xyk_cmd_rc_channels message
|
2019-03-09 06:12:13 +08:00
|
|
|
*
|
|
|
|
|
* @return Component ID
|
|
|
|
|
*/
|
2019-03-09 18:16:52 +08:00
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_target_component(const mavlink_message_t* msg)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 9);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field command_word from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return command_word
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_command_word(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-03-09 18:16:52 +08:00
|
|
|
* @brief Get field chan_elevator from xyk_cmd_rc_channels message
|
2019-03-09 06:12:13 +08:00
|
|
|
*
|
2019-03-09 18:16:52 +08:00
|
|
|
* @return RC chan_elevator,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
*/
|
2019-03-09 18:16:52 +08:00
|
|
|
static inline int16_t mavlink_msg_xyk_cmd_rc_channels_get_chan_elevator(const mavlink_message_t* msg)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_int16_t(msg, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_rudder from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC chan_rudder,0.1%,-1000~1000
|
|
|
|
|
*/
|
|
|
|
|
static inline int16_t mavlink_msg_xyk_cmd_rc_channels_get_chan_rudder(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_int16_t(msg, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-03-09 18:16:52 +08:00
|
|
|
* @brief Get field chan_aileron from xyk_cmd_rc_channels message
|
2019-03-09 06:12:13 +08:00
|
|
|
*
|
2019-03-09 18:16:52 +08:00
|
|
|
* @return RC chan_aileron,0.1%,-1000~1000
|
2019-03-09 06:12:13 +08:00
|
|
|
*/
|
2019-03-09 18:16:52 +08:00
|
|
|
static inline int16_t mavlink_msg_xyk_cmd_rc_channels_get_chan_aileron(const mavlink_message_t* msg)
|
2019-03-09 06:12:13 +08:00
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_int16_t(msg, 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_throttle from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC chan_throttle,0.1%,0~2000
|
|
|
|
|
*/
|
|
|
|
|
static inline int16_t mavlink_msg_xyk_cmd_rc_channels_get_chan_throttle(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_int16_t(msg, 6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_onoff from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC control word of on-off state ,bit0~bit3 corresponding to switch4~switch1,
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_chan_onoff(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 11);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_keyword from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC control word of keyword state ,bit0~bit3 corresponding to key4~key1
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_chan_keyword(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 12);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_reserved from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC channel reserved
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_chan_reserved(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 13);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_reserved1 from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC channel reserved
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_chan_reserved1(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get field chan_reserved2 from xyk_cmd_rc_channels message
|
|
|
|
|
*
|
|
|
|
|
* @return RC channel reserved
|
|
|
|
|
*/
|
|
|
|
|
static inline uint8_t mavlink_msg_xyk_cmd_rc_channels_get_chan_reserved2(const mavlink_message_t* msg)
|
|
|
|
|
{
|
|
|
|
|
return _MAV_RETURN_uint8_t(msg, 15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Decode a xyk_cmd_rc_channels message into a struct
|
|
|
|
|
*
|
|
|
|
|
* @param msg The message to decode
|
|
|
|
|
* @param xyk_cmd_rc_channels C-struct to decode the message contents into
|
|
|
|
|
*/
|
|
|
|
|
static inline void mavlink_msg_xyk_cmd_rc_channels_decode(const mavlink_message_t* msg, mavlink_xyk_cmd_rc_channels_t* xyk_cmd_rc_channels)
|
|
|
|
|
{
|
|
|
|
|
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
2019-03-09 18:16:52 +08:00
|
|
|
xyk_cmd_rc_channels->chan_elevator = mavlink_msg_xyk_cmd_rc_channels_get_chan_elevator(msg);
|
2019-03-09 06:12:13 +08:00
|
|
|
xyk_cmd_rc_channels->chan_rudder = mavlink_msg_xyk_cmd_rc_channels_get_chan_rudder(msg);
|
2019-03-09 18:16:52 +08:00
|
|
|
xyk_cmd_rc_channels->chan_aileron = mavlink_msg_xyk_cmd_rc_channels_get_chan_aileron(msg);
|
2019-03-09 06:12:13 +08:00
|
|
|
xyk_cmd_rc_channels->chan_throttle = mavlink_msg_xyk_cmd_rc_channels_get_chan_throttle(msg);
|
|
|
|
|
xyk_cmd_rc_channels->target_system = mavlink_msg_xyk_cmd_rc_channels_get_target_system(msg);
|
2019-03-09 18:16:52 +08:00
|
|
|
xyk_cmd_rc_channels->target_component = mavlink_msg_xyk_cmd_rc_channels_get_target_component(msg);
|
2019-03-09 06:12:13 +08:00
|
|
|
xyk_cmd_rc_channels->command_word = mavlink_msg_xyk_cmd_rc_channels_get_command_word(msg);
|
|
|
|
|
xyk_cmd_rc_channels->chan_onoff = mavlink_msg_xyk_cmd_rc_channels_get_chan_onoff(msg);
|
|
|
|
|
xyk_cmd_rc_channels->chan_keyword = mavlink_msg_xyk_cmd_rc_channels_get_chan_keyword(msg);
|
|
|
|
|
xyk_cmd_rc_channels->chan_reserved = mavlink_msg_xyk_cmd_rc_channels_get_chan_reserved(msg);
|
|
|
|
|
xyk_cmd_rc_channels->chan_reserved1 = mavlink_msg_xyk_cmd_rc_channels_get_chan_reserved1(msg);
|
|
|
|
|
xyk_cmd_rc_channels->chan_reserved2 = mavlink_msg_xyk_cmd_rc_channels_get_chan_reserved2(msg);
|
|
|
|
|
#else
|
|
|
|
|
uint8_t len = msg->len < MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN? msg->len : MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN;
|
|
|
|
|
memset(xyk_cmd_rc_channels, 0, MAVLINK_MSG_ID_XYK_CMD_RC_CHANNELS_LEN);
|
|
|
|
|
memcpy(xyk_cmd_rc_channels, _MAV_PAYLOAD(msg), len);
|
|
|
|
|
#endif
|
|
|
|
|
}
|