|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
34 #define MSG_INTERMCU_COMMAND_MASTER_ID 0x01
35 #define MSG_INTERMCU_COMMAND_EXTRA_ID 0x02
37 #define MSG_INTERMCU_RADIO_LOW_ID 0x04
38 #define MSG_INTERMCU_RADIO_HIGH_ID 0x05
40 #define MSG_INTERMCU_TRIM_ID 0x09
42 #define MSG_INTERMCU_FBW_STATUS_ID 0x10
50 #define INTERMCU_COMMAND(_intermcu_payload, nr) (pprz_t)((uint16_t)(*((uint8_t*)_intermcu_payload+0+(2*(nr)))|*((uint8_t*)_intermcu_payload+1+(2*(nr)))<<8))
60 #error "INTERMCU_CAN CAN ONLY SEND 4 OR 8 COMMANDS (packets of 8 bytes)"
62 #if RADIO_CONTROL_NB_CHANNEL > 8
63 #warning "INTERMCU_CAN CAN ONLY SEND 8 RADIO CHANNELS: CHANNELS 9 and higher will not be sent"
68 for (
int i = 0; (i < 4) && (i < COMMANDS_NB); i++) {
78 for (
int i = 0; (i < 4) && (i < (COMMANDS_NB - 4)); i++) {
105 fbw_state->electrical.vsupply = (float)(data[3] + (data[4] << 8))/10.
f;
122 for (
int i = 0; (i < COMMANDS_NB) && (i < 4); i++) {
125 for (
int i = 0; (i < (COMMANDS_NB - 4)) && (i < 4); i++) {
143 inter_mcu_fill_fbw_state();
147 intermcu_tx_buff[0] =
fbw_state->ppm_cpt;
151 intermcu_tx_buff[3] = (
uint8_t) vsupply;
152 intermcu_tx_buff[4] = (
uint8_t)((vsupply & 0xff00) >> 8);
155 #if defined RADIO_CONTROL || RADIO_CONTROL_AUTO1
185 #define RC_REALLY_LOST 2
188 static void send_commands(
struct transport_tx *trans,
struct link_device *
dev)
190 pprz_msg_send_COMMANDS(trans,
dev, AC_ID, COMMANDS_NB,
ap_state->commands);
197 if (bit_is_set(
fbw_state->status, STATUS_MODE_AUTO)) {
200 if (bit_is_set(
fbw_state->status, STATUS_MODE_FAILSAFE)) {
203 if (bit_is_set(
fbw_state->status, STATUS_RADIO_REALLY_LOST)) {
210 pprz_msg_send_FBW_STATUS(trans,
dev, AC_ID,
221 #if PERIODIC_TELEMETRY
void(* can_rx_callback_t)(uint32_t id, uint8_t *buf, uint8_t len)
void link_mcu_periodic_task(void)
#define MSG_INTERMCU_TRIM_ID
#define MSG_INTERMCU_COMMAND_MASTER_ID
volatile bool inter_mcu_received_ap
struct fbw_state * fbw_state
#define MSG_INTERMCU_FBW_STATUS_ID
void link_mcu_on_can_msg(uint32_t id, uint8_t *data, int len)
void link_mcu_event_task(void)
#define INTERMCU_COMMAND(_intermcu_payload, nr)
static void send_commands(struct transport_tx *trans, struct link_device *dev)
volatile bool inter_mcu_received_fbw
static const struct usb_device_descriptor dev
void ppz_can_init(can_rx_callback_t callback)
#define RADIO_CONTROL_NB_CHANNEL
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
arch independent LED (Light Emitting Diodes) API
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
#define MSG_INTERMCU_RADIO_LOW_ID
static struct fbw_status_t fbw_status
struct link_mcu_msg link_mcu_from_fbw_msg
int ppz_can_transmit(uint32_t id, const uint8_t *buf, uint8_t len)
struct ap_state * ap_state
#define MSG_INTERMCU_RADIO_HIGH_ID
Hardware independent code for commands handling.
struct link_mcu_msg link_mcu_from_ap_msg
#define MSG_INTERMCU_COMMAND_EXTRA_ID
static void send_fbw_status(struct transport_tx *trans, struct link_device *dev)
#define DefaultPeriodic
Set default periodic telemetry.