Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
sbus_common.h File Reference
#include "std.h"
#include "mcu_periph/uart.h"
#include "mcu_periph/gpio.h"
#include "generated/airframe.h"
#include "generated/radio.h"
+ Include dependency graph for sbus_common.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Sbus
 SBUS structure. More...
 

Macros

#define RC_PPM_TICKS_OF_USEC(_v)   ((((_v) - 880) * 8) / 5)
 Macro to use radio.h file. More...
 
#define RC_PPM_SIGNED_TICKS_OF_USEC(_v)   (((_v) * 8) / 5)
 
#define USEC_OF_RC_PPM_TICKS(_v)   ((((_v) * 5) / 8) + 880)
 
#define SBUS_BUF_LENGTH   24
 Generated code holding the description of a given transmitter. More...
 
#define SBUS_NB_CHANNEL   16
 
#define RADIO_CONTROL_NB_CHANNEL   SBUS_NB_CHANNEL
 Default number of channels to actually use. More...
 
#define RadioControlEvent(_received_frame_handler)   radio_control_impl_event(_received_frame_handler)
 Event macro with handler callback. More...
 

Functions

void sbus_common_init (struct Sbus *sbus, struct uart_periph *dev, gpio_port_t gpio_polarity_port, uint16_t gpio_polarity_pin)
 Init function. More...
 
void sbus_common_decode_event (struct Sbus *sbus, struct uart_periph *dev)
 Decoding event function. More...
 
void radio_control_impl_event (void(*_received_frame_handler)(void))
 RC event function with handler callback. More...
 

Detailed Description

Common sbus structs and defines.

Definition in file sbus_common.h.


Data Structure Documentation

◆ Sbus

struct Sbus

SBUS structure.

Definition at line 79 of file sbus_common.h.

Data Fields
uint8_t buffer[SBUS_BUF_LENGTH] Input buffer.
bool frame_available A data frame is available.
uint8_t idx Input index.
uint16_t ppm[SBUS_NB_CHANNEL] Decoded and converted to ppm values.
uint16_t pulses[SBUS_NB_CHANNEL] Decoded values.
bool rc_failsafe Receiver set to in failsafe mode.
bool rc_lost RC reception is lost.
uint32_t start_time Decoder start time.
uint8_t status Decoder state-machine status.

Macro Definition Documentation

◆ RADIO_CONTROL_NB_CHANNEL

#define RADIO_CONTROL_NB_CHANNEL   SBUS_NB_CHANNEL

Default number of channels to actually use.

Definition at line 69 of file sbus_common.h.

◆ RadioControlEvent

#define RadioControlEvent (   _received_frame_handler)    radio_control_impl_event(_received_frame_handler)

Event macro with handler callback.

Definition at line 111 of file sbus_common.h.

◆ RC_PPM_SIGNED_TICKS_OF_USEC

#define RC_PPM_SIGNED_TICKS_OF_USEC (   _v)    (((_v) * 8) / 5)

Definition at line 44 of file sbus_common.h.

◆ RC_PPM_TICKS_OF_USEC

#define RC_PPM_TICKS_OF_USEC (   _v)    ((((_v) - 880) * 8) / 5)

Macro to use radio.h file.

SBUS: 0..1024..2047 (sweep 2048) PPM: 880..1520..2160 (sweep 1280)

Definition at line 43 of file sbus_common.h.

◆ SBUS_BUF_LENGTH

#define SBUS_BUF_LENGTH   24

Generated code holding the description of a given transmitter.

Define number of channels.

SBUS frame always have 16 channels but only the X first one will be available depending of the RC transmitter. The radio XML file is used to assign the input values to RC channels.

Definition at line 62 of file sbus_common.h.

◆ SBUS_NB_CHANNEL

#define SBUS_NB_CHANNEL   16

Definition at line 63 of file sbus_common.h.

◆ USEC_OF_RC_PPM_TICKS

#define USEC_OF_RC_PPM_TICKS (   _v)    ((((_v) * 5) / 8) + 880)

Definition at line 45 of file sbus_common.h.

Function Documentation

◆ radio_control_impl_event()

void radio_control_impl_event ( void(*)(void)  _received_frame_handler)

RC event function with handler callback.

PPM frames are normalized using the IIR filter.

Definition at line 61 of file cc2500_paparazzi.c.

◆ sbus_common_decode_event()

void sbus_common_decode_event ( struct Sbus sbus,
struct uart_periph dev 
)

◆ sbus_common_init()

void sbus_common_init ( struct Sbus sbus,
struct uart_periph dev,
gpio_port_t  gpio_polarity_port,
uint16_t  gpio_polarity_pin 
)