APM:Libraries
Public Member Functions | Private Member Functions | Private Attributes | List of all members
VRBRAIN::VRBRAINRCOutput Class Reference

#include <RCOutput.h>

Inheritance diagram for VRBRAIN::VRBRAINRCOutput:
[legend]
Collaboration diagram for VRBRAIN::VRBRAINRCOutput:
[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
 
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 get_esc_scaling (uint16_t &min_pwm, uint16_t &max_pwm)
 
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 [VRBRAIN_NUM_OUTPUT_CHANNELS]
 
uint16_t _last_sent [VRBRAIN_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
 
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 VRBRAINRCOutput::_arm_actuators ( bool  arm)
private

Definition at line 454 of file RCOutput.cpp.

Referenced by _send_outputs().

Here is the caller graph for this function:

◆ _init_alt_channels()

void VRBRAINRCOutput::_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 VRBRAINRCOutput::_send_outputs ( void  )
private

Definition at line 478 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 VRBRAINRCOutput::cork ( void  )
virtual

Implements AP_HAL::RCOutput.

Definition at line 555 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 VRBRAINRCOutput::disable_ch ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 275 of file RCOutput.cpp.

◆ enable_ch()

void VRBRAINRCOutput::enable_ch ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 257 of file RCOutput.cpp.

Here is the call graph for this function:

◆ enable_px4io_sbus_out()

bool VRBRAINRCOutput::enable_px4io_sbus_out ( uint16_t  rate_hz)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 593 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 VRBRAINRCOutput::force_safety_no_wait ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 351 of file RCOutput.cpp.

Here is the call graph for this function:

◆ force_safety_off()

void VRBRAINRCOutput::force_safety_off ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 324 of file RCOutput.cpp.

◆ force_safety_on()

bool VRBRAINRCOutput::force_safety_on ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 317 of file RCOutput.cpp.

◆ force_safety_pending_requests()

void VRBRAINRCOutput::force_safety_pending_requests ( void  )
private

Definition at line 330 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_freq()

uint16_t VRBRAINRCOutput::get_freq ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 243 of file RCOutput.cpp.

◆ init()

void VRBRAINRCOutput::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 VRBRAINRCOutput::push ( void  )
virtual

Implements AP_HAL::RCOutput.

Definition at line 564 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 VRBRAINRCOutput::read ( uint8_t  ch)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 410 of file RCOutput.cpp.

Referenced by read().

Here is the caller graph for this function:

◆ read() [2/2]

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

Implements AP_HAL::RCOutput.

Definition at line 428 of file RCOutput.cpp.

Here is the call graph for this function:

◆ read_last_sent() [1/2]

uint16_t VRBRAINRCOutput::read_last_sent ( uint8_t  ch)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 435 of file RCOutput.cpp.

Referenced by read_last_sent().

Here is the caller graph for this function:

◆ read_last_sent() [2/2]

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

Reimplemented from AP_HAL::RCOutput.

Definition at line 444 of file RCOutput.cpp.

Here is the call graph for this function:

◆ scale_esc_to_unity()

float VRBRAIN::VRBRAINRCOutput::scale_esc_to_unity ( uint16_t  pwm)
inlineoverridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 32 of file RCOutput.h.

Here is the call graph for this function:

◆ set_default_rate()

void VRBRAINRCOutput::set_default_rate ( uint16_t  rate_hz)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 669 of file RCOutput.cpp.

Referenced by scale_esc_to_unity().

Here is the caller graph for this function:

◆ set_esc_scaling()

void VRBRAIN::VRBRAINRCOutput::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 VRBRAINRCOutput::set_failsafe_pwm ( uint32_t  chmask,
uint16_t  period_us 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 301 of file RCOutput.cpp.

Here is the call graph for this function:

◆ set_freq()

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

Implements AP_HAL::RCOutput.

Definition at line 215 of file RCOutput.cpp.

Here is the call graph for this function:

◆ set_freq_fd()

void VRBRAINRCOutput::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 VRBRAINRCOutput::set_output_mode ( uint16_t  mask,
enum output_mode  mode 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 617 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 VRBRAINRCOutput::set_safety_pwm ( uint32_t  chmask,
uint16_t  period_us 
)
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 285 of file RCOutput.cpp.

Here is the call graph for this function:

◆ timer_tick()

void VRBRAINRCOutput::timer_tick ( void  )
overridevirtual

Reimplemented from AP_HAL::RCOutput.

Definition at line 579 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 VRBRAINRCOutput::write ( uint8_t  ch,
uint16_t  period_us 
)
overridevirtual

Implements AP_HAL::RCOutput.

Definition at line 359 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 VRBRAIN::VRBRAINRCOutput::_actuator_armed_pub
private

Definition at line 72 of file RCOutput.h.

Referenced by _arm_actuators().

◆ _alt_fd

int VRBRAIN::VRBRAINRCOutput::_alt_fd
private

◆ _alt_servo_count

unsigned VRBRAIN::VRBRAINRCOutput::_alt_servo_count
private

Definition at line 61 of file RCOutput.h.

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

◆ _armed

actuator_armed_s VRBRAIN::VRBRAINRCOutput::_armed
private

Definition at line 70 of file RCOutput.h.

Referenced by _arm_actuators().

◆ _corking

bool VRBRAIN::VRBRAINRCOutput::_corking
private

Definition at line 79 of file RCOutput.h.

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

◆ _default_rate_hz

uint16_t VRBRAIN::VRBRAINRCOutput::_default_rate_hz = 50
private

Definition at line 85 of file RCOutput.h.

Referenced by set_default_rate().

◆ _enabled_channels

uint16_t VRBRAIN::VRBRAINRCOutput::_enabled_channels
private

Definition at line 64 of file RCOutput.h.

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

◆ _esc_pwm_max

uint16_t VRBRAIN::VRBRAINRCOutput::_esc_pwm_max
private

Definition at line 74 of file RCOutput.h.

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

◆ _esc_pwm_min

uint16_t VRBRAIN::VRBRAINRCOutput::_esc_pwm_min
private

Definition at line 73 of file RCOutput.h.

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

◆ _freq_hz

uint16_t VRBRAIN::VRBRAINRCOutput::_freq_hz
private

Definition at line 49 of file RCOutput.h.

Referenced by get_freq(), and set_freq_fd().

◆ _last_config_us

uint32_t VRBRAIN::VRBRAINRCOutput::_last_config_us
private

Definition at line 59 of file RCOutput.h.

Referenced by _send_outputs().

◆ _last_output

uint32_t VRBRAIN::VRBRAINRCOutput::_last_output
private

Definition at line 58 of file RCOutput.h.

Referenced by _send_outputs().

◆ _last_sent

uint16_t VRBRAIN::VRBRAINRCOutput::_last_sent[VRBRAIN_NUM_OUTPUT_CHANNELS]
private

Definition at line 53 of file RCOutput.h.

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

◆ _max_channel

volatile uint8_t VRBRAIN::VRBRAINRCOutput::_max_channel
private

Definition at line 54 of file RCOutput.h.

Referenced by _send_outputs(), and write().

◆ _need_update

volatile bool VRBRAIN::VRBRAINRCOutput::_need_update
private

Definition at line 55 of file RCOutput.h.

Referenced by _send_outputs(), and write().

◆ _output_mode

enum output_mode VRBRAIN::VRBRAINRCOutput::_output_mode = MODE_PWM_NORMAL
private

Definition at line 80 of file RCOutput.h.

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

◆ _outputs

struct { ... } VRBRAIN::VRBRAINRCOutput::_outputs[ORB_MULTI_MAX_INSTANCES]

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

◆ _perf_rcout

perf_counter_t VRBRAIN::VRBRAINRCOutput::_perf_rcout
private

Definition at line 57 of file RCOutput.h.

Referenced by _send_outputs(), and init().

◆ _period

uint16_t VRBRAIN::VRBRAINRCOutput::_period[VRBRAIN_NUM_OUTPUT_CHANNELS]
private

Definition at line 50 of file RCOutput.h.

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

◆ _period_max

uint32_t VRBRAIN::VRBRAINRCOutput::_period_max
private

Definition at line 65 of file RCOutput.h.

Referenced by set_freq_fd(), and write().

◆ _pwm_fd

int VRBRAIN::VRBRAINRCOutput::_pwm_fd
private

◆ _rate_mask_alt

uint32_t VRBRAIN::VRBRAINRCOutput::_rate_mask_alt
private

Definition at line 63 of file RCOutput.h.

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

◆ _rate_mask_main

uint32_t VRBRAIN::VRBRAINRCOutput::_rate_mask_main
private

Definition at line 62 of file RCOutput.h.

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

◆ _safety_state_request

enum AP_HAL::Util::safety_state VRBRAIN::VRBRAINRCOutput::_safety_state_request = AP_HAL::Util::SAFETY_NONE
private

Definition at line 82 of file RCOutput.h.

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

◆ _safety_state_request_last_ms

uint32_t VRBRAIN::VRBRAINRCOutput::_safety_state_request_last_ms = 0
private

◆ _sbus_enabled

bool VRBRAIN::VRBRAINRCOutput::_sbus_enabled
private

Definition at line 56 of file RCOutput.h.

Referenced by _send_outputs(), and enable_px4io_sbus_out().

◆ _servo_count

unsigned VRBRAIN::VRBRAINRCOutput::_servo_count
private

Definition at line 60 of file RCOutput.h.

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

◆ outputs

actuator_outputs_s VRBRAIN::VRBRAINRCOutput::outputs

Definition at line 68 of file RCOutput.h.

Referenced by _send_outputs(), and read().

◆ pwm_sub

int VRBRAIN::VRBRAINRCOutput::pwm_sub

Definition at line 67 of file RCOutput.h.

Referenced by _send_outputs(), and read().


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