![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
CMD reception: arrival time, RC store, command queue (see app_link.h). More...
Go to the source code of this file.
Macros | |
| #define | APPL_BARRIER() __sync_synchronize() |
| #define | QMASK (APPL_QUEUE_LEN - 1u) |
Functions | |
| void | appl_reset (void) |
| void | appl_on_cmd_write (const uint8_t *d, uint16_t len, uint32_t now_ms) |
| void | appl_on_connect (void) |
| void | appl_on_disconnect (void) |
| int | appl_pop (appl_cmd_t *out) |
| 1 if a command was taken | |
| uint32_t | appl_queue_dropped (void) |
| uint8_t | appl_ever (void) |
| 1 once any CMD frame arrived | |
| uint32_t | appl_last_ms (void) |
| time of the last CMD frame | |
| uint8_t | appl_link_down (void) |
| GAP disconnected since then | |
| uint32_t | appl_silence_ms (uint32_t now_ms, uint32_t down_floor_ms) |
| Silence seen by the failsafe: now - last CMD frame, at least 'down_floor_ms' while the link is reported down; UINT32_MAX if nothing ever arrived. | |
| int | appl_rc_read (appl_rc_t *out, uint32_t *t_ms) |
| Latest RC values and their arrival time. | |
Variables | |
| static appl_cmd_t | s_q [APPL_QUEUE_LEN] |
| static volatile uint32_t | s_head |
| static volatile uint32_t | s_tail |
| static volatile uint32_t | s_qdrop |
| static volatile uint32_t | s_last_ms |
| static volatile uint8_t | s_ever |
| static volatile uint8_t | s_down |
| static volatile uint32_t | s_rc_seq |
| static volatile uint32_t | s_rc_ms |
| static volatile uint8_t | s_rc_ever |
| static appl_rc_t | s_rc |
CMD reception: arrival time, RC store, command queue (see app_link.h).
Definition in file app_link.c.
| #define APPL_BARRIER | ( | ) | __sync_synchronize() |
Definition at line 12 of file app_link.c.
| #define QMASK (APPL_QUEUE_LEN - 1u) |
Definition at line 15 of file app_link.c.
| void appl_reset | ( | void | ) |
| void appl_on_cmd_write | ( | const uint8_t * | d, |
| uint16_t | len, | ||
| uint32_t | now_ms | ||
| ) |
Definition at line 41 of file app_link.c.
References APPL_BARRIER, APPL_CMD_MAX, APPL_QUEUE_LEN, appl_cmd_t::b, appl_rc_t::buttons, appl_cmd_t::len, appl_rc_t::pitch, PV2_OP_HEARTBEAT, PV2_OP_RC, pv2_rd_i16(), QMASK, appl_rc_t::roll, s_down, s_ever, s_head, s_last_ms, s_q, s_qdrop, s_rc, s_rc_ever, s_rc_ms, s_rc_seq, s_tail, appl_rc_t::thr, and appl_rc_t::yaw.
| void appl_on_connect | ( | void | ) |
Definition at line 81 of file app_link.c.
| void appl_on_disconnect | ( | void | ) |
Definition at line 82 of file app_link.c.
References s_down.
| int appl_pop | ( | appl_cmd_t * | out | ) |
1 if a command was taken
Definition at line 85 of file app_link.c.
References APPL_BARRIER, QMASK, s_head, s_q, and s_tail.
Referenced by commands().
| uint32_t appl_queue_dropped | ( | void | ) |
Definition at line 96 of file app_link.c.
References s_qdrop.
| uint8_t appl_ever | ( | void | ) |
| uint32_t appl_last_ms | ( | void | ) |
| uint8_t appl_link_down | ( | void | ) |
| uint32_t appl_silence_ms | ( | uint32_t | now_ms, |
| uint32_t | down_floor_ms | ||
| ) |
Silence seen by the failsafe: now - last CMD frame, at least 'down_floor_ms' while the link is reported down; UINT32_MAX if nothing ever arrived.
Definition at line 103 of file app_link.c.
References s, s_down, s_ever, and s_last_ms.
Referenced by app_link_failsafe(), and calibration().
| int appl_rc_read | ( | appl_rc_t * | out, |
| uint32_t * | t_ms | ||
| ) |
Latest RC values and their arrival time.
Returns 1 with a consistent copy, 0 if no RC ever arrived (out untouched).
Definition at line 112 of file app_link.c.
References APPL_BARRIER, s_rc, s_rc_ever, s_rc_ms, and s_rc_seq.
Referenced by build_checks(), and update_sticks().
|
static |
Definition at line 20 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_pop(), ext_init(), ext_step(), and ext_take().
|
static |
Definition at line 21 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_pop(), and appl_reset().
|
static |
Definition at line 21 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_pop(), and appl_reset().
|
static |
Definition at line 21 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_queue_dropped(), and appl_reset().
|
static |
Definition at line 23 of file app_link.c.
Referenced by appl_last_ms(), appl_on_cmd_write(), appl_reset(), and appl_silence_ms().
|
static |
Definition at line 24 of file app_link.c.
Referenced by appl_ever(), appl_on_cmd_write(), appl_reset(), and appl_silence_ms().
|
static |
Definition at line 25 of file app_link.c.
Referenced by appl_link_down(), appl_on_cmd_write(), appl_on_disconnect(), appl_reset(), and appl_silence_ms().
|
static |
Definition at line 27 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_rc_read(), and appl_reset().
|
static |
Definition at line 28 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_rc_read(), and appl_reset().
|
static |
Definition at line 29 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_rc_read(), and appl_reset().
|
static |
Definition at line 30 of file app_link.c.
Referenced by appl_on_cmd_write(), appl_rc_read(), and appl_reset().