PX4 Firmware
PX4 Autopilot Software http://px4.io
linux_sbus::RcInput Class Reference

#include <linux_sbus.h>

Inheritance diagram for linux_sbus::RcInput:
Collaboration diagram for linux_sbus::RcInput:

Public Member Functions

 RcInput ()
 
 ~RcInput ()
 
int start (char *device, int channels)
 
void stop ()
 
bool isRunning ()
 

Private Member Functions

void Run () override
 
void _measure ()
 
int init ()
 

Private Attributes

bool _shouldExit
 
bool _isRunning
 
orb_advert_t _rcinput_pub
 
struct input_rc_s _data
 
uint8_t _sbusData [25]
 
int _channels
 
int _device_fd
 
int _channels_data [16]
 serial port device to read SBUS; More...
 
uint8_t _buffer [25]
 16 channels support; More...
 
char _device [30]
 
bool _failsafe
 
bool _rc_loss
 

Detailed Description

Definition at line 69 of file linux_sbus.h.

Constructor & Destructor Documentation

◆ RcInput()

linux_sbus::RcInput::RcInput ( )
inline

Definition at line 72 of file linux_sbus.h.

References _sbusData.

Referenced by linux_sbus_main().

Here is the caller graph for this function:

◆ ~RcInput()

linux_sbus::RcInput::~RcInput ( )
inline

Definition at line 83 of file linux_sbus.h.

References _device_fd, _isRunning, start(), and stop().

Here is the call graph for this function:

Member Function Documentation

◆ _measure()

void RcInput::_measure ( void  )
private

error counter to count the lost frame

Notice: most sbus rx device support sbus1

parse sbus data to pwm

Definition at line 148 of file linux_sbus.cpp.

References _channels, _channels_data, _data, _device_fd, _rcinput_pub, _sbusData, input_rc_s::channel_count, f(), hrt_absolute_time(), input_rc_s::input_source, ORB_ID, orb_publish(), input_rc_s::rc_failsafe, input_rc_s::rc_lost, input_rc_s::rc_lost_frame_count, input_rc_s::rc_ppm_frame_length, input_rc_s::rc_total_frame_count, RCINPUT_MEASURE_INTERVAL_US, read(), input_rc_s::rssi, SBUS_SCALE_FACTOR, SBUS_SCALE_OFFSET, input_rc_s::timestamp, input_rc_s::timestamp_last_signal, linux_sbus::usage(), and input_rc_s::values.

Referenced by isRunning(), and Run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

int RcInput::init ( )
private

initialize the data of each channel

open the serial port

Setting serial port,8E2, non-blocking.100Kbps

use BOTHER to specify speed directly in c_[io]speed member

Definition at line 43 of file linux_sbus.cpp.

References _data, _device, _device_fd, _rcinput_pub, orb_advertise(), ORB_ID, and input_rc_s::values.

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isRunning()

bool linux_sbus::RcInput::isRunning ( )
inline

Definition at line 93 of file linux_sbus.h.

References _isRunning, _measure(), and Run().

Referenced by linux_sbus_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Run()

void RcInput::Run ( )
overrideprivate

Definition at line 139 of file linux_sbus.cpp.

References _measure(), _shouldExit, and RCINPUT_MEASURE_INTERVAL_US.

Referenced by isRunning().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

int RcInput::start ( char *  device,
int  channels 
)
Returns
0 on success, -errno on failure

Definition at line 108 of file linux_sbus.cpp.

References _channels, _device, _isRunning, and init().

Referenced by linux_sbus_main(), and ~RcInput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void RcInput::stop ( )

Definition at line 132 of file linux_sbus.cpp.

References _device_fd, and _shouldExit.

Referenced by linux_sbus_main(), and ~RcInput().

Here is the caller graph for this function:

Member Data Documentation

◆ _buffer

uint8_t linux_sbus::RcInput::_buffer[25]
private

16 channels support;

Definition at line 109 of file linux_sbus.h.

◆ _channels

int linux_sbus::RcInput::_channels
private

Definition at line 106 of file linux_sbus.h.

Referenced by _measure(), and start().

◆ _channels_data

int linux_sbus::RcInput::_channels_data[16]
private

serial port device to read SBUS;

Definition at line 108 of file linux_sbus.h.

Referenced by _measure().

◆ _data

struct input_rc_s linux_sbus::RcInput::_data
private

Definition at line 104 of file linux_sbus.h.

Referenced by _measure(), and init().

◆ _device

char linux_sbus::RcInput::_device[30]
private

Definition at line 110 of file linux_sbus.h.

Referenced by init(), and start().

◆ _device_fd

int linux_sbus::RcInput::_device_fd
private

Definition at line 107 of file linux_sbus.h.

Referenced by _measure(), init(), stop(), and ~RcInput().

◆ _failsafe

bool linux_sbus::RcInput::_failsafe
private

Definition at line 111 of file linux_sbus.h.

◆ _isRunning

bool linux_sbus::RcInput::_isRunning
private

Definition at line 102 of file linux_sbus.h.

Referenced by isRunning(), start(), and ~RcInput().

◆ _rc_loss

bool linux_sbus::RcInput::_rc_loss
private

Definition at line 112 of file linux_sbus.h.

◆ _rcinput_pub

orb_advert_t linux_sbus::RcInput::_rcinput_pub
private

Definition at line 103 of file linux_sbus.h.

Referenced by _measure(), and init().

◆ _sbusData

uint8_t linux_sbus::RcInput::_sbusData[25]
private

Definition at line 105 of file linux_sbus.h.

Referenced by _measure(), and RcInput().

◆ _shouldExit

bool linux_sbus::RcInput::_shouldExit
private

Definition at line 101 of file linux_sbus.h.

Referenced by Run(), and stop().


The documentation for this class was generated from the following files: