APM:Libraries
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
AP_Compass_MMC3416 Class Reference

#include <AP_Compass_MMC3416.h>

Inheritance diagram for AP_Compass_MMC3416:
[legend]
Collaboration diagram for AP_Compass_MMC3416:
[legend]

Public Member Functions

void read () override
 
- Public Member Functions inherited from AP_Compass_Backend
 AP_Compass_Backend (Compass &compass)
 
virtual ~AP_Compass_Backend (void)
 
virtual void accumulate (void)
 
virtual void handle_mag_msg (Vector3f &mag)
 

Static Public Member Functions

static AP_Compass_Backendprobe (Compass &compass, AP_HAL::OwnPtr< AP_HAL::I2CDevice > dev, bool force_external=false, enum Rotation rotation=ROTATION_NONE)
 

Static Public Attributes

static constexpr const char * name = "MMC3416"
 

Private Types

enum  {
  STATE_REFILL1, STATE_REFILL1_WAIT, STATE_MEASURE_WAIT1, STATE_REFILL2_WAIT,
  STATE_MEASURE_WAIT2, STATE_MEASURE_WAIT3
}
 

Private Member Functions

 AP_Compass_MMC3416 (Compass &compass, AP_HAL::OwnPtr< AP_HAL::Device > dev, bool force_external, enum Rotation rotation)
 
bool init ()
 
void timer ()
 
void accumulate_field (Vector3f &field)
 

Private Attributes

AP_HAL::OwnPtr< AP_HAL::Devicedev
 
enum AP_Compass_MMC3416:: { ... }  state
 
uint8_t compass_instance
 
Vector3f accum
 
uint16_t accum_count
 
bool force_external
 
Vector3f offset
 
uint16_t measure_count
 
bool have_initial_offset
 
uint32_t refill_start_ms
 
uint32_t last_sample_ms
 
uint16_t data0 [3]
 
enum Rotation rotation
 

Additional Inherited Members

- Public Types inherited from AP_Compass_Backend
enum  DevTypes {
  DEVTYPE_HMC5883_OLD = 0x01, DEVTYPE_HMC5883 = 0x07, DEVTYPE_LSM303D = 0x02, DEVTYPE_AK8963 = 0x04,
  DEVTYPE_BMM150 = 0x05, DEVTYPE_LSM9DS1 = 0x06, DEVTYPE_LIS3MDL = 0x08, DEVTYPE_AK09916 = 0x09,
  DEVTYPE_IST8310 = 0x0A, DEVTYPE_ICM20948 = 0x0B, DEVTYPE_MMC3416 = 0x0C, DEVTYPE_QMC5883L = 0x0D,
  DEVTYPE_MAG3110 = 0x0E
}
 
- Protected Member Functions inherited from AP_Compass_Backend
void rotate_field (Vector3f &mag, uint8_t instance)
 
void publish_raw_field (const Vector3f &mag, uint8_t instance)
 
void correct_field (Vector3f &mag, uint8_t i)
 
void publish_filtered_field (const Vector3f &mag, uint8_t instance)
 
void set_last_update_usec (uint32_t last_update, uint8_t instance)
 
uint8_t register_compass (void) const
 
void set_dev_id (uint8_t instance, uint32_t dev_id)
 
void set_external (uint8_t instance, bool external)
 
bool is_external (uint8_t instance)
 
void set_rotation (uint8_t instance, enum Rotation rotation)
 
bool field_ok (const Vector3f &field)
 
uint32_t get_error_count () const
 
- Protected Attributes inherited from AP_Compass_Backend
Compass_compass
 
AP_HAL::Semaphore_sem
 

Detailed Description

Definition at line 29 of file AP_Compass_MMC3416.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
STATE_REFILL1 
STATE_REFILL1_WAIT 
STATE_MEASURE_WAIT1 
STATE_REFILL2_WAIT 
STATE_MEASURE_WAIT2 
STATE_MEASURE_WAIT3 

Definition at line 48 of file AP_Compass_MMC3416.h.

Constructor & Destructor Documentation

