|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
31 #include <libopencm3/stm32/can.h>
36 #define ACTUATORS_ESC32_START_DELAY 500
75 #ifdef ACTUAOTRS_ESC32_RPM
135 for (i = 0; i < SERVOS_ESC32_NB; i++) {
152 for (i = 1; i <= (SERVOS_ESC32_NB - 1) / 4 + 1; i++) {
243 char *name =
"DIRECTION";
264 *value = *value * -1;
278 uint32_t timer = (*status_sub & 0x00FFFFFF) << 8;
283 if (*status_sub == 0) {
285 *status_sub = *status_sub >> 8;
291 *status_sub = *status_sub + (1 << 24);
349 data[4] = (i / 4) + 1;
350 data[5] = (i % 4) + 1;
356 if (i >= SERVOS_ESC32_NB - 1) {
359 for (i = 0; i < SERVOS_ESC32_NB; i++) {
362 for (j = 0; j < SERVOS_ESC32_NB; j++) {
static void actuators_esc32_disarm(uint32_t tt, uint8_t tid)
Disarms the ESC.
bool autopilot_get_motors_on(void)
get motors status
#define ESC32_CAN_FID_NACK
struct ESC32_com escs[SERVOS_ESC32_NB]
The ESCs connected via CAN.
#define ACTUATORS_ESC32_START_DELAY
struct ESC32_response responses[ESC32_RESPONSE_CNT]
Responses of CAN messages.
static uint8_t actuators_esc32_send(uint32_t id, uint8_t tid, uint8_t length, uint8_t *data)
Transmit a message on the CAN bus.
static void actuators_esc32_proc_telem(uint8_t *data)
When we receive a telemetry message.
@ ESC32_CAN_DATA_PARAM_NAME1
static void actuators_esc32_start(uint32_t tt, uint8_t tid)
Starts the ESC (let's it turn when armed)
static bool actuators_esc32_play_melody(uint32_t tt, uint8_t tid, uint32_t *status_sub, uint16_t melody[][2], uint8_t length)
Plays a full melody.
#define ESC32_CAN_FID_CMD
@ ESC32_CAN_DATA_PARAM_ID
uint8_t fid
The FID of the response.
@ ESC32_CAN_CMD_SETPOINT16
uint8_t network_id
Index in the array +1.
enum ESC32_esc_status status
The current status of the esc.
#define ESC32_CAN_FID_ACK
enum ESC32_status status
The current status of all actuators.
static void actuators_esc32_grant_idx(uint8_t *data)
When we receive a message to grant an id.
static void actuators_esc32_dir(uint32_t tt, uint8_t tid)
Changes the direction the ESC is turing.
uint8_t config_idx
Selected ESC.
#define ESC32_CAN_TT_GROUP
uint8_t escs_sorted[SERVOS_ESC32_NB]
The ESCs sorted by uuid.
uint32_t uuid
The UUID of the ESC.
static void actuators_esc32_can_rx_cb(uint32_t id, uint8_t *data, int len)
When receiving messages on the CAN bus.
#define ESC32_RESPONSE_CNT
#define ESC32_CAN_FID_TELEM
struct ESC32 actuators_esc32
void actuators_esc32_config_cmd(uint8_t i)
When receiving a configuration setting command.
void actuators_esc32_set(uint8_t i, uint16_t v)
Set the commands (either RPM or duty cycle)
void ppz_can_init(can_rx_callback_t callback)
Architecture independent timing functions.
void actuators_esc32_init(void)
Initializes the ESCs.
#define ESC32_CAN_TT_NODE
static void actuators_esc32_arm(uint32_t tt, uint8_t tid)
Arms the ESC.
#define ESC32_CAN_LCC_NORMAL
#define ESC32_CAN_TID_MASK
#define ESC32_CAN_LCC_EXCEPTION
#define ESC32_CAN_SEQ_MASK
void actuators_esc32_commit(void)
Commits the commands and sends them to the ESCs.
@ ESC32_CAN_DATA_PARAM_NAME2
#define ESC32_CAN_FID_RESET_BUS
#define ESC32_CAN_FID_REPLY
#define ESC32_CAN_FID_REQ_ADDR
#define ESC32_CAN_FID_SET
static void actuators_esc32_beep(uint32_t tt, uint8_t tid, uint16_t freq, uint16_t dur)
Let an ESC beep for a certain amount of time with a specified frequency(frequency doesn't really matc...
static uint16_t actuators_esc32_melody[][2]
uint16_t cmds[SERVOS_ESC32_NB]
Commands which need to be committed.
#define ESC32_CAN_FID_GRANT_ADDR
int ppz_can_transmit(uint32_t id, const uint8_t *buf, uint8_t len)
uint8_t can_id
The CAN identifier.
#define ESC32_CAN_FID_GET
#define ESC32_CAN_LCC_HIGH
uint8_t data[8]
The data of the response.
static uint8_t actuators_esc32_melody_size
uint8_t can_seq_idx
CAN seq ID used for communicating.
#define SysTimeTimerStart(_t)
uint8_t type
The type of ESC.
enum ESC32_config_cmd config_cmd
The command.
static void actuators_esc32_duty(uint32_t tt, uint8_t tid, uint16_t *cmds)
Set the duty cycle of an ESC.
#define ESC32_CAN_FID_MASK
uint32_t melody_status
The status of the melody.