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_ctrl_srfc_pt.h
00001 // MESSAGE CTRL_SRFC_PT PACKING 00002 00003 #define MAVLINK_MSG_ID_CTRL_SRFC_PT 181 00004 00005 typedef struct __mavlink_ctrl_srfc_pt_t 00006 { 00007 uint8_t target; ///< The system setting the commands 00008 uint16_t bitfieldPt; ///< Bitfield containing the PT configuration 00009 00010 } mavlink_ctrl_srfc_pt_t; 00011 00012 00013 00014 /** 00015 * @brief Pack a ctrl_srfc_pt message 00016 * @param system_id ID of this system 00017 * @param component_id ID of this component (e.g. 200 for IMU) 00018 * @param msg The MAVLink message to compress the data into 00019 * 00020 * @param target The system setting the commands 00021 * @param bitfieldPt Bitfield containing the PT configuration 00022 * @return length of the message in bytes (excluding serial stream start sign) 00023 */ 00024 static inline uint16_t mavlink_msg_ctrl_srfc_pt_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t target, uint16_t bitfieldPt) 00025 { 00026 uint16_t i = 0; 00027 msg->msgid = MAVLINK_MSG_ID_CTRL_SRFC_PT; 00028 00029 i += put_uint8_t_by_index(target, i, msg->payload); // The system setting the commands 00030 i += put_uint16_t_by_index(bitfieldPt, i, msg->payload); // Bitfield containing the PT configuration 00031 00032 return mavlink_finalize_message(msg, system_id, component_id, i); 00033 } 00034 00035 /** 00036 * @brief Pack a ctrl_srfc_pt message 00037 * @param system_id ID of this system 00038 * @param component_id ID of this component (e.g. 200 for IMU) 00039 * @param chan The MAVLink channel this message was sent over 00040 * @param msg The MAVLink message to compress the data into 00041 * @param target The system setting the commands 00042 * @param bitfieldPt Bitfield containing the PT configuration 00043 * @return length of the message in bytes (excluding serial stream start sign) 00044 */ 00045 static inline uint16_t mavlink_msg_ctrl_srfc_pt_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, uint8_t target, uint16_t bitfieldPt) 00046 { 00047 uint16_t i = 0; 00048 msg->msgid = MAVLINK_MSG_ID_CTRL_SRFC_PT; 00049 00050 i += put_uint8_t_by_index(target, i, msg->payload); // The system setting the commands 00051 i += put_uint16_t_by_index(bitfieldPt, i, msg->payload); // Bitfield containing the PT configuration 00052 00053 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, i); 00054 } 00055 00056 /** 00057 * @brief Encode a ctrl_srfc_pt struct into a message 00058 * 00059 * @param system_id ID of this system 00060 * @param component_id ID of this component (e.g. 200 for IMU) 00061 * @param msg The MAVLink message to compress the data into 00062 * @param ctrl_srfc_pt C-struct to read the message contents from 00063 */ 00064 static inline uint16_t mavlink_msg_ctrl_srfc_pt_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ctrl_srfc_pt_t* ctrl_srfc_pt) 00065 { 00066 return mavlink_msg_ctrl_srfc_pt_pack(system_id, component_id, msg, ctrl_srfc_pt->target, ctrl_srfc_pt->bitfieldPt); 00067 } 00068 00069 /** 00070 * @brief Send a ctrl_srfc_pt message 00071 * @param chan MAVLink channel to send the message 00072 * 00073 * @param target The system setting the commands 00074 * @param bitfieldPt Bitfield containing the PT configuration 00075 */ 00076 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS 00077 00078 static inline void mavlink_msg_ctrl_srfc_pt_send(mavlink_channel_t chan, uint8_t target, uint16_t bitfieldPt) 00079 { 00080 mavlink_message_t msg; 00081 mavlink_msg_ctrl_srfc_pt_pack_chan(mavlink_system.sysid, mavlink_system.compid, chan, &msg, target, bitfieldPt); 00082 mavlink_send_uart(chan, &msg); 00083 } 00084 00085 #endif 00086 // MESSAGE CTRL_SRFC_PT UNPACKING 00087 00088 /** 00089 * @brief Get field target from ctrl_srfc_pt message 00090 * 00091 * @return The system setting the commands 00092 */ 00093 static inline uint8_t mavlink_msg_ctrl_srfc_pt_get_target(const mavlink_message_t* msg) 00094 { 00095 return (uint8_t)(msg->payload)[0]; 00096 } 00097 00098 /** 00099 * @brief Get field bitfieldPt from ctrl_srfc_pt message 00100 * 00101 * @return Bitfield containing the PT configuration 00102 */ 00103 static inline uint16_t mavlink_msg_ctrl_srfc_pt_get_bitfieldPt(const mavlink_message_t* msg) 00104 { 00105 generic_16bit r; 00106 r.b[1] = (msg->payload+sizeof(uint8_t))[0]; 00107 r.b[0] = (msg->payload+sizeof(uint8_t))[1]; 00108 return (uint16_t)r.s; 00109 } 00110 00111 /** 00112 * @brief Decode a ctrl_srfc_pt message into a struct 00113 * 00114 * @param msg The message to decode 00115 * @param ctrl_srfc_pt C-struct to decode the message contents into 00116 */ 00117 static inline void mavlink_msg_ctrl_srfc_pt_decode(const mavlink_message_t* msg, mavlink_ctrl_srfc_pt_t* ctrl_srfc_pt) 00118 { 00119 ctrl_srfc_pt->target = mavlink_msg_ctrl_srfc_pt_get_target(msg); 00120 ctrl_srfc_pt->bitfieldPt = mavlink_msg_ctrl_srfc_pt_get_bitfieldPt(msg); 00121 }
Generated on Tue Jul 12 2022 14:09:26 by 1.7.2