Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
mavlink_msg_param_request_read.h
00001 // MESSAGE PARAM_REQUEST_READ PACKING 00002 00003 #define MAVLINK_MSG_ID_PARAM_REQUEST_READ 20 00004 00005 typedef struct __mavlink_param_request_read_t 00006 { 00007 uint8_t target_system; ///< System ID 00008 uint8_t target_component; ///< Component ID 00009 int8_t param_id[15]; ///< Onboard parameter id 00010 int16_t param_index; ///< Parameter index. Send -1 to use the param ID field as identifier 00011 00012 } mavlink_param_request_read_t; 00013 00014 #define MAVLINK_MSG_PARAM_REQUEST_READ_FIELD_PARAM_ID_LEN 15 00015 00016 00017 /** 00018 * @brief Pack a param_request_read message 00019 * @param system_id ID of this system 00020 * @param component_id ID of this component (e.g. 200 for IMU) 00021 * @param msg The MAVLink message to compress the data into 00022 * 00023 * @param target_system System ID 00024 * @param target_component Component ID 00025 * @param param_id Onboard parameter id 00026 * @param param_index Parameter index. Send -1 to use the param ID field as identifier 00027 * @return length of the message in bytes (excluding serial stream start sign) 00028 */ 00029 static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const int8_t* param_id, int16_t param_index) 00030 { 00031 uint16_t i = 0; 00032 msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ; 00033 00034 i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID 00035 i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID 00036 i += put_array_by_index(param_id, 15, i, msg->payload); // Onboard parameter id 00037 i += put_int16_t_by_index(param_index, i, msg->payload); // Parameter index. Send -1 to use the param ID field as identifier 00038 00039 return mavlink_finalize_message(msg, system_id, component_id, i); 00040 } 00041 00042 /** 00043 * @brief Pack a param_request_read message 00044 * @param system_id ID of this system 00045 * @param component_id ID of this component (e.g. 200 for IMU) 00046 * @param chan The MAVLink channel this message was sent over 00047 * @param msg The MAVLink message to compress the data into 00048 * @param target_system System ID 00049 * @param target_component Component ID 00050 * @param param_id Onboard parameter id 00051 * @param param_index Parameter index. Send -1 to use the param ID field as identifier 00052 * @return length of the message in bytes (excluding serial stream start sign) 00053 */ 00054 static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target_system, uint8_t target_component, const int8_t* param_id, int16_t param_index) 00055 { 00056 uint16_t i = 0; 00057 msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ; 00058 00059 i += put_uint8_t_by_index(target_system, i, msg->payload); // System ID 00060 i += put_uint8_t_by_index(target_component, i, msg->payload); // Component ID 00061 i += put_array_by_index(param_id, 15, i, msg->payload); // Onboard parameter id 00062 i += put_int16_t_by_index(param_index, i, msg->payload); // Parameter index. Send -1 to use the param ID field as identifier 00063 00064 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00065 } 00066 00067 /** 00068 * @brief Encode a param_request_read struct into a message 00069 * 00070 * @param system_id ID of this system 00071 * @param component_id ID of this component (e.g. 200 for IMU) 00072 * @param msg The MAVLink message to compress the data into 00073 * @param param_request_read C-struct to read the message contents from 00074 */ 00075 static inline uint16_t mavlink_msg_param_request_read_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_request_read_t* param_request_read) 00076 { 00077 return mavlink_msg_param_request_read_pack(system_id, component_id, msg, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index); 00078 } 00079 00080 /** 00081 * @brief Send a param_request_read message 00082 * @param chan MAVLink channel to send the message 00083 * 00084 * @param target_system System ID 00085 * @param target_component Component ID 00086 * @param param_id Onboard parameter id 00087 * @param param_index Parameter index. Send -1 to use the param ID field as identifier 00088 */ 00089 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00090 00091 static inline void mavlink_msg_param_request_read_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const int8_t* param_id, int16_t param_index) 00092 { 00093 mavlink_message_t msg; 00094 mavlink_msg_param_request_read_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target_system, target_component, param_id, param_index); 00095 mavlink_send_uart(chan, &msg); 00096 } 00097 00098 #endif 00099 // MESSAGE PARAM_REQUEST_READ UNPACKING 00100 00101 /** 00102 * @brief Get field target_system from param_request_read message 00103 * 00104 * @return System ID 00105 */ 00106 static inline uint8_t mavlink_msg_param_request_read_get_target_system(const mavlink_message_t* msg) 00107 { 00108 return (uint8_t)(msg->payload)[0]; 00109 } 00110 00111 /** 00112 * @brief Get field target_component from param_request_read message 00113 * 00114 * @return Component ID 00115 */ 00116 static inline uint8_t mavlink_msg_param_request_read_get_target_component(const mavlink_message_t* msg) 00117 { 00118 return (uint8_t)(msg->payload+sizeof(uint8_t))[0]; 00119 } 00120 00121 /** 00122 * @brief Get field param_id from param_request_read message 00123 * 00124 * @return Onboard parameter id 00125 */ 00126 static inline uint16_t mavlink_msg_param_request_read_get_param_id(const mavlink_message_t* msg, int8_t* r_data) 00127 { 00128 00129 memcpy(r_data, msg->payload+sizeof(uint8_t)+sizeof(uint8_t), 15); 00130 return 15; 00131 } 00132 00133 /** 00134 * @brief Get field param_index from param_request_read message 00135 * 00136 * @return Parameter index. Send -1 to use the param ID field as identifier 00137 */ 00138 static inline int16_t mavlink_msg_param_request_read_get_param_index(const mavlink_message_t* msg) 00139 { 00140 generic_16bit r; 00141 r.b[1] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+15)[0]; 00142 r.b[0] = (msg->payload+sizeof(uint8_t)+sizeof(uint8_t)+15)[1]; 00143 return (int16_t)r.s; 00144 } 00145 00146 /** 00147 * @brief Decode a param_request_read message into a struct 00148 * 00149 * @param msg The message to decode 00150 * @param param_request_read C-struct to decode the message contents into 00151 */ 00152 static inline void mavlink_msg_param_request_read_decode(const mavlink_message_t* msg, mavlink_param_request_read_t* param_request_read) 00153 { 00154 param_request_read->target_system = mavlink_msg_param_request_read_get_target_system(msg); 00155 param_request_read->target_component = mavlink_msg_param_request_read_get_target_component(msg); 00156 mavlink_msg_param_request_read_get_param_id(msg, param_request_read->param_id); 00157 param_request_read->param_index = mavlink_msg_param_request_read_get_param_index(msg); 00158 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2