27 #ifndef RC_SBUS_COMMON_H
28 #define RC_SBUS_COMMON_H
34 #include "generated/airframe.h"
42 #define RC_PPM_TICKS_OF_USEC(_v) ((((_v) - 880) * 8) / 5)
43 #define RC_PPM_SIGNED_TICKS_OF_USEC(_v) (((_v) * 8) / 5)
44 #define USEC_OF_RC_PPM_TICKS(_v) ((((_v) * 5) / 8) + 880)
50 #include "generated/radio.h"
61 #define SBUS_BUF_LENGTH 24
62 #define SBUS_NB_CHANNEL 16
67 #ifndef RADIO_CONTROL_NB_CHANNEL
68 #define RADIO_CONTROL_NB_CHANNEL SBUS_NB_CHANNEL
71 #if RADIO_CONTROL_NB_CHANNEL > SBUS_NB_CHANNEL
72 #error "RADIO_CONTROL_NB_CHANNEL mustn't be higher than 16."
106 #define RadioControlEvent(_received_frame_handler) radio_control_impl_event(_received_frame_handler)
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
uint16_t pulses[SBUS_NB_CHANNEL]
decoded values
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 sbus_common_init(struct Sbus *sbus, struct uart_periph *dev)
Init function.
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_t frame_available
new frame available