Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
actuators_sts3032.c File Reference
#include "modules/actuators/actuators_sts3032.h"
#include "modules/datalink/telemetry.h"
#include "string.h"
#include "mcu_periph/uart.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/sys_time_arch.h"
#include <stdint.h>
#include "peripherals/sts3032_regs.h"
+ Include dependency graph for actuators_sts3032.c:

Go to the source code of this file.

Macros

#define STS3032_DEBUG   FALSE
 
#define STS3032_RESPONSE_LEVEL   0
 
#define STS3032_DELAY_MSG   1000
 
#define STS3032_DELAY_MSG_MIN   0
 
#define BUF_MAX_LENGHT   15
 

Functions

static void sts3032_event (struct sts3032 *sts)
 
static void write_buf (struct sts3032 *sts, uint8_t id, uint8_t *data, uint8_t len, uint8_t fun, uint8_t reply)
 
static void handle_reply (struct sts3032 *sts, uint8_t id, uint8_t state, uint8_t *buf_param, uint8_t length)
 
void sts3032_write_pos (struct sts3032 *sts, uint8_t id, int16_t position)
 
void sts3032_read_mem (struct sts3032 *sts, uint8_t id, uint8_t addr, uint8_t len)
 
void sts3032_init (struct sts3032 *sts, struct uart_periph *periph, uint8_t *cbuf, size_t cbuf_len)
 
void sts3032_read_pos (struct sts3032 *sts, uint8_t id)
 
void sts3032_enable_torque (struct sts3032 *sts, uint8_t id, uint8_t enable)
 
void sts3032_lock_eeprom (struct sts3032 *sts, uint8_t id, uint8_t lock)
 
void sts3032_set_response_level (struct sts3032 *sts, uint8_t id, uint8_t level)
 
void sts3032_set_id (struct sts3032 *sts, uint8_t id, uint8_t new_id)
 
void actuators_sts3032_init (void)
 
void actuators_sts3032_event (void)
 
void actuators_sts3032_periodic (void)
 
uint8_t id_idx (struct sts3032 *sts, uint8_t id)
 
void actuators_sts3032_set_id (float future_id)
 
void actuators_sts3032_lock_eprom (float lock)
 
void actuators_sts3032_move (float pos)
 
void actuators_sts3032_set_response_level (float level)
 

Variables

struct sts3032 sts
 
uint8_t cbuf [50 *SERVOS_STS3032_NB]
 
uint8_t buf_rx_param [255]
 
int sts3032_enabled = 1
 
int sts3032_current_id = 1
 
int sts3032_future_id = 1
 
int sts3032_lock_eprom = 1
 
int sts3032_move = 1024
 
int sts3032_response_level = 0
 

Macro Definition Documentation

◆ BUF_MAX_LENGHT

#define BUF_MAX_LENGHT   15

Definition at line 58 of file actuators_sts3032.c.

◆ STS3032_DEBUG

#define STS3032_DEBUG   FALSE

Definition at line 40 of file actuators_sts3032.c.

◆ STS3032_DELAY_MSG

#define STS3032_DELAY_MSG   1000

Definition at line 51 of file actuators_sts3032.c.

◆ STS3032_DELAY_MSG_MIN

#define STS3032_DELAY_MSG_MIN   0

Definition at line 55 of file actuators_sts3032.c.

◆ STS3032_RESPONSE_LEVEL

#define STS3032_RESPONSE_LEVEL   0

Definition at line 44 of file actuators_sts3032.c.

Function Documentation

◆ actuators_sts3032_event()

void actuators_sts3032_event ( void  )

Definition at line 100 of file actuators_sts3032.c.

References sts, and sts3032_event().

+ Here is the call graph for this function:

◆ actuators_sts3032_init()

void actuators_sts3032_init ( void  )

◆ actuators_sts3032_lock_eprom()

void actuators_sts3032_lock_eprom ( float  lock)

Definition at line 321 of file actuators_sts3032.c.

References sts, sts3032_current_id, sts3032_lock_eeprom(), and sts3032_lock_eprom.

+ Here is the call graph for this function:

◆ actuators_sts3032_move()

void actuators_sts3032_move ( float  pos)

Definition at line 327 of file actuators_sts3032.c.

References sts3032::pos, sts, sts3032_current_id, sts3032_move, and sts3032_write_pos().

+ Here is the call graph for this function:

◆ actuators_sts3032_periodic()

void actuators_sts3032_periodic ( void  )

Definition at line 105 of file actuators_sts3032.c.

References DefaultChannel, DefaultDevice, sts3032::ids, sts3032::nb_failed_checksum, sts3032::pos, sts, and sts3032_read_pos().

+ Here is the call graph for this function:

◆ actuators_sts3032_set_id()

void actuators_sts3032_set_id ( float  future_id)

Definition at line 315 of file actuators_sts3032.c.

References sts, sts3032_current_id, sts3032_future_id, and sts3032_set_id().

+ Here is the call graph for this function:

◆ actuators_sts3032_set_response_level()

void actuators_sts3032_set_response_level ( float  level)

Definition at line 333 of file actuators_sts3032.c.

References sts, sts3032_current_id, sts3032_response_level, and sts3032_set_response_level().

+ Here is the call graph for this function:

