Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/esc32/esc32.h"
#include "mcu_periph/uart.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/datalink/downlink.h"
#include <stdio.h>
#include <string.h>
#include "subsystems/datalink/telemetry.h"
Go to the source code of this file.
Data Structures | |
struct | esc32_ck |
struct | esc32_private |
Macros | |
#define | ESC32_BUF_IN_LEN 64 |
#define | ESC32_BUF_OUT_LEN 32 |
#define | ESC32_PARAMS_LEN 10 |
#define | ESC32_TELEMETRY_RATE 100.0 |
#define | UINIT 0 |
#define | GOT_SYNC 1 |
#define | SEARCH_COMMAND 2 |
#define | GET_CMD_ROWS 3 |
#define | GET_CMD_COLS 4 |
#define | GET_COMMAND 5 |
#define | CHECK_CK_A 6 |
#define | CHECK_CK_B 7 |
Functions | |
static void | esc32_send (struct esc32_private *esc) |
static void | esc32_compute_ck (struct esc32_ck *ck, uint8_t c) |
static void | esc32_init_ck (struct esc32_ck *ck) |
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) |
static void | esc32_put_float (struct esc32_private *esc, float f) |
static uint16_t | esc32_send_command (struct esc32_private *esc, enum binaryCommands command, float param1, float param2, int n) |
static void | parse_esc32 (struct esc32_private *esc, uint8_t c) |
static void | esc32_msg_send (struct transport_tx *trans, struct link_device *dev) |
void | esc32_init (void) |
void | esc32_periodic (void) |
static void | esc32_filter_data (struct esc32_parameter *in, struct esc32_parameter *out, struct esc32_parameter *min, struct esc32_parameter *max) |
static void | esc32_parse_msg (struct esc32_private *esc_priv, struct esc32 *esc) |
void | esc32_event (void) |
Variables | |
struct esc32 | esc32 |
static struct esc32_private | esc32_priv |
Definition in file esc32.c.
struct esc32_private |
Data Fields | ||
---|---|---|
uint8_t | buf_in[ESC32_BUF_IN_LEN] | |
uint8_t | buf_out[ESC32_BUF_OUT_LEN] | |
struct esc32_ck | ck_in | |
struct esc32_ck | ck_out | |
uint16_t | cmd_seq_id | |
struct uart_periph * | dev | |
uint8_t | in_cols | |
uint8_t | in_idx | |
uint8_t | in_rows | |
uint8_t | initialized | |
bool | msg_available | |
uint8_t | out_idx | |
struct esc32_parameter | params[ESC32_PARAMS_LEN] | |
uint8_t | params_idx | |
uint8_t | state |
#define CHECK_CK_A 6 |
Definition at line 150 of file esc32.c.
Referenced by parse_esc32().
#define CHECK_CK_B 7 |
Definition at line 151 of file esc32.c.
Referenced by parse_esc32().
#define ESC32_BUF_IN_LEN 64 |
Definition at line 40 of file esc32.c.
Referenced by parse_esc32().
#define ESC32_BUF_OUT_LEN 32 |
Definition at line 41 of file esc32.c.
Referenced by esc32_put_char(), and esc32_send_command().
#define ESC32_PARAMS_LEN 10 |
Definition at line 42 of file esc32.c.
Referenced by esc32_parse_msg().
#define ESC32_TELEMETRY_RATE 100.0 |
Definition at line 43 of file esc32.c.
Referenced by esc32_parse_msg(), and esc32_periodic().
#define GET_CMD_COLS 4 |
Definition at line 148 of file esc32.c.
Referenced by parse_esc32().
#define GET_CMD_ROWS 3 |
Definition at line 147 of file esc32.c.
Referenced by parse_esc32().
#define GET_COMMAND 5 |
Definition at line 149 of file esc32.c.
Referenced by parse_esc32().
#define GOT_SYNC 1 |
Definition at line 145 of file esc32.c.
Referenced by parse_esc32().
#define SEARCH_COMMAND 2 |
Definition at line 146 of file esc32.c.
Referenced by parse_esc32().
#define UINIT 0 |
Definition at line 144 of file esc32.c.
Referenced by parse_esc32().
Definition at line 78 of file esc32.c.
References esc32_ck::ck_a, and esc32_ck::ck_b.
Referenced by esc32_put_char(), and parse_esc32().
void esc32_event | ( | void | ) |
Definition at line 345 of file esc32.c.
References esc32_private::dev, esc32_parse_msg(), esc32_priv, esc32_private::msg_available, parse_esc32(), uart_char_available(), and uart_getch().
|
static |
Definition at line 289 of file esc32.c.
References esc32_parameter::amps, esc32_parameter::rpm, esc32_parameter::volts_bat, and esc32_parameter::volts_motor.
Referenced by esc32_parse_msg().
|
static |
Definition at line 88 of file esc32.c.
References esc32_private::buf_in.
Referenced by esc32_parse_msg().
void esc32_init | ( | void | ) |
Definition at line 235 of file esc32.c.
References esc32_private::cmd_seq_id, DefaultPeriodic, esc32_private::dev, esc32_msg_send(), esc32_priv, and register_periodic_telemetry().
|
static |
Definition at line 83 of file esc32.c.
References esc32_ck::ck_a, and esc32_ck::ck_b.
Referenced by esc32_send_command(), and parse_esc32().
|
static |
Definition at line 224 of file esc32.c.
References esc32_parameter::amps, esc32::energy, esc32::params, esc32::power, esc32_parameter::rpm, esc32_parameter::volts_bat, and esc32_parameter::volts_motor.
Referenced by esc32_init().
|
static |
Definition at line 308 of file esc32.c.
References esc32_parameter::amps, esc32::data_available, esc32::energy, esc32_filter_data(), esc32_get_float(), ESC32_PARAMS_LEN, ESC32_TELEMETRY_RATE, esc32_private::in_cols, esc32_private::in_rows, esc32_private::msg_available, esc32::params, esc32_private::params, esc32_private::params_idx, esc32::power, esc32_parameter::rpm, esc32_parameter::volts_bat, and esc32_parameter::volts_motor.
Referenced by esc32_event().
void esc32_periodic | ( | void | ) |
Definition at line 255 of file esc32.c.
References BINARY_COMMAND_ARM, BINARY_COMMAND_DUTY, BINARY_COMMAND_START, BINARY_COMMAND_STOP, BINARY_COMMAND_TELEM_RATE, BINARY_COMMAND_TELEM_VALUE, BINARY_VALUE_AMPS, BINARY_VALUE_RPM, BINARY_VALUE_VOLTS_BAT, BINARY_VALUE_VOLTS_MOTOR, esc32_private::dev, esc32_priv, esc32_send_command(), ESC32_TELEMETRY_RATE, esc32_private::initialized, and uart_put_byte().
|
static |
Definition at line 98 of file esc32.c.
References esc32_private::buf_out, esc32_private::ck_out, ESC32_BUF_OUT_LEN, esc32_compute_ck(), and esc32_private::out_idx.
Referenced by esc32_put_float(), esc32_put_short(), and esc32_send_command().
|
static |
Definition at line 113 of file esc32.c.
References esc32_put_char().
Referenced by esc32_send_command().
|
static |
Definition at line 105 of file esc32.c.
References esc32_put_char().
Referenced by esc32_send_command().
|
static |
Definition at line 71 of file esc32.c.
References esc32_private::buf_out, esc32_private::dev, esc32_private::out_idx, and uart_put_byte().
Referenced by esc32_send_command().
|
static |
Definition at line 121 of file esc32.c.
References esc32_private::buf_out, esc32_ck::ck_a, esc32_ck::ck_b, esc32_private::ck_out, esc32_private::cmd_seq_id, ESC32_BUF_OUT_LEN, esc32_init_ck(), esc32_put_char(), esc32_put_float(), esc32_put_short(), esc32_send(), and esc32_private::out_idx.
Referenced by esc32_periodic().
|
static |
Definition at line 153 of file esc32.c.
References esc32_private::buf_in, CHECK_CK_A, CHECK_CK_B, esc32_ck::ck_a, esc32_ck::ck_b, esc32_private::ck_in, ESC32_BUF_IN_LEN, esc32_compute_ck(), esc32_init_ck(), GET_CMD_COLS, GET_CMD_ROWS, GET_COMMAND, GOT_SYNC, esc32_private::in_cols, esc32_private::in_idx, esc32_private::in_rows, esc32_private::msg_available, SEARCH_COMMAND, esc32_private::state, and UINIT.
Referenced by esc32_event().
|
static |
Definition at line 68 of file esc32.c.
Referenced by esc32_event(), esc32_init(), and esc32_periodic().