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
ioportid_t gpio_port_t
Abstract gpio port type for hardware independent part.
Some architecture independent helper functions for GPIOs.
struct Sbus sbus
SBUS struct.
uint16_t ppm[SBUS_NB_CHANNEL]
Decoded and converted to ppm values.
uint16_t pulses[SBUS_NB_CHANNEL]
Decoded values.
uint32_t start_time
Decoder start time.
bool rc_lost
RC reception is lost.
void sbus_common_init(struct Sbus *sbus, struct uart_periph *dev, gpio_port_t gpio_polarity_port, uint16_t gpio_polarity_pin)
Init function.
uint8_t status
Decoder state-machine status.
uint8_t buffer[SBUS_BUF_LENGTH]
Input buffer.
bool rc_failsafe
Receiver set to in failsafe mode.
#define SBUS_BUF_LENGTH
Generated code holding the description of a given transmitter.
void sbus_common_decode_event(struct Sbus *sbus, struct uart_periph *dev)
Decoding event function.
bool frame_available
A data frame is available.
static const struct usb_device_descriptor dev
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.