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++)
93 *c++ = esc->
buf_in[idx + 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) {
225 pprz_msg_send_ESC(trans, dev, AC_ID,
245 #if PERIODIC_TELEMETRY
252 static int debug_start = 0;
261 while (i < (
int)
sizeof(data)) {
329 tmp.
rpm = (tmp.
rpm - min.
rpm - max.
rpm) / (ESC32_PARAMS_LEN - 2);
uint8_t buf_in[ESC32_BUF_IN_LEN]
float energy
accumulated energy
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
float volts_bat
input battery voltage
static void esc32_compute_ck(struct esc32_ck *ck, uint8_t c)
Periodic telemetry system header (includes downlink utility and generated code).
uint8_t uart_getch(struct uart_periph *p)
struct esc32_parameter params[ESC32_PARAMS_LEN]
static struct esc32_private esc32_priv
static void esc32_filter_data(struct esc32_parameter *in, struct esc32_parameter *out, struct esc32_parameter *min, struct esc32_parameter *max)
uint16_t uart_char_available(struct uart_periph *p)
Check UART for available chars in receive buffer.
static float esc32_get_float(struct esc32_private *esc, int idx)
static void esc32_put_char(struct esc32_private *esc, unsigned char c)
static void esc32_put_short(struct esc32_private *esc, unsigned short i)
float amps
current consumption
static void esc32_msg_send(struct transport_tx *trans, struct link_device *dev)
static uint16_t esc32_send_command(struct esc32_private *esc, enum binaryCommands command, float param1, float param2, int n)
static void esc32_send(struct esc32_private *esc)
struct esc32_parameter params
filtered data from the esc
Architecture independent timing functions.
static void esc32_init_ck(struct esc32_ck *ck)
static void parse_esc32(struct esc32_private *esc, uint8_t c)
static void esc32_put_float(struct esc32_private *esc, float f)
#define DefaultPeriodic
Set default periodic telemetry.
#define ESC32_TELEMETRY_RATE
float volts_motor
motor voltage (bat voltage * throttle in % in fact)
static const struct usb_device_descriptor dev
void uart_put_byte(struct uart_periph *p, long fd, uint8_t data)
Uart transmit implementation.
void esc32_periodic(void)
uint8_t buf_out[ESC32_BUF_OUT_LEN]
float power
computed battery power
Common code for AP and FBW telemetry.
float rpm
motor rotation speed
static void esc32_parse_msg(struct esc32_private *esc_priv, struct esc32 *esc)
bool data_available
data updated
#define ESC32_BUF_OUT_LEN
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.