Firmware
Public Member Functions | List of all members
PX4IO Class Reference

The PX4IO class. More...

Inheritance diagram for PX4IO:
cdev::CDev

Public Member Functions

 PX4IO (device::Device *interface)
 Constructor. More...
 
virtual ~PX4IO ()
 Destructor. More...
 
virtual int init ()
 Initialize the PX4IO class. More...
 
int init (bool disable_rc_handling)
 Initialize the PX4IO class. More...
 
virtual int detect ()
 Detect if a PX4IO is connected. More...
 
virtual int ioctl (file *filp, int cmd, unsigned long arg)
 IO Control handler. More...
 
virtual ssize_t write (file *filp, const char *buffer, size_t len)
 write handler. More...
 
int set_update_rate (int rate)
 Set the update rate for actuator outputs from FMU to IO. More...
 
int set_failsafe_values (const uint16_t *vals, unsigned len)
 Push failsafe values to IO. More...
 
int disable_rc_handling ()
 Disable RC input handling.
 
void print_status (bool extended_status)
 Print IO status. More...
 
int print_debug ()
 Fetch and print debug console output.
 
void test_fmu_fail (bool is_fail)
 
uint16_t system_status () const
 
- Public Member Functions inherited from cdev::CDev
 CDev (const char *devname)
 Constructor. More...
 
virtual int open (file_t *filep)
 Handle an open of the device. More...
 
virtual int close (file_t *filep)
 Handle a close of the device. More...
 
virtual ssize_t read (file_t *filep, char *buffer, size_t buflen)
 Perform a read from the device. More...
 
virtual ssize_t write (file_t *filep, const char *buffer, size_t buflen)
 Perform a write to the device. More...
 
virtual off_t seek (file_t *filep, off_t offset, int whence)
 Perform a logical seek operation on the device. More...
 
virtual int ioctl (file_t *filep, int cmd, unsigned long arg)
 Perform an ioctl operation on the device. More...
 
virtual int poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup)
 Perform a poll setup/teardown operation. More...
 
const char * get_devname () const
 Get the device name. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cdev::CDev
virtual pollevent_t poll_state (file_t *filep)
 Check the current state of the device for poll events from the perspective of the file. More...
 
virtual void poll_notify (pollevent_t events)
 Report new poll events. More...
 
virtual void poll_notify_one (px4_pollfd_struct_t *fds, pollevent_t events)
 Internal implementation of poll_notify. More...
 
virtual int open_first (file_t *filep)
 Notification of the first open. More...
 
virtual int close_last (file_t *filep)
 Notification of the last close. More...
 
virtual int register_class_devname (const char *class_devname)
 Register a class device name, automatically adding device class instance suffix if need be. More...
 
virtual int unregister_class_devname (const char *class_devname, unsigned class_instance)
 Register a class device name, automatically adding device class instance suffix if need be. More...
 
void lock ()
 Take the driver lock. More...
 
void unlock ()
 Release the driver lock.
 
- Protected Attributes inherited from cdev::CDev
px4_sem_t _lock
 lock to protect access to all class members (also for derived classes)
 
- Static Protected Attributes inherited from cdev::CDev
static const px4_file_operations_t fops = {}
 Pointer to the default cdev file operations table; useful for registering clone devices etc.
 

Detailed Description

The PX4IO class.

Encapsulates PX4FMU to PX4IO communications modeled as file operations.

Constructor & Destructor Documentation

§ PX4IO()

PX4IO::PX4IO ( device::Device interface)

Constructor.

Initialize all class variables.

§ ~PX4IO()

PX4IO::~PX4IO ( )
virtual

Destructor.

Wait for worker thread to terminate.

Member Function Documentation

§ detect()

int PX4IO::detect ( )
virtual

Detect if a PX4IO is connected.

Only validate if there is a PX4IO to talk to.

§ init() [1/2]

int PX4IO::init ( )
virtual

Initialize the PX4IO class.

Retrieve relevant initial system parameters. Initialize PX4IO registers.

Reimplemented from cdev::CDev.

§ init() [2/2]

int PX4IO::init ( bool  disable_rc_handling)

Initialize the PX4IO class.

Retrieve relevant initial system parameters. Initialize PX4IO registers.

Parameters
disable_rc_handlingset to true to forbid override / RC handling on IO

§ ioctl()

int PX4IO::ioctl ( file *  filp,
int  cmd,
unsigned long  arg 
)
virtual

IO Control handler.

Handle all IOCTL calls to the PX4IO file descriptor.

Parameters
[in]filpfile handle (not used). This function is always called directly through object reference
[in]cmdthe IOCTL command
[in]theIOCTL command parameter (optional)

§ print_status()

void PX4IO::print_status ( bool  extended_status)

Print IO status.

Print all relevant IO status information

Parameters
extended_statusShows more verbose information (in particular RC config)

§ set_failsafe_values()

int PX4IO::set_failsafe_values ( const uint16_t *  vals,
unsigned  len 
)

Push failsafe values to IO.

Parameters
[in]valsFailsafe control inputs: in us PPM (900 for zero, 1500 for centered, 2100 for full)
[in]lenNumber of channels, could up to 8

§ set_update_rate()

int PX4IO::set_update_rate ( int  rate)

Set the update rate for actuator outputs from FMU to IO.

Parameters
[in]rateThe rate in Hz actuator outpus are sent to IO. Min 10 Hz, max 400 Hz

§ write()

ssize_t PX4IO::write ( file *  filp,
const char *  buffer,
size_t  len 
)
virtual

write handler.

Handle writes to the PX4IO file descriptor.

Parameters
[in]filpfile handle (not used). This function is always called directly through object reference
[in]bufferpointer to the data buffer to be written
[in]lensize in bytes to be written
Returns
number of bytes written

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