47 #include "generated/modules.h"
50 #define And(x, y) ((x) && (y))
51 #define Or(x, y) ((x) || (y))
52 #define Min(x,y) (x < y ? x : y)
53 #define Max(x,y) (x > y ? x : y)
54 #define LessThan(_x, _y) ((_x) < (_y))
55 #define MoreThan(_x, _y) ((_x) > (_y))
65 PRINT_CONFIG_VAR(MODULES_FREQUENCY)
116 modules_periodic_task();
146 if (rc_lost && ap_lost) {
150 else if (!rc_lost && ap_lost) {
157 else if (rc_lost && !ap_lost) {
200 if (!(dv++ % (PERIODIC_FREQUENCY / 20))) {
LED_TOGGLE(FBW_MODE_LED);}
202 if (!(dv++ % (PERIODIC_FREQUENCY))) {
LED_TOGGLE(FBW_MODE_LED);}
206 #endif // FWB_MODE_LED
236 #ifdef RADIO_KILL_SWITCH
237 static bool kill_state_init =
false;
240 kill_state_init =
true;
265 #ifdef SetCommandsFromRC
268 #warning "FBW: needs commands from RC in order to be useful."
297 modules_event_task();
void intermcu_send_status(uint8_t mode)
void mcu_init(void)
Microcontroller peripherals initialization.
void InterMcuEvent(void(*frame_handler)(void))
tid_t radio_control_tid
id for radio_control_periodic_task() timer
tid_t modules_tid
id for modules_periodic_task() timer
pprz_t intermcu_commands[COMMANDS_NB]
tid_t electrical_tid
id for electrical_periodic() timer
struct intermcu_t intermcu
static void fbw_on_ap_command(void)
Callback when receive commands from the AP.
void intermcu_periodic(void)
enum intermcu_status status
Status of the INTERMCU.
tid_t telemetry_tid
id for telemetry_periodic() timer
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
void telemetry_periodic(void)
void radio_control_init(void)
const pprz_t commands_failsafe[COMMANDS_NB]
Rotorcraft Inter-MCU on FlyByWire.
#define RadioControlEvent(_received_frame_handler)
No interMCU communication anymore.
Hardware independent API for actuators (servos, motor controllers).
void electrical_init(void)
void main_init(void)
Main initialization.
Some helper functions to check RC sticks.
#define FBW_MODE_AUTO_ONLY
holds whether the aircraft can only be flown with the AP and not RC-Direct/FBW-mode ...
void handle_periodic_tasks(void)
Interface for electrical status: supply voltage, current, battery status, etc.
Architecture independent timing functions.
void motor_mixing_init(void)
void radio_control_periodic_task(void)
int8_t tid_t
sys_time timer id type
tid_t main_periodic_tid
id for main_periodic() timer
Hardware independent code for commands handling.
struct RadioControl radio_control
void intermcu_on_rc_frame(uint8_t fbw_mode)
void electrical_periodic(void)
Arch independent mcu ( Micro Controller Unit ) utilities.
pprz_t commands[COMMANDS_NB]
Storage of intermediate command values.
#define RC_LOST_FBW_MODE
mode to enter when RC is lost while using a mode with RC input
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
#define RADIO_FBW_MODE
Switching between FBW and autopilot is done with RADIO_FBW_MODE: default is to re-use RADIO_MODE...
arch independent LED (Light Emitting Diodes) API
void mcu_event(void)
MCU event functions.
#define RADIO_KILL_SWITCH
#define AP_LOST_FBW_MODE
mode to enter when AP is lost while using autopilot
#define RC_LOST_IN_AUTO_FBW_MODE
mode to enter when AP is lost while using autopilot
static void fbw_safety_check(void)
static void fbw_on_rc_frame(void)
Callback when we received an RC frame.
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
uint8_t autopilot_get_mode(void)
get autopilot mode