Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
logger_uart.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2013 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  */
22 
23 #include "logger_uart.h"
24 
25 #include "state.h"
26 #include "led.h"
27 #include "modules/imu/imu.h"
28 #include "mcu_periph/uart.h"
29 
31 
32 void logger_uart_init(void)
33 {
34  logger_uart_data.id = 0;
35 }
36 
38 {
39  struct FloatEulers att = *stateGetNedToBodyEulers_f();
40 
41  logger_uart_data.start = 0x55CC;
43 
44  if (logger_uart_data.id & 0x0080) {
45  LED_ON(1);
46  } else {
47  LED_OFF(1);
48  }
49 
56  logger_uart_data.phi = (att.phi * 100.0f);
57  logger_uart_data.theta = (att.theta * 100.0f);
58  logger_uart_data.psi = (att.psi * 100.0f);
59 
60  uint8_t crc = 0;
62  for (int i=0; i<22; i++)
63  {
64  crc += p[i];
65  UART1Transmit(p[i]);
66  }
67  UART1Transmit(crc);
68 }
69 
70 
Imu::gyro_unscaled
struct Int32Rates gyro_unscaled
unscaled gyroscope measurements
Definition: imu.h:46
logger_uart_data_struct::start
uint16_t start
Definition: logger_uart.h:35
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
LED_OFF
#define LED_OFF(i)
Definition: led_hw.h:52
Int32Rates::q
int32_t q
in rad/s with INT32_RATE_FRAC
Definition: pprz_algebra_int.h:181
Int32Vect3::z
int32_t z
Definition: pprz_algebra_int.h:91
stateGetNedToBodyEulers_f
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
Definition: state.h:1143
logger_uart_parse.crc
crc
Definition: logger_uart_parse.py:9
LED_ON
#define LED_ON(i)
Definition: led_hw.h:51
Imu::accel_unscaled
struct Int32Vect3 accel_unscaled
unscaled accelerometer measurements
Definition: imu.h:47
logger_uart_data_struct::gyro_q
int16_t gyro_q
Definition: logger_uart.h:38
FloatEulers::theta
float theta
in radians
Definition: pprz_algebra_float.h:86
Int32Rates::p
int32_t p
in rad/s with INT32_RATE_FRAC
Definition: pprz_algebra_int.h:180
imu.h
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
FloatEulers::phi
float phi
in radians
Definition: pprz_algebra_float.h:85
logger_uart_data_struct
Definition: logger_uart.h:34
logger_uart_init
void logger_uart_init(void)
Definition: logger_uart.c:32
logger_uart_data_struct::gyro_p
int16_t gyro_p
Definition: logger_uart.h:37
Int32Vect3::y
int32_t y
Definition: pprz_algebra_int.h:90
logger_uart_data_struct::acc_z
int16_t acc_z
Definition: logger_uart.h:42
led.h
arch independent LED (Light Emitting Diodes) API
logger_uart_data_struct::acc_x
int16_t acc_x
Definition: logger_uart.h:40
imu
struct Imu imu
global IMU state
Definition: imu.c:108
logger_uart_data_struct::id
int16_t id
Definition: logger_uart.h:36
logger_uart_data
struct logger_uart_data_struct logger_uart_data
Definition: logger_uart.c:30
logger_uart_data_struct::phi
int16_t phi
Definition: logger_uart.h:43
logger_uart_data_struct::theta
int16_t theta
Definition: logger_uart.h:44
Int32Vect3::x
int32_t x
Definition: pprz_algebra_int.h:89
FloatEulers
euler angles
Definition: pprz_algebra_float.h:84
state.h
FloatEulers::psi
float psi
in radians
Definition: pprz_algebra_float.h:87
logger_uart_data_struct::gyro_r
int16_t gyro_r
Definition: logger_uart.h:39
logger_uart.h
logger_uart_data_struct::acc_y
int16_t acc_y
Definition: logger_uart.h:41
Int32Rates::r
int32_t r
in rad/s with INT32_RATE_FRAC
Definition: pprz_algebra_int.h:182
p
static float p[2][2]
Definition: ins_alt_float.c:268
logger_uart_data_struct::psi
int16_t psi
Definition: logger_uart.h:45
logger_uart_periodic
void logger_uart_periodic(void)
Definition: logger_uart.c:37