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

Frame encoders of protocol v2 (see proto_v2.h). More...

#include "proto_v2.h"
#include "telemetry.h"
#include <string.h>
Include dependency graph for proto_v2.c:

Go to the source code of this file.

Functions

size_t pv2_frame (uint8_t type, const void *payload, uint8_t len, uint8_t *out, size_t cap)
 
size_t pv2_event (uint8_t level, uint16_t code, int32_t arg, const char *text, uint8_t *out, size_t cap)
 
size_t pv2_ack (uint8_t op, uint8_t seq, uint8_t result, uint8_t reason, uint8_t *out, size_t cap)
 
size_t pv2_param (uint16_t id, float value, uint8_t flags, uint16_t index, uint16_t count, uint8_t *out, size_t cap)
 
size_t pv2_checks (uint8_t ready, const pv2_check_t *items, uint8_t n, uint8_t *out, size_t cap)
 
size_t pv2_motors (const pv2_motor_t *m, uint8_t n, uint8_t *out, size_t cap)
 
size_t pv2_calib (const pv2_calib_hdr_t *h, const void *data, uint8_t data_len, uint8_t *out, size_t cap)
 
float pv2_rd_f32 (const uint8_t *p)
 

Detailed Description

Frame encoders of protocol v2 (see proto_v2.h).

Definition in file proto_v2.c.

Function Documentation

◆ pv2_frame()

size_t pv2_frame ( uint8_t  type,
const void *  payload,
uint8_t  len,
uint8_t *  out,
size_t  cap 
)

Definition at line 9 of file proto_v2.c.

References cap, and tlm_encode().

Referenced by log_ble_out(), pv2_ack(), pv2_calib(), pv2_checks(), pv2_event(), pv2_motors(), pv2_param(), send_caps(), send_flight(), send_nav(), send_power(), send_system(), and usbl_send_src().

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

◆ pv2_event()

size_t pv2_event ( uint8_t  level,
uint16_t  code,
int32_t  arg,
const char *  text,
uint8_t *  out,
size_t  cap 
)

Definition at line 14 of file proto_v2.c.

References pv2_event_hdr_t::arg, cap, pv2_event_hdr_t::code, pv2_event_hdr_t::len, pv2_event_hdr_t::level, n, PV2_EVENT_TEXT_MAX, pv2_frame(), and PV2_FT_EVENT.

Referenced by send_event().

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

◆ pv2_ack()

size_t pv2_ack ( uint8_t  op,
uint8_t  seq,
uint8_t  result,
uint8_t  reason,
uint8_t *  out,
size_t  cap 
)

Definition at line 26 of file proto_v2.c.

References cap, pv2_frame(), PV2_FT_ACK, result(), and seq.

Referenced by ack_link().

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

◆ pv2_param()

size_t pv2_param ( uint16_t  id,
float  value,
uint8_t  flags,
uint16_t  index,
uint16_t  count,
uint8_t *  out,
size_t  cap 
)

Definition at line 32 of file proto_v2.c.

References cap, pv2_param_t::count, pv2_param_t::flags, id, pv2_param_t::id, pv2_param_t::index, pv2_frame(), PV2_FT_PARAM, and pv2_param_t::value.

Referenced by send_param().

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

◆ pv2_checks()

size_t pv2_checks ( uint8_t  ready,
const pv2_check_t *  items,
uint8_t  n,
uint8_t *  out,
size_t  cap 
)

Definition at line 41 of file proto_v2.c.

References cap, n, PV2_CHECKS_MAX, pv2_frame(), and PV2_FT_CHECKS.

Referenced by send_checks().

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

◆ pv2_motors()

size_t pv2_motors ( const pv2_motor_t *  m,
uint8_t  n,
uint8_t *  out,
size_t  cap 
)

Definition at line 51 of file proto_v2.c.

References cap, n, pv2_frame(), PV2_FT_MOTORS, and PV2_MOTORS_MAX.

Referenced by send_motors().

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

◆ pv2_calib()

size_t pv2_calib ( const pv2_calib_hdr_t *  h,
const void *  data,
uint8_t  data_len,
uint8_t *  out,
size_t  cap 
)

Definition at line 60 of file proto_v2.c.

References cap, pv2_frame(), and PV2_FT_CALIB.

Referenced by cal_frame().

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

◆ pv2_rd_f32()

float pv2_rd_f32 ( const uint8_t *  p)

Definition at line 69 of file proto_v2.c.

Referenced by local_cmd().

Here is the caller graph for this function: