Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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 <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)
void actuators_sts3032_set (uint8_t idx, int16_t value)
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.

Referenced by sts3032_event(), and write_buf().

◆ 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.

Referenced by sts3032_event().

◆ STS3032_DELAY_MSG_MIN

#define STS3032_DELAY_MSG_MIN   0

Definition at line 55 of file actuators_sts3032.c.

Referenced by sts3032_event().

◆ STS3032_RESPONSE_LEVEL

#define STS3032_RESPONSE_LEVEL   0

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 )

Definition at line 88 of file actuators_sts3032.c.

References cbuf, framed_ring_buffer_init(), sts, and STS3032_RX_IDLE.

Here is the call graph for this function:

◆ actuators_sts3032_lock_eprom()

void actuators_sts3032_lock_eprom ( float lock)

Definition at line 327 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 333 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, sts, and sts3032_read_pos().

Here is the call graph for this function:

◆ actuators_sts3032_set()

void actuators_sts3032_set ( uint8_t idx,
int16_t value )

Definition at line 123 of file actuators_sts3032.c.

References idx, sts, sts3032_enabled, and sts3032_write_pos().

Here is the call graph for this function:

◆ actuators_sts3032_set_id()

void actuators_sts3032_set_id ( float future_id)

Definition at line 321 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 339 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()

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

Definition at line 199 of file actuators_sts3032.c.

References id_idx(), offset, SMS_STS_PRESENT_POSITION_L, state, 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 226 of file actuators_sts3032.c.

References 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 278 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()

void sts3032_event ( struct sts3032 * sts)
static

◆ sts3032_init()

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

References cbuf, and sts.

◆ sts3032_lock_eeprom()

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

Definition at line 237 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 291 of file actuators_sts3032.c.

References INST_READ, 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 286 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 257 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 247 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 265 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(), and actuators_sts3032_set().

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

◆ write_buf()

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 298 of file actuators_sts3032.c.

References BUF_MAX_LENGHT, checksum, framed_ring_buffer_put(), 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(), and sts3032_init().

◆ sts

◆ sts3032_current_id

◆ sts3032_enabled

int sts3032_enabled = 1

Definition at line 64 of file actuators_sts3032.c.

Referenced by actuators_sts3032_set().

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