ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
fc_shared.h File Reference

Data exchanged between the flight context (ImuTask) and the AppTask. More...

#include <stdint.h>
#include "calib_mgr.h"
Include dependency graph for fc_shared.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fsh_est_t
 
struct  fsh_apply_t
 calibration to apply (AppTask -> ImuTask) More...
 

Functions

void fsh_est_write (const fsh_est_t *s)
 ImuTask.
 
void fsh_est_read (fsh_est_t *out)
 AppTask: keeps *out on a race.
 
int fsh_cal_push (const cal_sample_t *s)
 
int fsh_cal_pop (cal_sample_t *s)
 
int fsh_apply_post (uint8_t type, const cal_set_t *set)
 
int fsh_apply_take (fsh_apply_t *a)
 
void fsh_reset (void)
 

Variables

volatile uint8_t g_fsh_cal_want
 calibration samples (ImuTask -> AppTask)
 

Detailed Description

Data exchanged between the flight context (ImuTask) and the AppTask.

ImuTask -> AppTask estimator / vertical state (seqlock, never blocks) ImuTask -> AppTask calibration samples (SPSC, only on request) AppTask -> ImuTask calibration to apply (SPSC)

The flight core has its own queues (fc_core.h). Host-testable.

Definition in file fc_shared.h.

Function Documentation

◆ fsh_est_write()

void fsh_est_write ( const fsh_est_t *  s)

ImuTask.

Definition at line 23 of file fc_shared.c.

References s, s_est, s_seq, and SPSC_BARRIER.

Referenced by publish_est().

Here is the caller graph for this function:

◆ fsh_est_read()

void fsh_est_read ( fsh_est_t *  out)

AppTask: keeps *out on a race.

Definition at line 32 of file fc_shared.c.

References s_est, s_seq, and SPSC_BARRIER.

Referenced by build_checks(), events(), log_sensors(), send_flight(), send_nav(), send_system(), and sensors_now().

Here is the caller graph for this function:

◆ fsh_cal_push()

int fsh_cal_push ( const cal_sample_t *  s)

Definition at line 44 of file fc_shared.c.

References s, and spsc_push().

Referenced by on_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsh_cal_pop()

int fsh_cal_pop ( cal_sample_t *  s)

Definition at line 45 of file fc_shared.c.

References s, and spsc_pop().

Referenced by calibration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsh_apply_post()

int fsh_apply_post ( uint8_t  type,
const cal_set_t *  set 
)

Definition at line 47 of file fc_shared.c.

References fsh_apply_t::set, set, spsc_push(), and fsh_apply_t::type.

Referenced by app_task_boot(), and cal_apply().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsh_apply_take()

int fsh_apply_take ( fsh_apply_t *  a)

Definition at line 55 of file fc_shared.c.

References spsc_pop().

Referenced by ImuTask(), and take_calibrations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fsh_reset()

void fsh_reset ( void  )

Definition at line 15 of file fc_shared.c.

References g_fsh_cal_want, s_seq, and spsc_reset().

Referenced by app_task_boot().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_fsh_cal_want

volatile uint8_t g_fsh_cal_want
extern

calibration samples (ImuTask -> AppTask)

AppTask: 1 while samples are needed

Definition at line 7 of file fc_shared.c.

Referenced by calibration(), fsh_reset(), and on_state().