ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
fc_shared.c File Reference
#include "fc_shared.h"
#include "spsc.h"
Include dependency graph for fc_shared.c:

Go to the source code of this file.

Functions

 SPSC_DEFINE (s_calq, cal_sample_t, 32u)
 
 SPSC_DEFINE (s_appq, fsh_apply_t, 4u)
 
void fsh_reset (void)
 
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)
 

Variables

volatile uint8_t g_fsh_cal_want
 calibration samples (ImuTask -> AppTask)
 
static volatile uint32_t s_seq
 
static fsh_est_t s_est
 

Function Documentation

◆ SPSC_DEFINE() [1/2]

SPSC_DEFINE ( s_calq  ,
cal_sample_t  ,
32u   
)

◆ SPSC_DEFINE() [2/2]

SPSC_DEFINE ( s_appq  ,
fsh_apply_t  ,
4u   
)

◆ 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:

◆ 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:

Variable Documentation

◆ g_fsh_cal_want

volatile uint8_t g_fsh_cal_want

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().

◆ s_seq

volatile uint32_t s_seq
static

Definition at line 9 of file fc_shared.c.

Referenced by fsh_est_read(), fsh_est_write(), and fsh_reset().

◆ s_est

fsh_est_t s_est
static

Definition at line 10 of file fc_shared.c.

Referenced by fsh_est_read(), and fsh_est_write().