Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sbus_common.h File Reference

Futaba SBUS decoder. More...

#include "std.h"
#include "mcu_periph/uart.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
 

Functions

void sbus_common_init (struct _sbus *sbus, struct uart_periph *dev)
 Init function. More...
 
void sbus_common_decode_event (struct _sbus *sbus, struct uart_periph *dev)
 Decoding event function. More...
 

Detailed Description

Futaba SBUS decoder.

Definition in file sbus_common.h.

Macro Definition Documentation

#define RADIO_CONTROL_NB_CHANNEL   SBUS_NB_CHANNEL

Definition at line 60 of file sbus_common.h.

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

Definition at line 40 of file sbus_common.h.

#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 39 of file sbus_common.h.

#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 58 of file sbus_common.h.

Referenced by sbus_common_decode_event().

#define SBUS_NB_CHANNEL   16

Definition at line 59 of file sbus_common.h.

Referenced by decode_sbus_buffer().

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

Definition at line 41 of file sbus_common.h.

Function Documentation

void sbus_common_decode_event ( struct _sbus sbus,
struct uart_periph dev 
)

Decoding event function.

Definition at line 114 of file sbus_common.c.

References _sbus::buffer, decode_sbus_buffer(), _sbus::frame_available, _sbus::idx, _sbus::ppm, _sbus::pulses, SBUS_BUF_LENGTH, SBUS_END_BYTE, SBUS_START_BYTE, SBUS_STATUS_GOT_START, SBUS_STATUS_UNINIT, _sbus::status, uart_char_available(), and uart_getch().

Referenced by sbus_decode_event(), and sbus_dual_decode_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void sbus_common_init ( struct _sbus sbus,
struct uart_periph dev 
)

Init function.

Definition at line 58 of file sbus_common.c.

References B100000, FALSE, _sbus::frame_available, gpio_setup_output(), RC_POLARITY_GPIO_PIN, RC_POLARITY_GPIO_PORT, RC_SET_POLARITY, SBUS_STATUS_UNINIT, _sbus::status, uart_periph_set_baudrate(), uart_periph_set_bits_stop_parity(), UBITS_8, UPARITY_EVEN, and USTOP_2.

Referenced by radio_control_impl_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: