Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
esc32.c File Reference
#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"
+ Include dependency graph for esc32.c:

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
 

Detailed Description

Author
Murat Bronz Serial Connection module between esc32v3 and ap Mainly from Bill Nesbitt's code parts from AutoQuad project

Definition in file esc32.c.


Data Structure Documentation

struct esc32_ck

Definition at line 45 of file esc32.c.

Data Fields
uint8_t ck_a
uint8_t ck_b
struct esc32_private

Definition at line 50 of file esc32.c.

+ Collaboration diagram for 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

Macro Definition Documentation

#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().

Function Documentation

static void esc32_compute_ck ( struct esc32_ck ck,
uint8_t  c 
)
static

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().

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

static void esc32_filter_data ( struct esc32_parameter in,
struct esc32_parameter out,
struct esc32_parameter min,
struct esc32_parameter max 
)
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().

+ Here is the caller graph for this function:

static float esc32_get_float ( struct esc32_private esc,
int  idx 
)
static

Definition at line 88 of file esc32.c.

References esc32_private::buf_in.

Referenced by esc32_parse_msg().

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

static void esc32_init_ck ( struct esc32_ck ck)
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().

+ Here is the caller graph for this function:

static void esc32_msg_send ( struct transport_tx *  trans,
struct link_device *  dev 
)
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().

+ Here is the caller graph for this function:

static void esc32_parse_msg ( struct esc32_private esc_priv,
struct esc32 esc 
)
static
static void esc32_put_char ( struct esc32_private esc,
unsigned char  c 
)
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void esc32_put_float ( struct esc32_private esc,
float  f 
)
static

Definition at line 113 of file esc32.c.

References esc32_put_char().

Referenced by esc32_send_command().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void esc32_put_short ( struct esc32_private esc,
unsigned short  i 
)
static

Definition at line 105 of file esc32.c.

References esc32_put_char().

Referenced by esc32_send_command().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void esc32_send ( struct esc32_private esc)
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint16_t esc32_send_command ( struct esc32_private esc,
enum binaryCommands  command,
float  param1,
float  param2,
int  n 
)
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void parse_esc32 ( struct esc32_private esc,
uint8_t  c 
)
static

Variable Documentation

struct esc32 esc32

Definition at line 38 of file esc32.c.

struct esc32_private esc32_priv
static

Definition at line 68 of file esc32.c.

Referenced by esc32_event(), esc32_init(), and esc32_periodic().