29#include "pprzlink/intermcu_msg.h"
30#include "generated/modules.h"
44#include "libopencm3/cm3/scb.h"
52#if RADIO_CONTROL_NB_CHANNEL > 8
55INFO(
"InterMCU UART will only send 8 radio channels!")
75#ifndef IMCU_RADIO_CONTROL_ID
76#define IMCU_RADIO_CONTROL_ID ABI_BROADCAST
85#define IMCU_GPS_ID GPS_MULTI_ID
147#if TELEMETRY_INTERMCU
182 for (
int i = 0; i < size; i++) {
192#if defined(SPEKTRUM_HAS_SOFT_BIND_PIN)
200#if TELEMETRY_INTERMCU
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."
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
Handling of messages coming from ground and other A/Cs.
struct Electrical electrical
Interface for electrical status: supply voltage, current, battery status, etc.
float current
current in A
float vsupply
supply voltage in V
Device independent GPS code (interface)
data structure for GPS information
struct link_device * device
Device used for communication.
#define INTERMCU_LOST_CNT
@ INTERMCU_LOST
No interMCU communication anymore.
@ INTERMCU_OK
InterMCU communication is OK.
bool enabled
If the InterMCU communication is enabled.
@ INTERMCU_CMD_MOTORS_ON
The status of intermcu_ap_motors_on.
uint8_t cmd_status
Command status information that is transfered (intermcu_cmd_status)
enum intermcu_status status
Status of the INTERMCU.
bool msg_available
If we have an InterMCU message.
uint8_t time_since_last_frame
Time since last frame.
#define INTERMCU_CLR_CMD_STATUS(_bit)
struct pprz_transport transport
Transport over communication line (PPRZ)
#define INTERMCU_GET_CMD_STATUS(_bit)
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.
void intermcu_dl_on_msg(uint8_t *msg, uint8_t size)
function to forward telemetry from AP to the ground
datalink forwarder for InterMCU
void intermcu_event(void)
void intermcu_periodic(void)
static void gps_cb(uint8_t sender_id, uint32_t stamp, struct GpsState *gps_s)
static void rc_cb(uint8_t sender_id, struct RadioControl *rc)
void intermcu_send_status(void)
send fbw status message
struct intermcu_t intermcu
uint8_t imcu_msg_buf[256]
The InterMCU message buffer.
#define IMCU_RADIO_CONTROL_ID
void intermcu_parse_IMCU_COMMANDS(uint8_t *buf)
Datalink event functions.
void intermcu_parse_IMCU_SPEKTRUM_SOFT_BIND(uint8_t *buf)
void intermcu_forward_uplink(uint8_t *buf)
pprz_t intermcu_commands[COMMANDS_NB]
bool intermcu_ap_motors_on
Inter-MCU on FlyByWire side.
#define INTERMCU_RADIO_KILL_SWITCH
#define INTERMCU_RADIO_AUX2
#define INTERMCU_RADIO_AUX1
#define INTERMCU_RADIO_ROLL
#define INTERMCU_RADIO_YAW
#define INTERMCU_RADIO_MODE
#define INTERMCU_RADIO_CONTROL_NB_CHANNEL
#define INTERMCU_RADIO_THROTTLE
#define INTERMCU_RADIO_PITCH
#define INTERMCU_RADIO_AUX3
arch independent LED (Light Emitting Diodes) API
void uart_periph_set_baudrate(struct uart_periph *periph, uint32_t baud)
uint8_t fbw_mode
Fly by wire modes.
struct RadioControl radio_control
Generic interface for radio control modules.
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
#define RADIO_KILL_SWITCH
#define RADIO_ROLL
Redefining RADIO_* Do not use with radio.h (ppm rc)
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.
void received_spektrum_soft_bind(void)
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.
Architecture independent timing functions.
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
int8_t tid_t
sys_time timer id type
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.