APM:Libraries
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PX4::PX4RCOutput Class Reference

#include <RCOutput.h>

Inheritance diagram for PX4::PX4RCOutput:
[legend]
Collaboration diagram for PX4::PX4RCOutput:
[legend]

Public Member Functions

void init () override
 
void set_freq (uint32_t chmask, uint16_t freq_hz) override
 
uint16_t get_freq (uint8_t ch) override
 
void enable_ch (uint8_t ch) override
 
void disable_ch (uint8_t ch) override
 
void write (uint8_t ch, uint16_t period_us) override
 
uint16_t read (uint8_t ch) override
 
void read (uint16_t *period_us, uint8_t len) override
 
uint16_t read_last_sent (uint8_t ch) override
 
void read_last_sent (uint16_t *period_us, uint8_t len) override
 
void set_safety_pwm (uint32_t chmask, uint16_t period_us) override
 
void set_failsafe_pwm (uint32_t chmask, uint16_t period_us) override
 
bool force_safety_on (void) override
 
void force_safety_off (void) override
 
void force_safety_no_wait (void) override
 
void set_esc_scaling (uint16_t min_pwm, uint16_t max_pwm) override
 
bool get_esc_scaling (uint16_t &min_pwm, uint16_t &max_pwm) override
 
float scale_esc_to_unity (uint16_t pwm) override
 
void cork ()
 
void push ()
 
void set_output_mode (uint16_t mask, enum output_mode mode) override
 
void timer_tick (void) override
 
bool enable_px4io_sbus_out (uint16_t rate_hz) override
 
void set_default_rate (uint16_t rate_hz) override
 
- Public Member Functions inherited from AP_HAL::RCOutput
virtual bool serial_setup_output (uint8_t chan, uint32_t baudrate)
 
virtual bool serial_write_bytes (const uint8_t *bytes, uint16_t len)
 
virtual uint16_t serial_read_bytes (uint8_t *buf, uint16_t len)
 
virtual void serial_end (void)
 
virtual void set_telem_request_mask (uint16_t mask)
 

Private Member Functions

void _init_alt_channels (void)
 
void _arm_actuators (bool arm)
 
void set_freq_fd (int fd, uint32_t chmask, uint16_t freq_hz, uint32_t &rate_mask)
 
void _send_outputs (void)
 
void force_safety_pending_requests (void)
 

Private Attributes

int _pwm_fd
 
int _alt_fd
 
uint16_t _freq_hz
 
uint16_t _period [PX4_NUM_OUTPUT_CHANNELS]
 
uint16_t _last_sent [PX4_NUM_OUTPUT_CHANNELS]
 
volatile uint8_t _max_channel
 
volatile bool _need_update
 
bool _sbus_enabled:1
 
perf_counter_t _perf_rcout
 
uint32_t _last_output
 
uint32_t _last_config_us
 
unsigned _servo_count
 
unsigned _alt_servo_count
 
uint32_t _rate_mask_main
 
uint32_t _rate_mask_alt
 
uint16_t _enabled_channels
 
uint32_t _period_max
 
uint32_t _last_safety_options_check_ms
 
uint16_t _last_safety_options = 0xFFFF
 
struct {
   int   pwm_sub
 
