30 #ifndef SYS_TIME_FREQUENCY
31 #error SYS_TIME_FREQUENCY should be defined in Makefile.chibios or airframe.xml and be equal to CH_CFG_ST_FREQUENCY
32 #elif SYS_TIME_FREQUENCY != CH_CFG_ST_FREQUENCY
33 #error SYS_TIME_FREQUENCY should be equal to CH_CFG_ST_FREQUENCY
34 #elif CH_CFG_ST_FREQUENCY < (2 * PERIODIC_FREQUENCY)
35 #error CH_CFG_ST_FREQUENCY and SYS_TIME_FREQUENCY should be >= 2 x PERIODIC_FREQUENCY
40 #define Fbw(f) f ## _fbw()
47 #define Ap(f) f ## _ap()
52 #if USE_HARD_FAULT_RECOVERY
59 static void thd_ap(
void *arg);
77 #if USE_HARD_FAULT_RECOVERY
79 if (!recovering_from_hard_fault) {
82 #if USE_HARD_FAULT_RECOVERY
86 modules_datalink_init();
90 chThdSleepMilliseconds(100);
93 fbwThdPtr = chThdCreateStatic(wa_thd_fbw,
sizeof(wa_thd_fbw), NORMALPRIO,
thd_fbw, NULL);
94 #if USE_HARD_FAULT_RECOVERY
96 if (!recovering_from_hard_fault) {
98 apThdPtr = chThdCreateStatic(wa_thd_ap,
sizeof(wa_thd_ap), NORMALPRIO,
thd_ap, NULL);
99 #if USE_HARD_FAULT_RECOVERY
105 chThdSleepMilliseconds(1000);
118 chRegSetThreadName(
"AP");
120 while (!chThdShouldTerminateX()) {
123 chThdSleepMicroseconds(500);
137 chRegSetThreadName(
"FBW");
139 while (!chThdShouldTerminateX()) {
142 chThdSleepMicroseconds(500);
static void thd_fbw(void *arg)
STATIC_INLINE void handle_periodic_tasks(void)
Architecture independent timing functions.
static void thd_ap(void *arg)
static thread_t * apThdPtr
void pprz_terminate_autopilot_threads(void)
Terminate all autopilot threads Wait until proper stop.
Arch independent mcu ( Micro Controller Unit ) utilities.
Common code for AP and FBW telemetry.
int main(void)
Main function.
static thread_t * fbwThdPtr
static THD_WORKING_AREA(wa_thd_ap, 8192)
FBW ( FlyByWire ) process API.
AP ( AutoPilot ) process API.