◆ handle_reply()

static void handle_reply ( struct sts3032 sts,
uint8_t  id,
uint8_t  state,
uint8_t buf_param,
uint8_t  length 
)
static

Definition at line 193 of file actuators_sts3032.c.

References id_idx(), offset, sts3032::pos, sts3032::read_addr, SMS_STS_PRESENT_POSITION_L, state, sts3032::states, and sts.

Referenced by sts3032_event().

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

◆ id_idx()

uint8_t id_idx ( struct sts3032 sts,
uint8_t  id 
)

Definition at line 220 of file actuators_sts3032.c.

References sts3032::ids, and sts.

Referenced by handle_reply().

+ Here is the caller graph for this function:

◆ sts3032_enable_torque()

void sts3032_enable_torque ( struct sts3032 sts,
uint8_t  id,
uint8_t  enable 
)

Definition at line 272 of file actuators_sts3032.c.

References INST_WRITE, SMS_STS_TORQUE_ENABLE, sts, STS3032_RESPONSE_LEVEL, and write_buf().

+ Here is the call graph for this function:

◆ sts3032_event()

◆ sts3032_init()

void sts3032_init ( struct sts3032 sts,
struct uart_periph periph,
uint8_t cbuf,
size_t  cbuf_len 
)

◆ sts3032_lock_eeprom()

void sts3032_lock_eeprom ( struct sts3032 sts,
uint8_t  id,
uint8_t  lock 
)

Definition at line 231 of file actuators_sts3032.c.

References INST_WRITE, SMS_STS_LOCK, sts, STS3032_RESPONSE_LEVEL, and write_buf().

Referenced by actuators_sts3032_lock_eprom().

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

◆ sts3032_read_mem()

void sts3032_read_mem ( struct sts3032 sts,
uint8_t  id,
uint8_t  addr,
uint8_t  len 
)

Definition at line 285 of file actuators_sts3032.c.

References INST_READ, sts3032::read_addr, sts, and write_buf().

Referenced by sts3032_read_pos().

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

◆ sts3032_read_pos()

void sts3032_read_pos ( struct sts3032 sts,
uint8_t  id 
)

Definition at line 280 of file actuators_sts3032.c.

References SMS_STS_PRESENT_POSITION_L, sts, and sts3032_read_mem().

Referenced by actuators_sts3032_periodic().

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

◆ sts3032_set_id()

void sts3032_set_id ( struct sts3032 sts,
uint8_t  id,
uint8_t  new_id 
)

Definition at line 251 of file actuators_sts3032.c.

References INST_WRITE, SMS_STS_ID, sts, STS3032_RESPONSE_LEVEL, and write_buf().

Referenced by actuators_sts3032_set_id().

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

◆ sts3032_set_response_level()

void sts3032_set_response_level ( struct sts3032 sts,
uint8_t  id,
uint8_t  level 
)

Definition at line 241 of file actuators_sts3032.c.

References INST_WRITE, SMS_STS_RESPONSE_LEVEL, sts, STS3032_RESPONSE_LEVEL, and write_buf().

Referenced by actuators_sts3032_set_response_level().

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

◆ sts3032_write_pos()

void sts3032_write_pos ( struct sts3032 sts,
uint8_t  id,
int16_t  position 
)

Definition at line 259 of file actuators_sts3032.c.

References INST_WRITE, SMS_STS_GOAL_POSITION_L, sts, STS3032_RESPONSE_LEVEL, and write_buf().

Referenced by actuators_sts3032_move().

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

◆ write_buf()

static void write_buf ( struct sts3032 sts,
uint8_t  id,
uint8_t data,
uint8_t  len,
uint8_t  fun,
uint8_t  reply 
)
static

Definition at line 292 of file actuators_sts3032.c.

References BUF_MAX_LENGHT, checksum, circular_buffer_put(), sts3032::msg_buf, and sts.

Referenced by sts3032_enable_torque(), sts3032_lock_eeprom(), sts3032_read_mem(), sts3032_set_id(), sts3032_set_response_level(), and sts3032_write_pos().

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

Variable Documentation

◆ buf_rx_param

uint8_t buf_rx_param[255]

Definition at line 59 of file actuators_sts3032.c.

Referenced by sts3032_event().

◆ cbuf

uint8_t cbuf[50 *SERVOS_STS3032_NB]

Definition at line 48 of file actuators_sts3032.c.

Referenced by actuators_sts3032_init().

◆ sts

◆ sts3032_current_id

◆ sts3032_enabled

int sts3032_enabled = 1

Definition at line 64 of file actuators_sts3032.c.

◆ sts3032_future_id

int sts3032_future_id = 1

Definition at line 66 of file actuators_sts3032.c.

Referenced by actuators_sts3032_set_id().

◆ sts3032_lock_eprom

int sts3032_lock_eprom = 1

Definition at line 67 of file actuators_sts3032.c.

Referenced by actuators_sts3032_lock_eprom().

◆ sts3032_move

int sts3032_move = 1024

Definition at line 68 of file actuators_sts3032.c.

Referenced by actuators_sts3032_move().

◆ sts3032_response_level

int sts3032_response_level = 0

Definition at line 69 of file actuators_sts3032.c.

Referenced by actuators_sts3032_set_response_level().