Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
actuators_sts3032.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 Flo&Fab <surname.name@enac.fr>
3 *
4 * This file is part of paparazzi
5 *
6 * paparazzi is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * paparazzi is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with paparazzi; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
26#ifndef SERVO_STS3032_H
27#define SERVO_STS3032_H
28
29#include <stdint.h>
30#include "mcu_periph/uart.h"
32#include "generated/airframe.h"
33
34
40
64
65
66extern struct sts3032 sts;
67
68extern void actuators_sts3032_init(void);
69extern void actuators_sts3032_periodic(void);
70extern void actuators_sts3032_event(void);
71uint8_t id_idx(struct sts3032 *sts, uint8_t id);
72void sts3032_write_pos(struct sts3032 *sts, uint8_t id, int16_t position);
73
74/* Actuator macros */
75#define ActuatorSTS3032Set(_i, _v) { if(sts3032_enabled) {sts3032_write_pos(&sts, sts.ids[_i], _v);} }
76#define ActuatorsSTS3032Init() actuators_sts3032_init()
77#define ActuatorsSTS3032Commit() {}
78
79extern int sts3032_enabled;
80extern int sts3032_current_id;
81extern int sts3032_future_id;
82extern int sts3032_lock_eprom;
83extern int sts3032_move;
84extern int sts3032_response_level;
85
86extern void actuators_sts3032_set_id(float future_id);
87extern void actuators_sts3032_lock_eprom(float lock);
88extern void actuators_sts3032_move(float pos);
90
91#endif // SERVO_STS3032_H
void actuators_sts3032_set_id(float future_id)
uint8_t rx_checksum
uint8_t buf_header[2]
int sts3032_response_level
void actuators_sts3032_init(void)
struct sts3032 sts
uint8_t rx_id
void actuators_sts3032_set_response_level(float level)
void sts3032_write_pos(struct sts3032 *sts, uint8_t id, int16_t position)
int sts3032_current_id
uint8_t nb_bytes_expected
uint16_t pos[SERVOS_STS3032_NB]
int sts3032_enabled
uint8_t states[SERVOS_STS3032_NB]
void actuators_sts3032_event(void)
uint32_t time_last_msg
int sts3032_lock_eprom
struct uart_periph * periph
void actuators_sts3032_move(float pos)
uint16_t nb_failed_checksum
int sts3032_future_id
enum sts3032_rx_state rx_state
struct circular_buffer msg_buf
void actuators_sts3032_lock_eprom(float lock)
uint8_t id_idx(struct sts3032 *sts, uint8_t id)
void actuators_sts3032_periodic(void)
uint8_t ids[SERVOS_STS3032_NB]
sts3032_rx_state
@ STS3032_RX_IDLE
@ STS3032_RX_HEAD_OK
@ STS3032_RX_GOT_LENGTH
int sts3032_move
uint8_t read_addr
This is a general purpose circular buffer for storing buffers in a FIFO order.
uint16_t foo
Definition main_demo5.c:58
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
UART peripheral.
Definition uart.h:72
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.