27 #ifndef RC_SBUS_COMMON_H
28 #define RC_SBUS_COMMON_H
35 #include "generated/airframe.h"
43 #define RC_PPM_TICKS_OF_USEC(_v) ((((_v) - 880) * 8) / 5)
44 #define RC_PPM_SIGNED_TICKS_OF_USEC(_v) (((_v) * 8) / 5)
45 #define USEC_OF_RC_PPM_TICKS(_v) ((((_v) * 5) / 8) + 880)
51 #include "generated/radio.h"
62 #define SBUS_BUF_LENGTH 24
63 #define SBUS_NB_CHANNEL 16
68 #ifndef RADIO_CONTROL_NB_CHANNEL
69 #define RADIO_CONTROL_NB_CHANNEL SBUS_NB_CHANNEL
72 #if RADIO_CONTROL_NB_CHANNEL > SBUS_NB_CHANNEL
73 #error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 16."
108 #define RadioControlEvent(_received_frame_handler) radio_control_impl_event(_received_frame_handler)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void sbus_common_init(struct Sbus *sbus, struct uart_periph *dev, gpio_port_t gpio_polarity_port, uint16_t gpio_polarity_pin)
Init function.
uint16_t pulses[SBUS_NB_CHANNEL]
decoded values
Some architecture independent helper functions for GPIOs.
ioportid_t gpio_port_t
Abstract gpio port type for hardware independent part.
uint8_t status
decoder state machine status
struct Sbus sbus
SBUS struct.
#define SBUS_BUF_LENGTH
Generated code holding the description of a given transmitter.
void radio_control_impl_event(void(*_received_frame_handler)(void))
RC event function with handler callback.
uint16_t ppm[SBUS_NB_CHANNEL]
decoded and converted values
static const struct usb_device_descriptor dev
uint8_t buffer[SBUS_BUF_LENGTH]
input buffer
void sbus_common_decode_event(struct Sbus *sbus, struct uart_periph *dev)
Decoding event function.
bool frame_available
new frame available