34 #include "pprzlink/messages.h"
42 #define OTF_UNINIT 0x00
43 #define OTF_WAIT_START OTF_UNINIT
44 #define OTF_WAIT_COUNTER 0x01
45 #define OTF_WAIT_ANGLES 0x02
46 #define OTF_WAIT_ALTITUDE 0x03
47 #define OTF_WAIT_CHECKSUM 0x04
49 #define OTF_START 0x0A
50 #define OTF_LIMITER ','
55 void *
_sbrk(
int a __attribute__((unused))) {
return 0;}
61 static char otf_inp[64];
79 if (isdigit((
int)c)) {
83 otf_inp[otf_idx++] = c;
87 counter = atoi(otf_inp);
98 if (isdigit((
int)c) || (c ==
'-') || (c ==
'.')) {
99 otf_inp[otf_idx++] = c;
101 if ((otf_idx > 1) && (otf_idx < 9) && (c ==
OTF_LIMITER)) {
102 otf_inp[otf_idx] = 0;
103 course[otf_crs_idx] = (
int16_t)(100. * atof(otf_inp));
105 if (otf_crs_idx++ == 2) {
115 if (isdigit((
int)c) || (c ==
'-') || (c ==
'.')) {
116 otf_inp[otf_idx++] = c;
118 if ((otf_idx > 1) && (otf_idx < 9) && (c ==
OTF_LIMITER)) {
119 otf_inp[otf_idx] = 0;
120 altitude = (
int32_t)(100. * atof(otf_inp));
130 if (isxdigit((
int)c)) {
131 otf_inp[otf_idx++] = c;
133 if ((otf_idx == 2) && (c ==
OTF_END)) {
134 otf_inp[otf_idx] = 0;
135 checksum = strtol(otf_inp, NULL, 16);
139 &altitude, &foo, &foo, &checksum);
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void airspeed_otf_periodic(void)
Device independent serial meteo code.
#define OTF_WAIT_CHECKSUM
Common code for AP and FBW telemetry.
void airspeed_otf_parse(char c)
#define OTF_WAIT_ALTITUDE
void airspeed_otf_init(void)
void airspeed_otf_event(void)