Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Common sbus structs and defines. More...
#include "std.h"
#include "mcu_periph/uart.h"
#include "mcu_periph/gpio.h"
#include "generated/airframe.h"
#include "generated/radio.h"
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 |
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... | |
Common sbus structs and defines.
Definition in file sbus_common.h.
struct Sbus |
SBUS structure.
Definition at line 68 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. |
#define RC_PPM_SIGNED_TICKS_OF_USEC | ( | _v | ) | (((_v) * 8) / 5) |
Definition at line 44 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 43 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 62 of file sbus_common.h.
#define SBUS_NB_CHANNEL 16 |
Definition at line 63 of file sbus_common.h.
#define USEC_OF_RC_PPM_TICKS | ( | _v | ) | ((((_v) * 5) / 8) + 880) |
Definition at line 45 of file sbus_common.h.
void sbus_common_decode_event | ( | struct Sbus * | sbus, |
struct uart_periph * | dev | ||
) |
Decoding event function.
Definition at line 139 of file sbus_common.c.
References Sbus::buffer, decode_sbus_buffer(), dev, Sbus::frame_available, get_sys_time_msec(), Sbus::idx, Sbus::ppm, Sbus::pulses, Sbus::rc_failsafe, Sbus::rc_lost, SBUS_BUF_LENGTH, SBUS_END_BYTE_0, SBUS_END_BYTE_1, SBUS_END_BYTE_2, SBUS_END_BYTE_3, SBUS_END_BYTE_4, SBUS_END_BYTE_5, SBUS_START_BYTE, SBUS_STATUS_GOT_START, SBUS_STATUS_UNINIT, SBUS_TIMEOUT_MS, Sbus::start_time, Sbus::status, uart_char_available(), and uart_getch().
Referenced by sbus_decode_event(), and sbus_dual_decode_event().
void sbus_common_init | ( | struct Sbus * | sbus, |
struct uart_periph * | dev, | ||
gpio_port_t | gpio_polarity_port, | ||
uint16_t | gpio_polarity_pin | ||
) |
Init function.
Definition at line 74 of file sbus_common.c.
References B100000, dev, Sbus::frame_available, gpio_setup_output(), Sbus::rc_failsafe, Sbus::rc_lost, RC_SET_POLARITY, SBUS_STATUS_UNINIT, Sbus::start_time, Sbus::status, uart_periph_invert_data_logic(), uart_periph_set_baudrate(), uart_periph_set_bits_stop_parity(), UBITS_8, UPARITY_EVEN, and USTOP_2.
Referenced by sbus_dual_init(), and sbus_init().