   actuator_outputs_s   outputs
 
_outputs [ORB_MULTI_MAX_INSTANCES]
 
actuator_armed_s _armed
 
orb_advert_t _actuator_armed_pub
 
uint16_t _esc_pwm_min
 
uint16_t _esc_pwm_max
 
bool _corking
 
enum output_mode _output_mode = MODE_PWM_NORMAL
 
enum AP_HAL::Util::safety_state _safety_state_request = AP_HAL::Util::SAFETY_NONE
 
uint32_t _safety_state_request_last_ms = 0
 
uint16_t _default_rate_hz = 50
 

Additional Inherited Members

- Public Types inherited from AP_HAL::RCOutput
enum  output_mode {
  MODE_PWM_NONE, MODE_PWM_NORMAL, MODE_PWM_ONESHOT, MODE_PWM_ONESHOT125,
  MODE_PWM_BRUSHED, MODE_PWM_DSHOT150, MODE_PWM_DSHOT300, MODE_PWM_DSHOT600,
  MODE_PWM_DSHOT1200
}
 

Detailed Description

Definition at line 10 of file RCOutput.h.

Member Function Documentation

◆ _arm_actuators()

void PX4RCOutput::_arm_actuators ( bool  arm)
private

Definition at line 437 of file RCOutput.cpp.

Referenced by _send_outputs().

Here is the caller graph for this function:

◆ _init_alt_channels()

void PX4RCOutput::_init_alt_channels ( void  )
private

Definition at line 77 of file RCOutput.cpp.

Referenced by enable_ch().

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

◆ _send_outputs()

void PX4RCOutput::_send_outputs ( void  )
private

Definition at line 461 of file RCOutput.cpp.

Referenced by push(), and timer_tick().

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

◆ cork()

void PX4RCOutput::cork ( void  )
virtual

Implements AP_HAL::RCOutput.

Definition at line 538 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

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

◆ disable_ch()

void PX4RCOutput::disable_ch ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 233 of file RCOutput.cpp.

◆ enable_ch()

void PX4RCOutput::enable_ch ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 215 of file RCOutput.cpp.

Here is the call graph for this function:

◆ enable_px4io_sbus_out()

bool PX4RCOutput::enable_px4io_sbus_out ( uint16_t  rate_hz)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 577 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

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

◆ force_safety_no_wait()

void PX4RCOutput::force_safety_no_wait ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 332 of file RCOutput.cpp.

Here is the call graph for this function:

◆ force_safety_off()

void PX4RCOutput::force_safety_off ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 282 of file RCOutput.cpp.

◆ force_safety_on()

bool PX4RCOutput::force_safety_on ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 275 of file RCOutput.cpp.

◆ force_safety_pending_requests()

void PX4RCOutput::force_safety_pending_requests ( void  )
private

Definition at line 288 of file RCOutput.cpp.

Referenced by force_safety_no_wait(), and timer_tick().

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

◆ get_esc_scaling()

bool PX4::PX4RCOutput::get_esc_scaling ( uint16_t &  min_pwm,
uint16_t &  max_pwm 
)
inlineoverridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 32 of file RCOutput.h.

◆ get_freq()

uint16_t PX4RCOutput::get_freq ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 201 of file RCOutput.cpp.

◆ init()

void PX4RCOutput::init ( void  )
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 28 of file RCOutput.cpp.

Here is the call graph for this function:

◆ push()

void PX4RCOutput::push ( void  )
virtual

Implements AP_HAL::RCOutput.

Definition at line 547 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

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

◆ read() [1/2]

uint16_t PX4RCOutput::read ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 393 of file RCOutput.cpp.

Referenced by read().

Here is the caller graph for this function:

◆ read() [2/2]

void PX4RCOutput::read ( uint16_t *  period_us,
uint8_t  len 
)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 411 of file RCOutput.cpp.

Here is the call graph for this function:

◆ read_last_sent() [1/2]

uint16_t PX4RCOutput::read_last_sent ( uint8_t  ch)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 418 of file RCOutput.cpp.

Referenced by read_last_sent().

Here is the caller graph for this function:

◆ read_last_sent() [2/2]

void PX4RCOutput::read_last_sent ( uint16_t *  period_us,
uint8_t  len 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 427 of file RCOutput.cpp.

Here is the call graph for this function:

◆ scale_esc_to_unity()

float PX4::PX4RCOutput::scale_esc_to_unity ( uint16_t  pwm)
inlineoverridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 37 of file RCOutput.h.

Here is the call graph for this function:

◆ set_default_rate()

void PX4RCOutput::set_default_rate ( uint16_t  rate_hz)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 654 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

Here is the caller graph for this function:

◆ set_esc_scaling()

void PX4::PX4RCOutput::set_esc_scaling ( uint16_t  min_pwm,
uint16_t  max_pwm 
)
inlineoverridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 28 of file RCOutput.h.

◆ set_failsafe_pwm()

void PX4RCOutput::set_failsafe_pwm ( uint32_t  chmask,
uint16_t  period_us 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 259 of file RCOutput.cpp.

Here is the call graph for this function:

◆ set_freq()

void PX4RCOutput::set_freq ( uint32_t  chmask,
uint16_t  freq_hz 
)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 173 of file RCOutput.cpp.

Here is the call graph for this function:

◆ set_freq_fd()

void PX4RCOutput::set_freq_fd ( int  fd,
uint32_t  chmask,
uint16_t  freq_hz,
uint32_t &  rate_mask 
)
private

Definition at line 98 of file RCOutput.cpp.

Referenced by set_freq(), and set_output_mode().

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

◆ set_output_mode()

void PX4RCOutput::set_output_mode ( uint16_t  mask,
enum output_mode  mode 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 601 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

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

◆ set_safety_pwm()

void PX4RCOutput::set_safety_pwm ( uint32_t  chmask,
uint16_t  period_us 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 243 of file RCOutput.cpp.

Here is the call graph for this function:

◆ timer_tick()

void PX4RCOutput::timer_tick ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 563 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

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

◆ write()

void PX4RCOutput::write ( uint8_t  ch,
uint16_t  period_us 
)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 340 of file RCOutput.cpp.

Referenced by _send_outputs().

Here is the caller graph for this function:

Member Data Documentation

◆ _actuator_armed_pub

orb_advert_t PX4::PX4RCOutput::_actuator_armed_pub
private

Definition at line 79 of file RCOutput.h.

Referenced by _arm_actuators().

◆ _alt_fd

int PX4::PX4RCOutput::_alt_fd
private

◆ _alt_servo_count

unsigned PX4::PX4RCOutput::_alt_servo_count
private

Definition at line 66 of file RCOutput.h.

Referenced by _init_alt_channels(), _send_outputs(), and init().

◆ _armed

actuator_armed_s PX4::PX4RCOutput::_armed
private

Definition at line 77 of file RCOutput.h.

Referenced by _arm_actuators().

◆ _corking

bool PX4::PX4RCOutput::_corking
private

Definition at line 86 of file RCOutput.h.

Referenced by cork(), push(), and timer_tick().

◆ _default_rate_hz

uint16_t PX4::PX4RCOutput::_default_rate_hz = 50
private

Definition at line 92 of file RCOutput.h.

Referenced by set_default_rate().

◆ _enabled_channels

uint16_t PX4::PX4RCOutput::_enabled_channels
private

Definition at line 69 of file RCOutput.h.

Referenced by _send_outputs(), disable_ch(), enable_ch(), and write().

◆ _esc_pwm_max

uint16_t PX4::PX4RCOutput::_esc_pwm_max
private

Definition at line 81 of file RCOutput.h.

Referenced by get_esc_scaling(), scale_esc_to_unity(), set_esc_scaling(), and write().

◆ _esc_pwm_min

uint16_t PX4::PX4RCOutput::_esc_pwm_min
private

Definition at line 80 of file RCOutput.h.

Referenced by get_esc_scaling(), scale_esc_to_unity(), set_esc_scaling(), and write().

◆ _freq_hz

uint16_t PX4::PX4RCOutput::_freq_hz
private

Definition at line 54 of file RCOutput.h.

Referenced by get_freq(), and set_freq_fd().

◆ _last_config_us

uint32_t PX4::PX4RCOutput::_last_config_us
private

Definition at line 64 of file RCOutput.h.

Referenced by _send_outputs().

◆ _last_output

uint32_t PX4::PX4RCOutput::_last_output
private

Definition at line 63 of file RCOutput.h.

Referenced by _send_outputs().

◆ _last_safety_options

uint16_t PX4::PX4RCOutput::_last_safety_options = 0xFFFF
private

Definition at line 72 of file RCOutput.h.

Referenced by force_safety_pending_requests().

◆ _last_safety_options_check_ms

uint32_t PX4::PX4RCOutput::_last_safety_options_check_ms
private

Definition at line 71 of file RCOutput.h.

Referenced by force_safety_pending_requests().

◆ _last_sent

uint16_t PX4::PX4RCOutput::_last_sent[PX4_NUM_OUTPUT_CHANNELS]
private

Definition at line 58 of file RCOutput.h.

Referenced by enable_ch(), init(), read_last_sent(), and write().

◆ _max_channel

volatile uint8_t PX4::PX4RCOutput::_max_channel
private

Definition at line 59 of file RCOutput.h.

Referenced by _send_outputs(), and write().

◆ _need_update

volatile bool PX4::PX4RCOutput::_need_update
private

Definition at line 60 of file RCOutput.h.

Referenced by _send_outputs(), and write().

◆ _output_mode

enum output_mode PX4::PX4RCOutput::_output_mode = MODE_PWM_NORMAL
private

Definition at line 87 of file RCOutput.h.

Referenced by push(), set_freq(), set_freq_fd(), set_output_mode(), timer_tick(), and write().

◆ _outputs

struct { ... } PX4::PX4RCOutput::_outputs[ORB_MULTI_MAX_INSTANCES]

Referenced by _send_outputs(), init(), and read().

◆ _perf_rcout

perf_counter_t PX4::PX4RCOutput::_perf_rcout
private

Definition at line 62 of file RCOutput.h.

Referenced by _send_outputs(), and init().

◆ _period

uint16_t PX4::PX4RCOutput::_period[PX4_NUM_OUTPUT_CHANNELS]
private

Definition at line 55 of file RCOutput.h.

Referenced by _send_outputs(), disable_ch(), enable_ch(), init(), read(), and write().

◆ _period_max

uint32_t PX4::PX4RCOutput::_period_max
private

Definition at line 70 of file RCOutput.h.

Referenced by set_freq_fd(), and write().

◆ _pwm_fd

int PX4::PX4RCOutput::_pwm_fd
private

◆ _rate_mask_alt

uint32_t PX4::PX4RCOutput::_rate_mask_alt
private

Definition at line 68 of file RCOutput.h.

Referenced by get_freq(), init(), set_freq(), set_output_mode(), and write().

◆ _rate_mask_main

uint32_t PX4::PX4RCOutput::_rate_mask_main
private

Definition at line 67 of file RCOutput.h.

Referenced by get_freq(), init(), set_freq(), set_output_mode(), and write().

◆ _safety_state_request

enum AP_HAL::Util::safety_state PX4::PX4RCOutput::_safety_state_request = AP_HAL::Util::SAFETY_NONE
private

Definition at line 89 of file RCOutput.h.

Referenced by force_safety_off(), force_safety_on(), and force_safety_pending_requests().

◆ _safety_state_request_last_ms

uint32_t PX4::PX4RCOutput::_safety_state_request_last_ms = 0
private

◆ _sbus_enabled

bool PX4::PX4RCOutput::_sbus_enabled
private

Definition at line 61 of file RCOutput.h.

Referenced by _send_outputs(), and enable_px4io_sbus_out().

◆ _servo_count

unsigned PX4::PX4RCOutput::_servo_count
private

Definition at line 65 of file RCOutput.h.

Referenced by _send_outputs(), get_freq(), init(), set_failsafe_pwm(), set_freq(), set_safety_pwm(), and write().

◆ outputs

actuator_outputs_s PX4::PX4RCOutput::outputs

Definition at line 75 of file RCOutput.h.

Referenced by _send_outputs(), and read().

◆ pwm_sub

int PX4::PX4RCOutput::pwm_sub

Definition at line 74 of file RCOutput.h.

Referenced by _send_outputs(), and read().


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