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 #ifndef AP_THREAD_STACK_SIZE
60 #define AP_THREAD_STACK_SIZE 8192
66 static void thd_ap(
void *arg);
73 #ifndef FBW_THREAD_STACK_SIZE
74 #define FBW_THREAD_STACK_SIZE 1024
91 #if USE_HARD_FAULT_RECOVERY
93 if (!recovering_from_hard_fault) {
96 #if USE_HARD_FAULT_RECOVERY
100 modules_datalink_init();
104 chThdSleepMilliseconds(100);
107 fbwThdPtr = chThdCreateStatic(wa_thd_fbw,
sizeof(wa_thd_fbw), NORMALPRIO,
thd_fbw, NULL);
108 #if USE_HARD_FAULT_RECOVERY
110 if (!recovering_from_hard_fault) {
112 apThdPtr = chThdCreateStatic(wa_thd_ap,
sizeof(wa_thd_ap), NORMALPRIO,
thd_ap, NULL);
113 #if USE_HARD_FAULT_RECOVERY
119 chThdSleepMilliseconds(1000);
132 chRegSetThreadName(
"AP");
134 while (!chThdShouldTerminateX()) {
137 chThdSleepMicroseconds(500);
151 chRegSetThreadName(
"FBW");
153 while (!chThdShouldTerminateX()) {
156 chThdSleepMicroseconds(500);
static void thd_fbw(void *arg)
static THD_WORKING_AREA(wa_thd_ap, AP_THREAD_STACK_SIZE)
STATIC_INLINE void handle_periodic_tasks(void)
#define FBW_THREAD_STACK_SIZE
#define AP_THREAD_STACK_SIZE
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
FBW ( FlyByWire ) process API.
AP ( AutoPilot ) process API.