35 #define SBUS_START_BYTE 0x0f
36 #define SBUS_END_BYTE 0x00
37 #define SBUS_BIT_PER_CHANNEL 11
38 #define SBUS_BIT_PER_BYTE 8
39 #define SBUS_FLAGS_BYTE 22
40 #define SBUS_FRAME_LOST_BIT 2
42 #define SBUS_STATUS_UNINIT 0
43 #define SBUS_STATUS_GOT_START 1
52 #ifndef RC_SET_POLARITY
53 #define RC_SET_POLARITY gpio_set
67 #ifdef RC_POLARITY_GPIO_PORT
90 if (src[byteInRawBuf] & (1 << bitInRawBuf)) {
91 dst[
channel] |= (1 << bitInChannel);
103 #if PERIODIC_TELEMETRY
void sbus_common_decode_event(struct Sbus *sbus_p, struct uart_periph *dev)
Decoding event function.
#define SBUS_BIT_PER_BYTE
#define RC_POLARITY_GPIO_PIN
#define RC_SET_POLARITY
Set polarity using RC_POLARITY_GPIO.
uint16_t pulses[SBUS_NB_CHANNEL]
decoded values
Some architecture independent helper functions for GPIOs.
uint16_t uart_char_available(struct uart_periph *p)
Check UART for available chars in receive buffer.
#define SBUS_STATUS_UNINIT
uint8_t status
decoder state machine status
void uart_periph_set_baudrate(struct uart_periph *periph, uint32_t baud)
#define RC_POLARITY_GPIO_PORT
#define SBUS_BUF_LENGTH
Generated code holding the description of a given transmitter.
void sbus_common_init(struct Sbus *sbus_p, struct uart_periph *dev)
Init function.
void uart_periph_set_bits_stop_parity(struct uart_periph *p, uint8_t bits, uint8_t stop, uint8_t parity)
#define USEC_OF_RC_PPM_TICKS(_v)
Common sbus structs and defines.
uint16_t ppm[SBUS_NB_CHANNEL]
decoded and converted values
uint8_t uart_getch(struct uart_periph *p)
static void decode_sbus_buffer(const uint8_t *src, uint16_t *dst, bool_t *available, uint16_t *dstppm)
Decode the raw buffer.
static const struct usb_device_descriptor dev
#define SBUS_STATUS_GOT_START
uint8_t buffer[SBUS_BUF_LENGTH]
input buffer
#define SBUS_FRAME_LOST_BIT
void gpio_setup_output(uint32_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
#define SBUS_BIT_PER_CHANNEL
bool_t frame_available
new frame available