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);
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
Sbus actuator driver, which can output as 7 sbus channels at ~11ms.
void actuators_sbus_set(void)
static void actuators_sbus_send(struct link_device *dev)
struct link_device * device
void actuators_sbus_init(void)
Hardware independent API for actuators (servos, motor controllers).
#define SBUS_BIT_PER_CHANNEL
int32_t cmds[ACTUATORS_SBUS_MAX_NB]
static const struct usb_device_descriptor dev
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.
#define ACTUATORS_SBUS_MAX_NB
struct ActuatorsSbus actuators_sbus