Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_memory_vect.h
blob3be09546c71557a185f12c6cc8027d99216c38b6
1 // MESSAGE MEMORY_VECT PACKING
3 #define MAVLINK_MSG_ID_MEMORY_VECT 249
5 typedef struct __mavlink_memory_vect_t {
6 uint16_t address; ///< Starting address of the debug variables
7 uint8_t ver; ///< Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
8 uint8_t type; ///< Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14
9 int8_t value[32]; ///< Memory contents at specified address
10 } mavlink_memory_vect_t;
12 #define MAVLINK_MSG_ID_MEMORY_VECT_LEN 36
13 #define MAVLINK_MSG_ID_249_LEN 36
15 #define MAVLINK_MSG_MEMORY_VECT_FIELD_VALUE_LEN 32
17 #define MAVLINK_MESSAGE_INFO_MEMORY_VECT \
18 { \
19 "MEMORY_VECT", \
20 4, \
21 { \
22 { "address", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_memory_vect_t, address) }, \
23 { "ver", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_memory_vect_t, ver) }, \
24 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_memory_vect_t, type) }, \
25 { "value", NULL, MAVLINK_TYPE_INT8_T, 32, 4, offsetof(mavlink_memory_vect_t, value) }, \
26 } \
30 /**
31 * @brief Pack a memory_vect message
32 * @param system_id ID of this system
33 * @param component_id ID of this component (e.g. 200 for IMU)
34 * @param msg The MAVLink message to compress the data into
36 * @param address Starting address of the debug variables
37 * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
38 * @param type Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14
39 * @param value Memory contents at specified address
40 * @return length of the message in bytes (excluding serial stream start sign)
42 static inline uint16_t mavlink_msg_memory_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
43 uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
45 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
46 char buf[36];
47 _mav_put_uint16_t(buf, 0, address);
48 _mav_put_uint8_t(buf, 2, ver);
49 _mav_put_uint8_t(buf, 3, type);
50 _mav_put_int8_t_array(buf, 4, value, 32);
51 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 36);
52 #else
53 mavlink_memory_vect_t packet;
54 packet.address = address;
55 packet.ver = ver;
56 packet.type = type;
57 mav_array_memcpy(packet.value, value, sizeof(int8_t) * 32);
58 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 36);
59 #endif
61 msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT;
62 return mavlink_finalize_message(msg, system_id, component_id, 36, 204);
65 /**
66 * @brief Pack a memory_vect message on a channel
67 * @param system_id ID of this system
68 * @param component_id ID of this component (e.g. 200 for IMU)
69 * @param chan The MAVLink channel this message was sent over
70 * @param msg The MAVLink message to compress the data into
71 * @param address Starting address of the debug variables
72 * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
73 * @param type Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14
74 * @param value Memory contents at specified address
75 * @return length of the message in bytes (excluding serial stream start sign)
77 static inline uint16_t mavlink_msg_memory_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
78 mavlink_message_t *msg,
79 uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82 char buf[36];
83 _mav_put_uint16_t(buf, 0, address);
84 _mav_put_uint8_t(buf, 2, ver);
85 _mav_put_uint8_t(buf, 3, type);
86 _mav_put_int8_t_array(buf, 4, value, 32);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 36);
88 #else
89 mavlink_memory_vect_t packet;
90 packet.address = address;
91 packet.ver = ver;
92 packet.type = type;
93 mav_array_memcpy(packet.value, value, sizeof(int8_t) * 32);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 36);
95 #endif
97 msg->msgid = MAVLINK_MSG_ID_MEMORY_VECT;
98 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 36, 204);
102 * @brief Encode a memory_vect struct into a message
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param msg The MAVLink message to compress the data into
107 * @param memory_vect C-struct to read the message contents from
109 static inline uint16_t mavlink_msg_memory_vect_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg, const mavlink_memory_vect_t *memory_vect)
111 return mavlink_msg_memory_vect_pack(system_id, component_id, msg, memory_vect->address, memory_vect->ver, memory_vect->type, memory_vect->value);
115 * @brief Send a memory_vect message
116 * @param chan MAVLink channel to send the message
118 * @param address Starting address of the debug variables
119 * @param ver Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
120 * @param type Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14
121 * @param value Memory contents at specified address
123 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
125 static inline void mavlink_msg_memory_vect_send(mavlink_channel_t chan, uint16_t address, uint8_t ver, uint8_t type, const int8_t *value)
127 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
128 char buf[36];
129 _mav_put_uint16_t(buf, 0, address);
130 _mav_put_uint8_t(buf, 2, ver);
131 _mav_put_uint8_t(buf, 3, type);
132 _mav_put_int8_t_array(buf, 4, value, 32);
133 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, buf, 36, 204);
134 #else
135 mavlink_memory_vect_t packet;
136 packet.address = address;
137 packet.ver = ver;
138 packet.type = type;
139 mav_array_memcpy(packet.value, value, sizeof(int8_t) * 32);
140 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMORY_VECT, (const char *)&packet, 36, 204);
141 #endif
144 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
146 // MESSAGE MEMORY_VECT UNPACKING
150 * @brief Get field address from memory_vect message
152 * @return Starting address of the debug variables
154 static inline uint16_t mavlink_msg_memory_vect_get_address(const mavlink_message_t *msg)
156 return _MAV_RETURN_uint16_t(msg, 0);
160 * @brief Get field ver from memory_vect message
162 * @return Version code of the type variable. 0=unknown, type ignored and assumed int16_t. 1=as below
164 static inline uint8_t mavlink_msg_memory_vect_get_ver(const mavlink_message_t *msg)
166 return _MAV_RETURN_uint8_t(msg, 2);
170 * @brief Get field type from memory_vect message
172 * @return Type code of the memory variables. for ver = 1: 0=16 x int16_t, 1=16 x uint16_t, 2=16 x Q15, 3=16 x 1Q14
174 static inline uint8_t mavlink_msg_memory_vect_get_type(const mavlink_message_t *msg)
176 return _MAV_RETURN_uint8_t(msg, 3);
180 * @brief Get field value from memory_vect message
182 * @return Memory contents at specified address
184 static inline uint16_t mavlink_msg_memory_vect_get_value(const mavlink_message_t *msg, int8_t *value)
186 return _MAV_RETURN_int8_t_array(msg, value, 32, 4);
190 * @brief Decode a memory_vect message into a struct
192 * @param msg The message to decode
193 * @param memory_vect C-struct to decode the message contents into
195 static inline void mavlink_msg_memory_vect_decode(const mavlink_message_t *msg, mavlink_memory_vect_t *memory_vect)
197 #if MAVLINK_NEED_BYTE_SWAP
198 memory_vect->address = mavlink_msg_memory_vect_get_address(msg);
199 memory_vect->ver = mavlink_msg_memory_vect_get_ver(msg);
200 memory_vect->type = mavlink_msg_memory_vect_get_type(msg);
201 mavlink_msg_memory_vect_get_value(msg, memory_vect->value);
202 #else
203 memcpy(memory_vect, _MAV_PAYLOAD(msg), 36);
204 #endif