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

Last (op, seq) -> ACK pairs (HANDOVER_FW.md §5, "Sequence and ACK rules"). More...

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

Go to the source code of this file.

Macros

#define ACK_CACHE_LEN   32u
 >= 16 required
 

Enumerations

enum  { ACKC_NEW = 0 , ACKC_PENDING = 1 , ACKC_DONE = 2 }
 

Functions

void ackc_reset (void)
 
uint8_t ackc_begin (uint8_t op, uint8_t seq, uint8_t *result, uint8_t *reason)
 Looks up (op, seq).
 
void ackc_finish (uint8_t op, uint8_t seq, uint8_t result, uint8_t reason)
 Completes the entry (or creates it if it was evicted meanwhile).
 

Detailed Description

Last (op, seq) -> ACK pairs (HANDOVER_FW.md §5, "Sequence and ACK rules").

The app re-sends a command without ACK after 600 ms, twice at most, with the same seq. A repeated (op, seq) must get the cached ACK again and must NOT be executed a second time (a repeated ARM, TAKEOFF or MOTOR_TEST must not happen twice). Entries are PENDING while the flight core has not answered yet: a repeat of a pending command is ignored (its ACK will come).

Host-testable.

Definition in file ack_cache.h.

Macro Definition Documentation

◆ ACK_CACHE_LEN

#define ACK_CACHE_LEN   32u

>= 16 required

Definition at line 18 of file ack_cache.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ACKC_NEW 
ACKC_PENDING 
ACKC_DONE 

Definition at line 19 of file ack_cache.h.

Function Documentation

◆ ackc_reset()

void ackc_reset ( void  )

Definition at line 12 of file ack_cache.c.

References s_clock, and s_e.

Referenced by app_init(), and app_step().

Here is the caller graph for this function:

◆ ackc_begin()

uint8_t ackc_begin ( uint8_t  op,
uint8_t  seq,
uint8_t *  result,
uint8_t *  reason 
)

Looks up (op, seq).

ACKC_DONE: result/reason filled, re-send them. ACKC_PENDING: ignore. ACKC_NEW: a pending entry was created, execute it.

Definition at line 31 of file ack_cache.c.

References ACKC_DONE, ACKC_NEW, ACKC_PENDING, entry_t::age, find(), entry_t::op, entry_t::reason, result(), entry_t::result, s_clock, seq, entry_t::seq, slot(), entry_t::state, and entry_t::used.

Referenced by commands(), and usb_commands().

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

◆ ackc_finish()

void ackc_finish ( uint8_t  op,
uint8_t  seq,
uint8_t  result,
uint8_t  reason 
)

Completes the entry (or creates it if it was evicted meanwhile).

Definition at line 44 of file ack_cache.c.

References ACKC_DONE, entry_t::age, find(), entry_t::op, entry_t::reason, result(), entry_t::result, s_clock, seq, entry_t::seq, slot(), entry_t::state, and entry_t::used.

Referenced by ack_link().

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