 |
Paparazzi UAS
v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
29 #include "pprzlink/intermcu_msg.h"
30 #include "generated/modules.h"
33 #if TELEMETRY_INTERMCU
44 #include "libopencm3/cm3/scb.h"
47 static uint8_t px4RebootSequence[] = {0x41, 0xd7, 0x32, 0x0a, 0x46, 0x39};
48 static uint8_t px4RebootSequenceCount = 0;
52 #if RADIO_CONTROL_NB_CHANNEL > 8
55 INFO(
"InterMCU UART will only send 8 radio channels!")
71 static void checkPx4RebootCommand(
unsigned char b);
75 #ifndef IMCU_RADIO_CONTROL_ID
76 #define IMCU_RADIO_CONTROL_ID ABI_BROADCAST
85 #define IMCU_GPS_ID GPS_MULTI_ID
127 checkPx4RebootCommand(c);
144 if (class_id == DL_intermcu_CLASS_ID) {
147 #if TELEMETRY_INTERMCU
174 uint8_t size = DL_IMCU_COMMANDS_values_length(buf);
175 int16_t *new_commands = DL_IMCU_COMMANDS_values(buf);
182 for (
int i = 0; i < size; i++) {
192 #if defined(SPEKTRUM_HAS_SOFT_BIND_PIN)
200 #if TELEMETRY_INTERMCU
201 uint8_t size = (DOWNLINK_TRANSPORT).trans_rx.payload_len;
218 #ifdef RADIO_KILL_SWITCH
223 #ifdef RADIO_KILL_SWITCH
224 #warning "RC AUX1 and KILL_SWITCH are on the same channel. AUX1 is discarded."
243 uint32_t stamp __attribute__((unused)),
265 static void checkPx4RebootCommand(
uint8_t b)
270 intermcu.stable_px4_baud = PPRZ_BAUD;
271 }
else if (
intermcu.stable_px4_baud == PX4_BAUD) {
281 intermcu.stable_px4_baud = CHANGING_BAUD;
290 if (
b == px4RebootSequence[px4RebootSequenceCount]) {
291 px4RebootSequenceCount++;
293 px4RebootSequenceCount = 0;
296 if (px4RebootSequenceCount >= 6) {
297 px4RebootSequenceCount = 0;
void intermcu_event(void)
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
struct intermcu_t intermcu
int32_t alt
in millimeters above WGS84 reference ellipsoid
#define INTERMCU_RADIO_AUX3
uint8_t imcu_msg_buf[256]
The InterMCU message buffer.
struct link_device * device
Device used for communication.
Inter-MCU on FlyByWire side.
#define RADIO_KILL_SWITCH
#define INTERMCU_CLR_CMD_STATUS(_bit)
data structure for GPS information
pprz_t intermcu_commands[COMMANDS_NB]
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
#define RADIO_ROLL
Redefining RADIO_* Do not use with radio.h (ppm rc)
void intermcu_forward_uplink(uint8_t *buf)
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.
datalink forwarder for InterMCU
@ INTERMCU_LOST
No interMCU communication anymore.
short int16_t
Typedef defining 16 bit short type.
#define INTERMCU_RADIO_CONTROL_NB_CHANNEL
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
Device independent GPS code (interface)
#define INTERMCU_RADIO_PITCH
@ INTERMCU_CMD_MOTORS_ON
The status of intermcu_ap_motors_on.
@ INTERMCU_OK
InterMCU communication is OK.
Architecture independent timing functions.
#define INTERMCU_RADIO_AUX2
uint8_t fbw_mode
Fly by wire modes.
uint16_t gspeed
norm of 2d ground speed in cm/s
void dl_parse_msg(struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
Should be called when chars are available in dl_buffer.
#define INTERMCU_RADIO_ROLL
#define INTERMCU_RADIO_KILL_SWITCH
void intermcu_dl_on_msg(uint8_t *msg, uint8_t size)
function to forward telemetry from AP to the ground
int8_t tid_t
sys_time timer id type
arch independent LED (Light Emitting Diodes) API
void intermcu_parse_IMCU_COMMANDS(uint8_t *buf)
Datalink event functions.
bool msg_available
If we have an InterMCU message.
void intermcu_dl_repack(struct transport_tx *trans, struct link_device *dev, uint8_t *msg, uint8_t size)
Repack message with same header and send on selected link if possible.
bool intermcu_ap_motors_on
#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)
void intermcu_parse_IMCU_SPEKTRUM_SOFT_BIND(uint8_t *buf)
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.
#define IMCU_RADIO_CONTROL_ID
static void rc_cb(uint8_t sender_id, struct RadioControl *rc)
Handling of messages coming from ground and other A/Cs.
struct Electrical electrical
struct EcefCoor_i ecef_vel
speed ECEF in cm/s
void intermcu_send_status(void)
send fbw status message
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]