Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE LLC_OUT PACKING
2
 
3
#define MAVLINK_MSG_ID_LLC_OUT 186
4
 
5
typedef struct __mavlink_llc_out_t
6
{
7
 int16_t servoOut[4]; ///< Servo signal
8
 int16_t MotorOut[2]; ///< motor signal
9
} mavlink_llc_out_t;
10
 
11
#define MAVLINK_MSG_ID_LLC_OUT_LEN 12
12
#define MAVLINK_MSG_ID_186_LEN 12
13
 
14
#define MAVLINK_MSG_LLC_OUT_FIELD_SERVOOUT_LEN 4
15
#define MAVLINK_MSG_LLC_OUT_FIELD_MOTOROUT_LEN 2
16
 
17
#define MAVLINK_MESSAGE_INFO_LLC_OUT { \
18
        "LLC_OUT", \
19
        2, \
20
        {  { "servoOut", NULL, MAVLINK_TYPE_INT16_T, 4, 0, offsetof(mavlink_llc_out_t, servoOut) }, \
21
         { "MotorOut", NULL, MAVLINK_TYPE_INT16_T, 2, 8, offsetof(mavlink_llc_out_t, MotorOut) }, \
22
         } \
23
}
24
 
25
 
26
/**
27
 * @brief Pack a llc_out message
28
 * @param system_id ID of this system
29
 * @param component_id ID of this component (e.g. 200 for IMU)
30
 * @param msg The MAVLink message to compress the data into
31
 *
32
 * @param servoOut Servo signal
33
 * @param MotorOut motor signal
34
 * @return length of the message in bytes (excluding serial stream start sign)
35
 */
36
static inline uint16_t mavlink_msg_llc_out_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
37
                                                       const int16_t *servoOut, const int16_t *MotorOut)
38
{
39
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
40
        char buf[12];
41
 
42
        _mav_put_int16_t_array(buf, 0, servoOut, 4);
43
        _mav_put_int16_t_array(buf, 8, MotorOut, 2);
44
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 12);
45
#else
46
        mavlink_llc_out_t packet;
47
 
48
        mav_array_memcpy(packet.servoOut, servoOut, sizeof(int16_t)*4);
49
        mav_array_memcpy(packet.MotorOut, MotorOut, sizeof(int16_t)*2);
50
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 12);
51
#endif
52
 
53
        msg->msgid = MAVLINK_MSG_ID_LLC_OUT;
54
        return mavlink_finalize_message(msg, system_id, component_id, 12, 5);
55
}
56
 
57
/**
58
 * @brief Pack a llc_out message on a channel
59
 * @param system_id ID of this system
60
 * @param component_id ID of this component (e.g. 200 for IMU)
61
 * @param chan The MAVLink channel this message was sent over
62
 * @param msg The MAVLink message to compress the data into
63
 * @param servoOut Servo signal
64
 * @param MotorOut motor signal
65
 * @return length of the message in bytes (excluding serial stream start sign)
66
 */
67
static inline uint16_t mavlink_msg_llc_out_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
68
                                                           mavlink_message_t* msg,
69
                                                           const int16_t *servoOut,const int16_t *MotorOut)
70
{
71
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
72
        char buf[12];
73
 
74
        _mav_put_int16_t_array(buf, 0, servoOut, 4);
75
        _mav_put_int16_t_array(buf, 8, MotorOut, 2);
76
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 12);
77
#else
78
        mavlink_llc_out_t packet;
79
 
80
        mav_array_memcpy(packet.servoOut, servoOut, sizeof(int16_t)*4);
81
        mav_array_memcpy(packet.MotorOut, MotorOut, sizeof(int16_t)*2);
82
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 12);
83
#endif
84
 
85
        msg->msgid = MAVLINK_MSG_ID_LLC_OUT;
86
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 12, 5);
87
}
88
 
89
/**
90
 * @brief Encode a llc_out struct into a message
91
 *
92
 * @param system_id ID of this system
93
 * @param component_id ID of this component (e.g. 200 for IMU)
94
 * @param msg The MAVLink message to compress the data into
95
 * @param llc_out C-struct to read the message contents from
96
 */
97
static inline uint16_t mavlink_msg_llc_out_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_llc_out_t* llc_out)
98
{
99
        return mavlink_msg_llc_out_pack(system_id, component_id, msg, llc_out->servoOut, llc_out->MotorOut);
100
}
101
 
102
/**
103
 * @brief Send a llc_out message
104
 * @param chan MAVLink channel to send the message
105
 *
106
 * @param servoOut Servo signal
107
 * @param MotorOut motor signal
108
 */
109
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
110
 
111
static inline void mavlink_msg_llc_out_send(mavlink_channel_t chan, const int16_t *servoOut, const int16_t *MotorOut)
112
{
113
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
114
        char buf[12];
115
 
116
        _mav_put_int16_t_array(buf, 0, servoOut, 4);
117
        _mav_put_int16_t_array(buf, 8, MotorOut, 2);
118
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, buf, 12, 5);
119
#else
120
        mavlink_llc_out_t packet;
121
 
122
        mav_array_memcpy(packet.servoOut, servoOut, sizeof(int16_t)*4);
123
        mav_array_memcpy(packet.MotorOut, MotorOut, sizeof(int16_t)*2);
124
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LLC_OUT, (const char *)&packet, 12, 5);
125
#endif
126
}
127
 
128
#endif
129
 
130
// MESSAGE LLC_OUT UNPACKING
131
 
132
 
133
/**
134
 * @brief Get field servoOut from llc_out message
135
 *
136
 * @return Servo signal
137
 */
138
static inline uint16_t mavlink_msg_llc_out_get_servoOut(const mavlink_message_t* msg, int16_t *servoOut)
139
{
140
        return _MAV_RETURN_int16_t_array(msg, servoOut, 4,  0);
141
}
142
 
143
/**
144
 * @brief Get field MotorOut from llc_out message
145
 *
146
 * @return motor signal
147
 */
148
static inline uint16_t mavlink_msg_llc_out_get_MotorOut(const mavlink_message_t* msg, int16_t *MotorOut)
149
{
150
        return _MAV_RETURN_int16_t_array(msg, MotorOut, 2,  8);
151
}
152
 
153
/**
154
 * @brief Decode a llc_out message into a struct
155
 *
156
 * @param msg The message to decode
157
 * @param llc_out C-struct to decode the message contents into
158
 */
159
static inline void mavlink_msg_llc_out_decode(const mavlink_message_t* msg, mavlink_llc_out_t* llc_out)
160
{
161
#if MAVLINK_NEED_BYTE_SWAP
162
        mavlink_msg_llc_out_get_servoOut(msg, llc_out->servoOut);
163
        mavlink_msg_llc_out_get_MotorOut(msg, llc_out->MotorOut);
164
#else
165
        memcpy(llc_out, _MAV_PAYLOAD(msg), 12);
166
#endif
167
}