PX4 Firmware
PX4 Autopilot Software http://px4.io
snapdragon_pwm Namespace Reference

Functions

static void usage ()
 
static void start ()
 
static void stop ()
 
static int pwm_initialize (const char *device)
 
static void pwm_deinitialize ()
 
static void send_outputs_pwm (const uint16_t *pwm)
 
static void task_main_trampoline (int argc, char *argv[])
 
static void subscribe ()
 
static void task_main (int argc, char *argv[])
 
static void update_params (Mixer::Airmode &airmode)
 
int initialize_mixer (const char *mixer_filename)
 
int mixer_control_callback (uintptr_t handle, uint8_t control_group, uint8_t control_index, float &input)
 

Variables

static px4_task_t _task_handle = -1
 
volatile bool _task_should_exit = false
 
static bool _is_running = false
 
static const int NUM_PWM = 4
 
static char _device [] = "/dev/pwm-1"
 
static const int PIN_GPIO = 27
 
static struct ::dspal_pwm_ioctl_signal_definition _signal_definition
 
static struct ::dspal_pwm _pwm_gpio [NUM_PWM]
 
static struct ::dspal_pwm_ioctl_update_buffer * _update_buffer
 
static struct ::dspal_pwm * _pwm
 
static const int FREQUENCY_PWM_HZ = 400
 
static char _mixer_filename [32] = "/dev/fs/quad_x.main.mix"
 
int _controls_subs [actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]
 
int _armed_sub
 
int _fd = -1
 
orb_advert_t _outputs_pub = nullptr
 
actuator_controls_s _controls [actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]
 
orb_id_t _controls_topics [actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]
 
actuator_outputs_s _outputs
 
actuator_armed_s _armed
 
uint8_t _poll_fds_num = 0
 
px4_pollfd_struct_t _poll_fds [actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]
 
uint32_t _groups_required = 0
 
output_limit_t _pwm_limit
 
int32_t _pwm_disarmed
 
int32_t _pwm_min
 
int32_t _pwm_max
 
MultirotorMixer_mixer = nullptr
 
perf_counter_t _perf_control_latency = nullptr
 

Function Documentation

◆ initialize_mixer()

int snapdragon_pwm::initialize_mixer ( const char *  mixer_filename)

Definition at line 176 of file snapdragon_pwm_out.cpp.

References MultirotorMixer::from_text(), mixer_control_callback(), and read().

Referenced by task_main().

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

◆ mixer_control_callback()

int snapdragon_pwm::mixer_control_callback ( uintptr_t  handle,
uint8_t  control_group,
uint8_t  control_index,
float &  input 
)

Definition at line 154 of file snapdragon_pwm_out.cpp.

References actuator_controls_s::control.

Referenced by initialize_mixer().

Here is the caller graph for this function:

◆ pwm_deinitialize()

void snapdragon_pwm::pwm_deinitialize ( )
static

Definition at line 300 of file snapdragon_pwm_out.cpp.

References _mixer.

Referenced by task_main().

Here is the caller graph for this function:

◆ pwm_initialize()

int snapdragon_pwm::pwm_initialize ( const char *  device)
static

Definition at line 251 of file snapdragon_pwm_out.cpp.

References _pwm_gpio, FREQUENCY_PWM_HZ, and NUM_PWM.

Referenced by task_main().

Here is the caller graph for this function:

◆ send_outputs_pwm()

void snapdragon_pwm::send_outputs_pwm ( const uint16_t *  pwm)
static

Definition at line 307 of file snapdragon_pwm_out.cpp.

References NUM_PWM.

Referenced by task_main().

Here is the caller graph for this function:

◆ start()

void snapdragon_pwm::start ( )
static

Definition at line 481 of file snapdragon_pwm_out.cpp.

References task_main_trampoline().

Referenced by snapdragon_pwm_out_main().

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

◆ stop()

void snapdragon_pwm::stop ( )
static

Definition at line 500 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main().

Here is the caller graph for this function:

◆ subscribe()

void snapdragon_pwm::subscribe ( )
static

Definition at line 204 of file snapdragon_pwm_out.cpp.

References _poll_fds_num, ORB_ID, and orb_subscribe().

Referenced by task_main().

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

◆ task_main()

void snapdragon_pwm::task_main ( int  argc,
char *  argv[] 
)
static

◆ task_main_trampoline()

void snapdragon_pwm::task_main_trampoline ( int  argc,
char *  argv[] 
)
static

Definition at line 476 of file snapdragon_pwm_out.cpp.

References task_main().

Referenced by start().

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

◆ update_params()

void snapdragon_pwm::update_params ( Mixer::Airmode airmode)
static

Definition at line 166 of file snapdragon_pwm_out.cpp.

References param_find(), param_get(), and PARAM_INVALID.

Referenced by task_main().

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

◆ usage()

void snapdragon_pwm::usage ( void  )
static

Definition at line 512 of file snapdragon_pwm_out.cpp.

References snapdragon_pwm_out_main().