◆ AP_Compass_MMC3416()

AP_Compass_MMC3416::AP_Compass_MMC3416 ( Compass compass,
AP_HAL::OwnPtr< AP_HAL::Device dev,
bool  force_external,
enum Rotation  rotation 
)
private

Definition at line 61 of file AP_Compass_MMC3416.cpp.

Referenced by probe().

Here is the caller graph for this function:

Member Function Documentation

◆ accumulate_field()

void AP_Compass_MMC3416::accumulate_field ( Vector3f field)
private

Definition at line 288 of file AP_Compass_MMC3416.cpp.

Referenced by timer().

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

◆ init()

bool AP_Compass_MMC3416::init ( void  )
private

Device periodic callback to read data from the sensor.

Definition at line 72 of file AP_Compass_MMC3416.cpp.

Referenced by probe().

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

◆ probe()

AP_Compass_Backend * AP_Compass_MMC3416::probe ( Compass compass,
AP_HAL::OwnPtr< AP_HAL::I2CDevice dev,
bool  force_external = false,
enum Rotation  rotation = ROTATION_NONE 
)
static

Definition at line 44 of file AP_Compass_MMC3416.cpp.

Here is the call graph for this function:

◆ read()

void AP_Compass_MMC3416::read ( void  )
overridevirtual

Implements AP_Compass_Backend.

Definition at line 315 of file AP_Compass_MMC3416.cpp.

Here is the call graph for this function:

◆ timer()

void AP_Compass_MMC3416::timer ( void  )
private

Definition at line 123 of file AP_Compass_MMC3416.cpp.

Referenced by init().

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

Member Data Documentation

◆ accum

Vector3f AP_Compass_MMC3416::accum
private

Definition at line 65 of file AP_Compass_MMC3416.h.

Referenced by accumulate_field(), and read().

◆ accum_count

uint16_t AP_Compass_MMC3416::accum_count
private

Definition at line 66 of file AP_Compass_MMC3416.h.

Referenced by accumulate_field(), and read().

◆ compass_instance

uint8_t AP_Compass_MMC3416::compass_instance
private

Definition at line 64 of file AP_Compass_MMC3416.h.

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

◆ data0

uint16_t AP_Compass_MMC3416::data0[3]
private

Definition at line 74 of file AP_Compass_MMC3416.h.

Referenced by timer().

◆ dev

AP_HAL::OwnPtr<AP_HAL::Device> AP_Compass_MMC3416::dev
private

Definition at line 46 of file AP_Compass_MMC3416.h.

Referenced by init(), and timer().

◆ force_external

bool AP_Compass_MMC3416::force_external
private

Definition at line 67 of file AP_Compass_MMC3416.h.

Referenced by init().

◆ have_initial_offset

bool AP_Compass_MMC3416::have_initial_offset
private

Definition at line 70 of file AP_Compass_MMC3416.h.

Referenced by timer().

◆ last_sample_ms

uint32_t AP_Compass_MMC3416::last_sample_ms
private

Definition at line 72 of file AP_Compass_MMC3416.h.

Referenced by accumulate_field(), and timer().

◆ measure_count

uint16_t AP_Compass_MMC3416::measure_count
private

Definition at line 69 of file AP_Compass_MMC3416.h.

Referenced by timer().

◆ name

constexpr const char* AP_Compass_MMC3416::name = "MMC3416"
static

Definition at line 39 of file AP_Compass_MMC3416.h.

◆ offset

Vector3f AP_Compass_MMC3416::offset
private

Definition at line 68 of file AP_Compass_MMC3416.h.

Referenced by timer().

◆ refill_start_ms

uint32_t AP_Compass_MMC3416::refill_start_ms
private

Definition at line 71 of file AP_Compass_MMC3416.h.

Referenced by timer().

◆ rotation

enum Rotation AP_Compass_MMC3416::rotation
private

Definition at line 76 of file AP_Compass_MMC3416.h.

Referenced by init().

◆ state

enum { ... } AP_Compass_MMC3416::state

Referenced by timer().


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