PX4 Firmware
PX4 Autopilot Software http://px4.io
messages.h File Reference
#include <stdlib.h>
#include <stdint.h>
Include dependency graph for messages.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  gam_module_poll_msg
 
struct  eam_module_msg
 
struct  gam_module_msg
 
struct  gps_module_msg
 The GPS sensor message Struct based on: https://code.google.com/p/diy-hott-gps/downloads. More...
 

Macros

#define MESSAGES_H
 
#define POLL_TIMEOUT_IN_MSECS   3500
 
#define POST_READ_DELAY_IN_USECS   4000
 
#define POST_WRITE_DELAY_IN_USECS   3000
 
#define BINARY_MODE_REQUEST_ID   0x80
 
#define START_BYTE   0x7c
 
#define STOP_BYTE   0x7d
 
#define TEMP_ZERO_CELSIUS   0x14
 
#define EAM_SENSOR_ID   0x8e
 
#define EAM_SENSOR_TEXT_ID   0xe0
 
#define GAM_SENSOR_ID   0x8d
 
#define GAM_SENSOR_TEXT_ID   0xd0
 
#define GPS_SENSOR_ID   0x8a
 
#define GPS_SENSOR_TEXT_ID   0xa0
 
#define MAX_MESSAGE_BUFFER_SIZE   45
 

Functions

__EXPORT void init_sub_messages (void)
 
__EXPORT void init_pub_messages (void)
 
__EXPORT void build_gam_request (uint8_t *buffer, size_t *size)
 
__EXPORT void publish_gam_message (const uint8_t *buffer)
 
__EXPORT void build_eam_response (uint8_t *buffer, size_t *size)
 
__EXPORT void build_gam_response (uint8_t *buffer, size_t *size)
 
__EXPORT void build_gps_response (uint8_t *buffer, size_t *size)
 
__EXPORT float _get_distance_to_next_waypoint (double lat_now, double lon_now, double lat_next, double lon_next)
 
__EXPORT void convert_to_degrees_minutes_seconds (double lat, int *deg, int *min, int *sec)
 

Macro Definition Documentation

◆ BINARY_MODE_REQUEST_ID

#define BINARY_MODE_REQUEST_ID   0x80

Definition at line 62 of file messages.h.

Referenced by build_gam_request(), hott_telemetry_thread_main(), and recv_req_id().

◆ EAM_SENSOR_ID

#define EAM_SENSOR_ID   0x8e

Definition at line 74 of file messages.h.

Referenced by build_eam_response(), and hott_telemetry_thread_main().

◆ EAM_SENSOR_TEXT_ID

#define EAM_SENSOR_TEXT_ID   0xe0

Definition at line 75 of file messages.h.

Referenced by build_eam_response().

◆ GAM_SENSOR_ID

#define GAM_SENSOR_ID   0x8d

◆ GAM_SENSOR_TEXT_ID

#define GAM_SENSOR_TEXT_ID   0xd0

Definition at line 129 of file messages.h.

Referenced by build_gam_response().

◆ GPS_SENSOR_ID

#define GPS_SENSOR_ID   0x8a

Definition at line 181 of file messages.h.

Referenced by build_gps_response(), and hott_telemetry_thread_main().

◆ GPS_SENSOR_TEXT_ID

#define GPS_SENSOR_TEXT_ID   0xa0

Definition at line 182 of file messages.h.

Referenced by build_gps_response().

◆ MAX_MESSAGE_BUFFER_SIZE

#define MAX_MESSAGE_BUFFER_SIZE   45

Definition at line 240 of file messages.h.

Referenced by hott_sensors_thread_main(), and hott_telemetry_thread_main().

◆ MESSAGES_H

#define MESSAGES_H

Definition at line 43 of file messages.h.

◆ POLL_TIMEOUT_IN_MSECS

#define POLL_TIMEOUT_IN_MSECS   3500

Definition at line 48 of file messages.h.

◆ POST_READ_DELAY_IN_USECS

#define POST_READ_DELAY_IN_USECS   4000

Definition at line 54 of file messages.h.

◆ POST_WRITE_DELAY_IN_USECS

#define POST_WRITE_DELAY_IN_USECS   3000

Definition at line 59 of file messages.h.

Referenced by send_poll().

◆ START_BYTE

#define START_BYTE   0x7c

Definition at line 63 of file messages.h.

Referenced by build_eam_response(), build_gam_response(), and build_gps_response().

◆ STOP_BYTE

#define STOP_BYTE   0x7d

Definition at line 64 of file messages.h.

Referenced by build_eam_response(), build_gam_response(), build_gps_response(), and recv_data().

◆ TEMP_ZERO_CELSIUS

#define TEMP_ZERO_CELSIUS   0x14

Definition at line 65 of file messages.h.

Function Documentation

◆ _get_distance_to_next_waypoint()

__EXPORT float _get_distance_to_next_waypoint ( double  lat_now,
double  lon_now,
double  lat_next,
double  lon_next 
)

◆ build_eam_response()

__EXPORT void build_eam_response ( uint8_t *  buffer,
size_t *  size 
)

Definition at line 132 of file messages.cpp.

References _airdata_sub, _airspeed_sub, _battery_sub, eam_module_msg::altitude_H, eam_module_msg::altitude_L, vehicle_air_data_s::baro_alt_meter, vehicle_air_data_s::baro_temp_celcius, BOARD_TEMP_OFFSET_DEG, EAM_SENSOR_ID, eam_module_msg::eam_sensor_id, EAM_SENSOR_TEXT_ID, airspeed_s::indicated_airspeed_m_s, eam_module_msg::main_voltage_L, msg, orb_copy(), ORB_ID, eam_module_msg::sensor_text_id, eam_module_msg::speed_H, eam_module_msg::speed_L, eam_module_msg::start, START_BYTE, eam_module_msg::stop, STOP_BYTE, eam_module_msg::temperature1, eam_module_msg::temperature2, and battery_status_s::voltage_v.

Referenced by hott_telemetry_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_gam_request()

__EXPORT void build_gam_request ( uint8_t *  buffer,
size_t *  size 
)

Definition at line 90 of file messages.cpp.

References BINARY_MODE_REQUEST_ID, GAM_SENSOR_ID, gam_module_poll_msg::id, gam_module_poll_msg::mode, and msg.

Referenced by hott_sensors_thread_main().

Here is the caller graph for this function:

◆ build_gam_response()

__EXPORT void build_gam_response ( uint8_t *  buffer,
size_t *  size 
)

Definition at line 174 of file messages.cpp.

References _esc_sub, gam_module_msg::current_H, gam_module_msg::current_L, esc_status_s::esc, esc_report_s::esc_current, esc_report_s::esc_rpm, esc_report_s::esc_temperature, esc_report_s::esc_voltage, GAM_SENSOR_ID, gam_module_msg::gam_sensor_id, GAM_SENSOR_TEXT_ID, gam_module_msg::main_voltage_H, gam_module_msg::main_voltage_L, msg, orb_copy(), ORB_ID, gam_module_msg::rpm_H, gam_module_msg::rpm_L, gam_module_msg::sensor_text_id, gam_module_msg::start, START_BYTE, gam_module_msg::stop, STOP_BYTE, gam_module_msg::temperature1, and gam_module_msg::temperature2.

Referenced by hott_telemetry_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_gps_response()

__EXPORT void build_gps_response ( uint8_t *  buffer,
size_t *  size 
)

Definition at line 209 of file messages.cpp.

References _gps_sub, _home_lat, _home_lon, _home_position_set, _home_sub, matrix::abs(), vehicle_gps_position_s::alt, gps_module_msg::altitude_H, gps_module_msg::altitude_L, vehicle_gps_position_s::cog_rad, convert_to_degrees_minutes_seconds(), gps_module_msg::distance_H, gps_module_msg::distance_L, f(), vehicle_gps_position_s::fix_type, gps_module_msg::flight_direction, get_bearing_to_next_waypoint(), get_distance_to_next_waypoint(), gps_module_msg::gps_fix, gps_module_msg::gps_fix_char, gps_module_msg::gps_num_sat, GPS_SENSOR_ID, GPS_SENSOR_TEXT_ID, gps_module_msg::gps_speed_H, gps_module_msg::gps_speed_L, gps_module_msg::home_direction, home_position_s::lat, vehicle_gps_position_s::lat, gps_module_msg::latitude_min_H, gps_module_msg::latitude_min_L, gps_module_msg::latitude_ns, gps_module_msg::latitude_sec_H, gps_module_msg::latitude_sec_L, home_position_s::lon, vehicle_gps_position_s::lon, gps_module_msg::longitude_ew, gps_module_msg::longitude_min_H, gps_module_msg::longitude_min_L, gps_module_msg::longitude_sec_H, gps_module_msg::longitude_sec_L, math::min(), msg, orb_check(), orb_copy(), ORB_ID, vehicle_gps_position_s::satellites_used, gps_module_msg::sensor_id, gps_module_msg::sensor_text_id, gps_module_msg::start, START_BYTE, gps_module_msg::stop, STOP_BYTE, and vehicle_gps_position_s::vel_m_s.

Referenced by hott_telemetry_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_to_degrees_minutes_seconds()

__EXPORT void convert_to_degrees_minutes_seconds ( double  lat,
int *  deg,
int *  min,
int *  sec 
)

Definition at line 321 of file messages.cpp.

References math::min().

Referenced by build_gps_response().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_pub_messages()

__EXPORT void init_pub_messages ( void  )

Definition at line 85 of file messages.cpp.

Referenced by hott_sensors_thread_main().

Here is the caller graph for this function:

◆ init_sub_messages()

__EXPORT void init_sub_messages ( void  )

Definition at line 74 of file messages.cpp.

References _airdata_sub, _airspeed_sub, _battery_sub, _esc_sub, _gps_sub, _home_sub, ORB_ID, and orb_subscribe().

Referenced by hott_telemetry_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ publish_gam_message()

__EXPORT void publish_gam_message ( const uint8_t *  buffer)

Definition at line 103 of file messages.cpp.

References _esc_pub, gam_module_msg::current_H, gam_module_msg::current_L, esc_status_s::esc, esc_status_s::esc_connectiontype, esc_status_s::esc_count, esc_report_s::esc_current, esc_report_s::esc_rpm, esc_report_s::esc_temperature, esc_report_s::esc_voltage, hrt_absolute_time(), gam_module_msg::main_voltage_H, gam_module_msg::main_voltage_L, msg, orb_advertise(), ORB_ID, orb_publish(), gam_module_msg::rpm_H, gam_module_msg::rpm_L, gam_module_msg::temperature1, and esc_status_s::timestamp.

Referenced by hott_sensors_thread_main().

Here is the call graph for this function:
Here is the caller graph for this function: