30 #include "generated/airframe.h"
31 #include "generated/flight_plan.h"
33 #if defined(ROTORCRAFT_FIRMWARE)
37 #define MAX_BUF_LEN 74
40 #define LEN_ID_SERIAL 24
48 buf[1] = strlen(
id_fr);
58 memcpy(buf + 2, &lat,
sizeof(lat));
59 return sizeof(lat) + 2;
67 memcpy(buf + 2, &lon,
sizeof(lon));
68 return sizeof(lon) + 2;
76 memcpy(buf + 2, &alt,
sizeof(alt));
77 return sizeof(alt) + 2;
84 buf[1] =
sizeof(speed);
85 memcpy(buf + 2, &speed,
sizeof(speed));
86 return sizeof(speed) + 2;
93 if (route_normalized >= 0) {
96 route = (
uint16_t)(360 + route_normalized);
99 buf[1] =
sizeof(route);
100 memcpy(buf + 2, &route,
sizeof(route));
101 return sizeof(route) + 2;
107 #if defined(FIXEDWING_FIRMWARE)
119 ptr_home_lla_i = &home_lla_i;
122 #elif defined(ROTORCRAFT_FIRMWARE)
125 #error Not a fixedwing or a rotorcraft, not yet supported
133 buf[offset++] =
sizeof(lat_home);
134 memcpy(buf + offset, &lat_home,
sizeof(lat_home));
135 offset +=
sizeof(lat_home);
138 buf[offset++] =
sizeof(lon_home);
139 memcpy(buf + offset, &lon_home,
sizeof(lon_home));
140 offset +=
sizeof(lon_home);
151 memcpy(
id_fr, ID_MANUFACTURER, 3);
152 memcpy(
id_fr + 3, ID_MODEL, 3);
167 offset +=
put_ID(buf + offset);
168 offset +=
put_lat(buf + offset);
169 offset +=
put_lon(buf + offset);
170 offset +=
put_alt(buf + offset);
179 for (
int i = 1; i <
offset; i++) {
183 buf[offset++] =
ck_a;
184 buf[offset++] =
ck_b;
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
#define INT32_DEG_OF_RAD(_rad)
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
static struct uart_periph * dev
static int put_route(uint8_t *buf)
void uart_put_buffer(struct uart_periph *p, long fd, const uint8_t *data, uint16_t len)
Uart transmit buffer implementation.
static int put_lon(uint8_t *buf)
position in UTM coordinates Units: meters
static int put_lat_lon_home(uint8_t *buf)
vector in Latitude, Longitude and Altitude
vector in Latitude, Longitude and Altitude
int32_t hmsl
height above mean sea level (MSL) in mm
static const float offset[]
Device independent GPS code (interface)
void lla_of_utm_f(struct LlaCoor_f *lla, struct UtmCoor_f *utm)
int32_t lon
in degrees*1e7
static int put_horizontal_speed(uint8_t *buf)
uint8_t zone
UTM zone number.
static float stateGetHorizontalSpeedDir_f(void)
Get dir of horizontal ground speed (float).
API to get/set the generic vehicle states.
struct point waypoints[NB_WAYPOINT]
size == nb_waypoint, waypoint 0 is a dummy waypoint
static int put_ID(uint8_t *buf)
#define LLA_BFP_OF_REAL(_o, _i)
static char id_fr[LEN_ID_FR]
struct LlaCoor_i * waypoint_get_lla(uint8_t wp_id)
Get LLA coordinates of waypoint.
void e_identification_fr_periodic()
int32_t lat
in degrees*1e7
struct GpsState gps
global GPS state
void e_identification_fr_init()
static struct LlaCoor_i * stateGetPositionLla_i(void)
Get position in LLA coordinates (int).
static int put_lat(uint8_t *buf)
static int put_alt(uint8_t *buf)