PX4 Firmware
PX4 Autopilot Software http://px4.io
DfHmc5883Wrapper Class Reference
Inheritance diagram for DfHmc5883Wrapper:
Collaboration diagram for DfHmc5883Wrapper:

Classes

struct  mag_calibration_s
 

Public Member Functions

 DfHmc5883Wrapper (enum Rotation rotation, const char *path)
 
 ~DfHmc5883Wrapper ()
 
int start ()
 Start automatic measurement. More...
 
int stop ()
 Stop automatic measurement. More...
 
- Public Member Functions inherited from HMC5883
 HMC5883 (device::Device *interface, const char *path, enum Rotation rotation)
 
virtual ~HMC5883 ()
 
virtual int init ()
 
virtual ssize_t read (cdev::file_t *filp, char *buffer, size_t buflen)
 Perform a read from the device. More...
 
virtual int ioctl (cdev::file_t *filp, int cmd, unsigned long arg)
 Perform an ioctl operation on the device. More...
 
void stop ()
 Stop the automatic measurement state machine. More...
 
void print_info ()
 Diagnostics - print some basic information about the driver. More...
 
- Public Member Functions inherited from device::CDev
 CDev (const char *name, const char *devname)
 Constructor. More...
 
virtual ~CDev ()=default
 
- Public Member Functions inherited from device::Device
 Device (const Device &)=delete
 
Deviceoperator= (const Device &)=delete
 
 Device (Device &&)=delete
 
Deviceoperator= (Device &&)=delete
 
virtual ~Device ()=default
 Destructor. More...
 
virtual int read (unsigned address, void *data, unsigned count)
 Read directly from the device. More...
 
virtual int write (unsigned address, void *data, unsigned count)
 Write directly to the device. More...
 
virtual int ioctl (unsigned operation, unsigned &arg)
 Perform a device-specific operation. More...
 
uint32_t get_device_id () const
 
DeviceBusType get_device_bus_type () const
 Return the bus type the device is connected to. More...
 
void set_device_bus_type (DeviceBusType bus_type)
 
uint8_t get_device_bus () const
 Return the bus ID the device is connected to. More...
 
void set_device_bus (uint8_t bus)
 
uint8_t get_device_address () const
 Return the bus address of the device. More...
 
void set_device_address (int address)
 
uint8_t get_device_type () const
 Return the device type. More...
 
void set_device_type (uint8_t devtype)
 
virtual bool external () const
 
- Public Member Functions inherited from cdev::CDev
 CDev (const char *devname)
 Constructor. More...
 
 CDev (const CDev &)=delete
 
CDevoperator= (const CDev &)=delete
 
 CDev (CDev &&)=delete
 
CDevoperator= (CDev &&)=delete
 
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 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 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...
 

Private Member Functions

int _publish (struct mag_sensor_data &data)
 
void _update_mag_calibration ()
 

Private Attributes

orb_advert_t _mag_topic
 
int _param_update_sub
 
struct DfHmc5883Wrapper::mag_calibration_s _mag_calibration
 
matrix::Dcmf _rotation_matrix
 
int _mag_orb_class_instance
 
perf_counter_t _mag_sample_perf
 

Additional Inherited Members

- Public Types inherited from device::Device
enum  DeviceBusType {
  DeviceBusType_UNKNOWN = 0, DeviceBusType_I2C = 1, DeviceBusType_SPI = 2, DeviceBusType_UAVCAN = 3,
  DeviceBusType_SIMULATION = 4
}
 Device bus types for DEVID. More...
 
- Static Public Member Functions inherited from device::Device
static const char * get_device_bus_string (DeviceBusType bus)
 
static int device_id_print_buffer (char *buffer, int length, uint32_t id)
 Print decoded device id string to a buffer. More...
 
- Protected Member Functions inherited from device::Device
 Device (const char *name)
 
 Device (const char *name, DeviceBusType bus_type, uint8_t bus, uint8_t address, uint8_t devtype=0)
 
 Device (DeviceBusType bus_type, uint8_t bus, uint8_t address, uint8_t devtype=0)
 
- 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. More...
 
int unregister_driver_and_memory ()
 First, unregisters the driver. More...
 
- Protected Attributes inherited from HMC5883
Device_interface
 
- Protected Attributes inherited from device::CDev
bool _pub_blocked {false}
 true if publishing should be blocked More...
 
- Protected Attributes inherited from device::Device
const char * _name {nullptr}
 driver name More...
 
bool _debug_enabled {false}
 if true, debug messages are printed More...
 
- Protected Attributes inherited from cdev::CDev
px4_sem_t _lock
 lock to protect access to all class members (also for derived classes) More...
 
- 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. More...
 

Detailed Description

Definition at line 75 of file df_hmc5883_wrapper.cpp.

Constructor & Destructor Documentation

◆ DfHmc5883Wrapper()

DfHmc5883Wrapper::DfHmc5883Wrapper ( enum Rotation  rotation,
const char *  path 
)

Definition at line 122 of file df_hmc5883_wrapper.cpp.

References _mag_calibration, _mag_orb_class_instance, _mag_sample_perf, _rotation_matrix, get_rot_matrix(), PC_ELAPSED, perf_alloc, DfHmc5883Wrapper::mag_calibration_s::x_offset, DfHmc5883Wrapper::mag_calibration_s::x_scale, DfHmc5883Wrapper::mag_calibration_s::y_offset, DfHmc5883Wrapper::mag_calibration_s::y_scale, DfHmc5883Wrapper::mag_calibration_s::z_offset, and DfHmc5883Wrapper::mag_calibration_s::z_scale.

Referenced by df_hmc5883_wrapper::start().

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

◆ ~DfHmc5883Wrapper()

DfHmc5883Wrapper::~DfHmc5883Wrapper ( )

Definition at line 142 of file df_hmc5883_wrapper.cpp.

References _mag_sample_perf, and perf_free().

Here is the call graph for this function:

Member Function Documentation

◆ _publish()

◆ _update_mag_calibration()

void DfHmc5883Wrapper::_update_mag_calibration ( )
private

Definition at line 188 of file df_hmc5883_wrapper.cpp.

References _mag_calibration, device_id, OK, param_find(), param_get(), DfHmc5883Wrapper::mag_calibration_s::x_offset, DfHmc5883Wrapper::mag_calibration_s::x_scale, DfHmc5883Wrapper::mag_calibration_s::y_offset, DfHmc5883Wrapper::mag_calibration_s::y_scale, DfHmc5883Wrapper::mag_calibration_s::z_offset, and DfHmc5883Wrapper::mag_calibration_s::z_scale.

Referenced by _publish(), and start().

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

◆ start()

int DfHmc5883Wrapper::start ( )

Start automatic measurement.

Returns
0 on success

Definition at line 147 of file df_hmc5883_wrapper.cpp.

References _param_update_sub, _update_mag_calibration(), HMC5883::init(), ORB_ID, orb_subscribe(), and HMC5883::start().

Referenced by df_hmc5883_wrapper::start().

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

◆ stop()

int DfHmc5883Wrapper::stop ( )

Stop automatic measurement.

Returns
0 on success

Definition at line 175 of file df_hmc5883_wrapper.cpp.

References HMC5883::stop().

Referenced by df_hmc5883_wrapper::stop().

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

Member Data Documentation

◆ _mag_calibration

struct DfHmc5883Wrapper::mag_calibration_s DfHmc5883Wrapper::_mag_calibration
private

◆ _mag_orb_class_instance

int DfHmc5883Wrapper::_mag_orb_class_instance
private

Definition at line 116 of file df_hmc5883_wrapper.cpp.

Referenced by _publish(), and DfHmc5883Wrapper().

◆ _mag_sample_perf

perf_counter_t DfHmc5883Wrapper::_mag_sample_perf
private

Definition at line 118 of file df_hmc5883_wrapper.cpp.

Referenced by _publish(), DfHmc5883Wrapper(), and ~DfHmc5883Wrapper().

◆ _mag_topic

orb_advert_t DfHmc5883Wrapper::_mag_topic
private

Definition at line 101 of file df_hmc5883_wrapper.cpp.

Referenced by _publish().

◆ _param_update_sub

int DfHmc5883Wrapper::_param_update_sub
private

Definition at line 103 of file df_hmc5883_wrapper.cpp.

Referenced by _publish(), and start().

◆ _rotation_matrix

matrix::Dcmf DfHmc5883Wrapper::_rotation_matrix
private

Definition at line 114 of file df_hmc5883_wrapper.cpp.

Referenced by _publish(), and DfHmc5883Wrapper().


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