34 #if PERIODIC_TELEMETRY
40 #define ESC32_BUF_IN_LEN 64
41 #define ESC32_BUF_OUT_LEN 32
42 #define ESC32_PARAMS_LEN 10
43 #define ESC32_TELEMETRY_RATE 100.0
73 for (i = 0; i < esc->
out_idx; i++) {
90 unsigned char *c = (
unsigned char *)&
f;
92 for (i = 0; i <
sizeof(float); i++)
107 unsigned char *c = (
unsigned char *)&i;
109 for (j = 0; j <
sizeof(short); j++)
115 unsigned char *c = (
unsigned char *)&
f;
117 for (j = 0; j <
sizeof(float); j++)
146 #define SEARCH_COMMAND 2
147 #define GET_CMD_ROWS 3
148 #define GET_CMD_COLS 4
149 #define GET_COMMAND 5
155 switch (esc->
state) {
229 pprz_msg_send_ESC(trans,
dev, AC_ID,
252 #if PERIODIC_TELEMETRY
259 static int debug_start = 0;
268 while (i < (
int)
sizeof(data)) {
Common code for AP and FBW telemetry.
void esc32_periodic(void)
static float esc32_get_float(struct esc32_private *esc, int idx)
static void esc32_msg_send(struct transport_tx *trans, struct link_device *dev)
uint8_t buf_in[ESC32_BUF_IN_LEN]
uint8_t buf_out[ESC32_BUF_OUT_LEN]
static void esc32_init_ck(struct esc32_ck *ck)
static void esc32_parse_msg(struct esc32_private *esc_priv, struct esc32 *esc)
static void esc32_filter_data(struct esc32_parameter *in, struct esc32_parameter *out, struct esc32_parameter *min, struct esc32_parameter *max)
#define ESC32_BUF_OUT_LEN
static void esc32_send(struct esc32_private *esc)
static void esc32_compute_ck(struct esc32_ck *ck, uint8_t c)
static struct esc32_private esc32_priv
struct esc32_parameter params[ESC32_PARAMS_LEN]
static void parse_esc32(struct esc32_private *esc, uint8_t c)
static void esc32_put_float(struct esc32_private *esc, float f)
#define ESC32_TELEMETRY_RATE
static uint16_t esc32_send_command(struct esc32_private *esc, enum binaryCommands command, float param1, float param2, int n)
static void esc32_put_short(struct esc32_private *esc, unsigned short i)
static void esc32_put_char(struct esc32_private *esc, unsigned char c)
float rpm
motor rotation speed
@ BINARY_COMMAND_TELEM_VALUE
@ BINARY_COMMAND_TELEM_RATE
bool data_available
data updated
float amps
current consumption
float energy
accumulated energy
@ BINARY_VALUE_VOLTS_MOTOR
float volts_motor
motor voltage (bat voltage * throttle in % in fact)
float volts_bat
input battery voltage
float power
computed battery power
struct esc32_parameter params
filtered data from the esc
void uart_put_byte(struct uart_periph *periph, long fd, uint8_t data)
int uart_char_available(struct uart_periph *p)
Check UART for available chars in receive buffer.
uint8_t uart_getch(struct uart_periph *p)
static const struct usb_device_descriptor dev
Architecture independent timing functions.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
Periodic telemetry system header (includes downlink utility and generated code).
#define DefaultPeriodic
Set default periodic telemetry.
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)