Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "nps_ins.h"
#include <sys/time.h>
#include "nps_fdm.h"
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/poll.h>
#include "nps_sensors.h"
#include "nps_main.h"
#include "paparazzi.h"
#include "pprzlink/messages.h"
#include "pprzlink/dl_protocol.h"
#include "pprzlink/pprzlink_device.h"
#include "pprzlink/pprz_transport.h"
#include "arch/linux/serial_port.h"
Go to the source code of this file.
Data Structures | |
struct | linkdev |
Macros | |
#define | AP_DEV "/dev/ttyUSB0" |
#define | AP_BAUD B921600 |
#define | NPS_HITL_DEBUG 0 |
#define | DEBUG_PRINT(...) {} |
#define | PPRZLINK_BUFFER_SIZE 256 |
Functions | |
void * | nps_sensors_loop (void *data) |
void * | nps_ap_data_loop (void *data) |
static int | check_free_space (struct linkdev *d, long *fd, uint16_t len) |
static void | put_byte (struct linkdev *d, long fd, uint8_t data) |
static void | put_buffer (struct linkdev *d, long fd, const uint8_t *data, uint16_t len) |
static void | send_message (struct linkdev *d, long fd) |
static uint8_t | getch (struct linkdev *d) |
static int | char_available (struct linkdev *d) |
void | nps_hitl_impl_init (void) |
END pprzlink_dev. More... | |
Variables | |
pthread_t | th_sensors |
pthread_t | th_ap_data |
static struct linkdev | dev |
struct linkdev |
Definition at line 68 of file nps_hitl_sensors.c.
Data Fields | ||
---|---|---|
struct link_device | device | Generic device interface. |
struct pollfd | fds[1] | |
struct SerialPort * | port | Serial port. |
struct pprz_transport | pprz_tp | transport |
uint8_t | rx_buf[PPRZLINK_BUFFER_SIZE] | Receive buffer. |
uint16_t | rx_idx | |
uint8_t | tx_buf[PPRZLINK_BUFFER_SIZE] | Transmit buffer. |
uint16_t | tx_idx |
#define AP_BAUD B921600 |
Definition at line 50 of file nps_hitl_sensors.c.
#define AP_DEV "/dev/ttyUSB0" |
Definition at line 47 of file nps_hitl_sensors.c.
#define DEBUG_PRINT | ( | ... | ) | {} |
Definition at line 58 of file nps_hitl_sensors.c.
#define NPS_HITL_DEBUG 0 |
Definition at line 54 of file nps_hitl_sensors.c.
#define PPRZLINK_BUFFER_SIZE 256 |
Definition at line 67 of file nps_hitl_sensors.c.
|
static |
Definition at line 135 of file nps_hitl_sensors.c.
References DEBUG_PRINT, and linkdev::fds.
Referenced by generic_uart_event(), nps_hitl_impl_init(), and px4flash_event().
Definition at line 87 of file nps_hitl_sensors.c.
References PPRZLINK_BUFFER_SIZE, and linkdev::tx_idx.
Referenced by nps_hitl_impl_init().
Definition at line 116 of file nps_hitl_sensors.c.
References DEBUG_PRINT, SerialPort::fd, linkdev::port, PPRZLINK_BUFFER_SIZE, linkdev::rx_buf, and linkdev::rx_idx.
Referenced by nps_hitl_impl_init().
void * nps_ap_data_loop | ( | void * | data | ) |
Definition at line 284 of file nps_hitl_sensors.c.
References cmd_buf, NpsAutopilot::commands, dev, linkdev::device, fdm_mutex, MAX_PPRZ, nps_autopilot, NPS_COMMANDS_NB, linkdev::pprz_tp, PPRZLINK_BUFFER_SIZE, linkdev::rx_idx, and TRUE.
Referenced by nps_hitl_impl_init().
void nps_hitl_impl_init | ( | void | ) |
END pprzlink_dev.
Definition at line 154 of file nps_hitl_sensors.c.
References AP_BAUD, AP_DEV, char_available(), check_free_space(), dev, linkdev::device, SerialPort::fd, linkdev::fds, getch(), nps_ap_data_loop(), nps_sensors_loop(), linkdev::port, linkdev::pprz_tp, put_buffer(), put_byte(), send_message(), serial_port_free(), serial_port_new(), serial_port_open_raw(), th_ap_data, and th_sensors.
Referenced by main().
void * nps_sensors_loop | ( | void * | data | ) |
Definition at line 183 of file nps_hitl_sensors.c.
References clock_get_current_time, dev, linkdev::device, fdm_mutex, nps_main, nps_sensors_airspeed_available(), nps_sensors_aoa_available(), nps_sensors_baro_available(), nps_sensors_gps_available(), nps_sensors_gyro_available(), nps_sensors_sideslip_available(), linkdev::pprz_tp, sensors, NpsMain::sim_time, and TRUE.
Referenced by nps_hitl_impl_init().
Definition at line 98 of file nps_hitl_sensors.c.
References linkdev::tx_buf, and linkdev::tx_idx.
Referenced by nps_hitl_impl_init().
Definition at line 93 of file nps_hitl_sensors.c.
References linkdev::tx_buf, and linkdev::tx_idx.
Referenced by nps_hitl_impl_init().
|
static |
Definition at line 104 of file nps_hitl_sensors.c.
References DEBUG_PRINT, SerialPort::fd, linkdev::port, linkdev::tx_buf, and linkdev::tx_idx.
Referenced by nps_hitl_impl_init().
|
static |
Definition at line 64 of file nps_hitl_sensors.c.
Referenced by nps_ap_data_loop(), nps_hitl_impl_init(), and nps_sensors_loop().
pthread_t th_ap_data |
Definition at line 64 of file nps_hitl_sensors.c.
Referenced by nps_hitl_impl_init().
pthread_t th_sensors |
Definition at line 63 of file nps_hitl_sensors.c.
Referenced by nps_hitl_impl_init().