Referenced by snapdragon_pwm_out_main().

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

Variable Documentation

◆ _armed

actuator_armed_s snapdragon_pwm::_armed

Definition at line 99 of file snapdragon_pwm_out.cpp.

◆ _armed_sub

int snapdragon_pwm::_armed_sub

Definition at line 89 of file snapdragon_pwm_out.cpp.

◆ _controls

actuator_controls_s snapdragon_pwm::_controls[actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]

Definition at line 96 of file snapdragon_pwm_out.cpp.

◆ _controls_subs

int snapdragon_pwm::_controls_subs[actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]

Definition at line 88 of file snapdragon_pwm_out.cpp.

◆ _controls_topics

orb_id_t snapdragon_pwm::_controls_topics[actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]

Definition at line 97 of file snapdragon_pwm_out.cpp.

◆ _device

char snapdragon_pwm::_device[] = "/dev/pwm-1"
static

Definition at line 71 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main().

◆ _fd

int snapdragon_pwm::_fd = -1

Definition at line 90 of file snapdragon_pwm_out.cpp.

◆ _groups_required

uint32_t snapdragon_pwm::_groups_required = 0

Definition at line 106 of file snapdragon_pwm_out.cpp.

◆ _is_running

bool snapdragon_pwm::_is_running = false
static

Definition at line 69 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main().

◆ _mixer

MultirotorMixer* snapdragon_pwm::_mixer = nullptr

Definition at line 116 of file snapdragon_pwm_out.cpp.

Referenced by pwm_deinitialize().

◆ _mixer_filename

char snapdragon_pwm::_mixer_filename[32] = "/dev/fs/quad_x.main.mix"
static

Definition at line 85 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main().

◆ _outputs

actuator_outputs_s snapdragon_pwm::_outputs

Definition at line 98 of file snapdragon_pwm_out.cpp.

◆ _outputs_pub

orb_advert_t snapdragon_pwm::_outputs_pub = nullptr

Definition at line 93 of file snapdragon_pwm_out.cpp.

◆ _perf_control_latency

perf_counter_t snapdragon_pwm::_perf_control_latency = nullptr

Definition at line 118 of file snapdragon_pwm_out.cpp.

◆ _poll_fds

px4_pollfd_struct_t snapdragon_pwm::_poll_fds[actuator_controls_s::NUM_ACTUATOR_CONTROL_GROUPS]

Definition at line 103 of file snapdragon_pwm_out.cpp.

◆ _poll_fds_num

uint8_t snapdragon_pwm::_poll_fds_num = 0

Definition at line 102 of file snapdragon_pwm_out.cpp.

Referenced by subscribe().

◆ _pwm

struct ::dspal_pwm* snapdragon_pwm::_pwm
static

Definition at line 78 of file snapdragon_pwm_out.cpp.

◆ _pwm_disarmed

int32_t snapdragon_pwm::_pwm_disarmed

Definition at line 112 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main(), and task_main().

◆ _pwm_gpio

struct ::dspal_pwm snapdragon_pwm::_pwm_gpio[NUM_PWM]
static

Definition at line 76 of file snapdragon_pwm_out.cpp.

Referenced by pwm_initialize().

◆ _pwm_limit

output_limit_t snapdragon_pwm::_pwm_limit

Definition at line 109 of file snapdragon_pwm_out.cpp.

◆ _pwm_max

int32_t snapdragon_pwm::_pwm_max

Definition at line 114 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main(), and task_main().

◆ _pwm_min

int32_t snapdragon_pwm::_pwm_min

Definition at line 113 of file snapdragon_pwm_out.cpp.

Referenced by snapdragon_pwm_out_main(), and task_main().

◆ _signal_definition

struct ::dspal_pwm_ioctl_signal_definition snapdragon_pwm::_signal_definition
static

Definition at line 75 of file snapdragon_pwm_out.cpp.

◆ _task_handle

px4_task_t snapdragon_pwm::_task_handle = -1
static

Definition at line 67 of file snapdragon_pwm_out.cpp.

◆ _task_should_exit

volatile bool snapdragon_pwm::_task_should_exit = false

Definition at line 68 of file snapdragon_pwm_out.cpp.

◆ _update_buffer

struct ::dspal_pwm_ioctl_update_buffer* snapdragon_pwm::_update_buffer
static

Definition at line 77 of file snapdragon_pwm_out.cpp.

◆ FREQUENCY_PWM_HZ

const int snapdragon_pwm::FREQUENCY_PWM_HZ = 400
static

Definition at line 81 of file snapdragon_pwm_out.cpp.

Referenced by pwm_initialize().

◆ NUM_PWM

const int snapdragon_pwm::NUM_PWM = 4
static

Definition at line 70 of file snapdragon_pwm_out.cpp.

Referenced by pwm_initialize(), and send_outputs_pwm().

◆ PIN_GPIO

const int snapdragon_pwm::PIN_GPIO = 27
static

Definition at line 74 of file snapdragon_pwm_out.cpp.