|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
30 #include "pprzlink/intermcu_msg.h"
41 #include "libopencm3/cm3/scb.h"
44 static uint8_t px4RebootSequence[] = {0x41, 0xd7, 0x32, 0x0a, 0x46, 0x39};
45 static uint8_t px4RebootSequenceCount = 0;
49 #if RADIO_CONTROL_NB_CHANNEL > 8
50 #undef RADIO_CONTROL_NB_CHANNEL
51 #define RADIO_CONTROL_NB_CHANNEL 8
52 INFO(
"InterMCU UART will only send 8 radio channels!")
68 static void checkPx4RebootCommand(
unsigned char b);
74 #define IMCU_GPS_ID GPS_MULTI_ID
117 #ifdef RADIO_KILL_SWITCH
122 #ifdef RADIO_KILL_SWITCH
123 #warning "RC AUX1 and KILL_SWITCH are on the same channel. AUX1 is discarded."
147 #pragma GCC diagnostic ignored "-Wcast-align"
152 #if PPRZLINK_DEFAULT_VER == 2
154 if (pprzlink_get_msg_class_id(
imcu_msg_buf) == DL_intermcu_CLASS_ID) {
157 case DL_IMCU_COMMANDS: {
167 for (i = 0; i < size; i++) {
173 commands_frame_handler();
176 #if defined(TELEMETRY_INTERMCU_DEV)
177 case DL_IMCU_TELEMETRY: {
184 #if defined(SPEKTRUM_HAS_SOFT_BIND_PIN) //TODO: make subscribable module parser
185 case DL_IMCU_SPEKTRUM_SOFT_BIND:
193 #if PPRZLINK_DEFAULT_VER == 2
197 #pragma GCC diagnostic pop
211 checkPx4RebootCommand(
c);
234 uint32_t stamp __attribute__((unused)),
256 static void checkPx4RebootCommand(
uint8_t b)
281 if (
b == px4RebootSequence[px4RebootSequenceCount]) {
282 px4RebootSequenceCount++;
284 px4RebootSequenceCount = 0;
287 if (px4RebootSequenceCount >= 6) {
288 px4RebootSequenceCount = 0;
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
struct intermcu_t intermcu
int32_t alt
in millimeters above WGS84 reference ellipsoid
#define INTERMCU_RADIO_AUX3
uint8_t imcu_msg_buf[128]
The InterMCU message buffer.
void telemetry_intermcu_on_msg(uint8_t *msg, uint8_t size)
Telemetry through InterMCU.
struct link_device * device
Device used for communication.
Rotorcraft Inter-MCU on FlyByWire.
#define INTERMCU_CLR_CMD_STATUS(_bit)
void intermcu_send_status(uint8_t mode)
data structure for GPS information
pprz_t intermcu_commands[COMMANDS_NB]
void InterMcuEvent(void(*frame_handler)(void))
Event structure to store callbacks in a linked list.
uint32_t pacc
position accuracy in cm
#define INTERMCU_LOST_CNT
uint32_t sacc
speed accuracy in cm/s
static void intermcu_parse_msg(void(*commands_frame_handler)(void))
enum intermcu_status status
Status of the INTERMCU.
uint8_t time_since_last_frame
Time since last frame.
#define INTERMCU_RADIO_AUX1
float vsupply
supply voltage in V
#define INTERMCU_RADIO_YAW
#define INTERMCU_RADIO_MODE
bool enabled
If the InterMCU communication is enabled.
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
@ INTERMCU_LOST
No interMCU communication anymore.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
Device independent GPS code (interface)
#define INTERMCU_RADIO_PITCH
void intermcu_on_rc_frame(uint8_t fbw_mode)
@ INTERMCU_CMD_MOTORS_ON
The status of autopilot_motors_on.
@ INTERMCU_OK
InterMCU communication is OK.
Architecture independent timing functions.
#define INTERMCU_RADIO_AUX2
#define RADIO_CONTROL_NB_CHANNEL
uint16_t gspeed
norm of 2d ground speed in cm/s
#define INTERMCU_RADIO_ROLL
#define INTERMCU_RADIO_KILL_SWITCH
int8_t tid_t
sys_time timer id type
arch independent LED (Light Emitting Diodes) API
bool msg_available
If we have an InterMCU message.
#define INTERMCU_GET_CMD_STATUS(_bit)
void received_spektrum_soft_bind(void)
uint8_t cmd_status
Command status information that is transfered (intermcu_cmd_status)
int32_t course
GPS course over ground in rad*1e7, [0, 2*Pi]*1e7 (CW/north)
struct EcefCoor_i ecef_pos
position in ECEF in cm
static void gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
struct LlaCoor_i lla_pos
position in LLA (lat,lon: deg*1e7; alt: mm over ellipsoid)
uint8_t num_sv
number of sat in fix
struct pprz_transport transport
Transport over communication line (PPRZ)
int32_t hmsl
height above mean sea level (MSL) in mm
void intermcu_periodic(void)
#define INTERMCU_RADIO_THROTTLE
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
void sys_time_cancel_timer(tid_t id)
Cancel a system timer by id.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
struct Electrical electrical
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
#define RADIO_KILL_SWITCH
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
float current
current in A
struct RadioControl radio_control
pprz_t values[RADIO_CONTROL_NB_CHANNEL]