|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
29 #include "generated/airframe.h"
33 #if SERVOS_SBUS_NB > ACTUATORS_SBUS_MAX_NB
34 #error SBUS actuators only support less then 7 servos
38 #if PERIODIC_FREQUENCY < 150
39 #error Sbus actuators need at leest a frequency of 150 Hz
41 static uint8_t freq_trig = PERIODIC_FREQUENCY / 142.0 + 0.5;
68 if (cnt == freq_trig) {
86 #define SBUS_START_BYTE 0x0f
87 #define SBUS_END_BYTE 0x00
89 #define SBUS_BIT_PER_CHANNEL 11
101 for (i = 0; i < 22; i++) {
108 data[ind] |= (chn >> (3 + shift)) & 0xff;
110 data[ind + 1] |= (chn >> (shift - 5)) & 0xff;
111 data[ind + 2] |= (chn << (3 - shift)) &
114 data[ind + 1] |= (chn << (5 - shift)) &
121 for (i = 0; i < 22; i++) {
122 dev->put_byte(
dev->periph, 0, data[i]);
126 dev->put_byte(
dev->periph, 0, 0x00);
#define SBUS_BIT_PER_CHANNEL
struct link_device * device
void uart_periph_set_bits_stop_parity(struct uart_periph *p, uint8_t bits, uint8_t stop, uint8_t parity)
Set parity and stop bits.
struct ActuatorsSbus actuators_sbus
void actuators_sbus_set(void)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
static const struct usb_device_descriptor dev
int32_t cmds[ACTUATORS_SBUS_MAX_NB]
#define ACTUATORS_SBUS_MAX_NB
void actuators_sbus_init(void)
static void actuators_sbus_send(struct link_device *dev)