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

#include <AP_Compass_AK8963.h>

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

Public Member Functions

virtual ~AP_Compass_AK8963 ()
 
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, enum Rotation rotation=ROTATION_NONE)
 
static AP_Compass_Backendprobe_mpu9250 (Compass &compass, AP_HAL::OwnPtr< AP_HAL::I2CDevice > dev, enum Rotation rotation=ROTATION_NONE)
 
static AP_Compass_Backendprobe_mpu9250 (Compass &compass, uint8_t mpu9250_instance, enum Rotation rotation=ROTATION_NONE)
 

Static Public Attributes

static constexpr const char * name = "AK8963"
 

Private Member Functions

 AP_Compass_AK8963 (Compass &compass, AP_AK8963_BusDriver *bus, enum Rotation rotation=ROTATION_NONE)
 
bool init ()
 
void _make_factory_sensitivity_adjustment (Vector3f &field) const
 
void _make_adc_sensitivity_adjustment (Vector3f &field) const
 
bool _reset ()
 
bool _setup_mode ()
 
bool _check_id ()
 
bool _calibrate ()
 
void _update ()
 

Private Attributes

AP_AK8963_BusDriver_bus
 
float _magnetometer_ASA [3] {0, 0, 0}
 
float _mag_x_accum
 
float _mag_y_accum
 
float _mag_z_accum
 
uint32_t _accum_count
 
uint8_t _compass_instance
 
bool _initialized
 
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 17 of file AP_Compass_AK8963.h.

Constructor & Destructor Documentation

◆ ~AP_Compass_AK8963()

AP_Compass_AK8963::~AP_Compass_AK8963 ( )
virtual

Definition at line 63 of file AP_Compass_AK8963.cpp.

◆ AP_Compass_AK8963()

AP_Compass_AK8963::AP_Compass_AK8963 ( Compass compass,
AP_AK8963_BusDriver bus,
enum Rotation  rotation = ROTATION_NONE 
)
private

Definition at line 55 of file AP_Compass_AK8963.cpp.

Referenced by probe(), and probe_mpu9250().

Here is the caller graph for this function:

Member Function Documentation

◆ _calibrate()

bool AP_Compass_AK8963::_calibrate ( )
private

Definition at line 288 of file AP_Compass_AK8963.cpp.

Referenced by init().

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

◆ _check_id()

bool AP_Compass_AK8963::_check_id ( )
private

Definition at line 263 of file AP_Compass_AK8963.cpp.

Referenced by init().

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

◆ _make_adc_sensitivity_adjustment()

void AP_Compass_AK8963::_make_adc_sensitivity_adjustment ( Vector3f field) const
private

Definition at line 200 of file AP_Compass_AK8963.cpp.

Referenced by _update().

Here is the caller graph for this function:

◆ _make_factory_sensitivity_adjustment()

void AP_Compass_AK8963::_make_factory_sensitivity_adjustment ( Vector3f field) const
private

Definition at line 207 of file AP_Compass_AK8963.cpp.

Referenced by _update().

Here is the caller graph for this function:

◆ _reset()

bool AP_Compass_AK8963::_reset ( )
private

Definition at line 282 of file AP_Compass_AK8963.cpp.

Here is the call graph for this function:

◆ _setup_mode()

bool AP_Compass_AK8963::_setup_mode ( )
private

Definition at line 278 of file AP_Compass_AK8963.cpp.

Referenced by init().

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

◆ _update()

void AP_Compass_AK8963::_update ( )
private

Definition at line 214 of file AP_Compass_AK8963.cpp.

Referenced by init().

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

◆ init()

bool AP_Compass_AK8963::init ( void  )
private

Definition at line 124 of file AP_Compass_AK8963.cpp.

Referenced by probe(), and probe_mpu9250().

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

◆ probe()

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

Definition at line 68 of file AP_Compass_AK8963.cpp.

Referenced by Compass::_detect_backends(), and probe_mpu9250().

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

◆ probe_mpu9250() [1/2]

AP_Compass_Backend * AP_Compass_AK8963::probe_mpu9250 ( Compass compass,
AP_HAL::OwnPtr< AP_HAL::I2CDevice dev,
enum Rotation  rotation = ROTATION_NONE 
)
static

Definition at line 89 of file AP_Compass_AK8963.cpp.

Referenced by Compass::_detect_backends().

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

◆ probe_mpu9250() [2/2]

AP_Compass_Backend * AP_Compass_AK8963::probe_mpu9250 ( Compass compass,
uint8_t  mpu9250_instance,
enum Rotation  rotation = ROTATION_NONE 
)
static

Definition at line 104 of file AP_Compass_AK8963.cpp.

Here is the call graph for this function:

◆ read()

void AP_Compass_AK8963::read ( void  )
overridevirtual

Implements AP_Compass_Backend.

Definition at line 179 of file AP_Compass_AK8963.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _accum_count

uint32_t AP_Compass_AK8963::_accum_count
private

Definition at line 61 of file AP_Compass_AK8963.h.

Referenced by _update(), and read().

◆ _bus

AP_AK8963_BusDriver* AP_Compass_AK8963::_bus
private

◆ _compass_instance

uint8_t AP_Compass_AK8963::_compass_instance
private

Definition at line 63 of file AP_Compass_AK8963.h.

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

◆ _initialized

bool AP_Compass_AK8963::_initialized
private

Definition at line 64 of file AP_Compass_AK8963.h.

Referenced by init(), and read().

◆ _mag_x_accum

float AP_Compass_AK8963::_mag_x_accum
private

Definition at line 58 of file AP_Compass_AK8963.h.

Referenced by _update(), and read().

◆ _mag_y_accum

float AP_Compass_AK8963::_mag_y_accum
private

Definition at line 59 of file AP_Compass_AK8963.h.

Referenced by _update(), and read().

◆ _mag_z_accum

float AP_Compass_AK8963::_mag_z_accum
private

Definition at line 60 of file AP_Compass_AK8963.h.

Referenced by _update(), and read().

◆ _magnetometer_ASA

float AP_Compass_AK8963::_magnetometer_ASA[3] {0, 0, 0}
private

Definition at line 57 of file AP_Compass_AK8963.h.

Referenced by _calibrate(), and _make_factory_sensitivity_adjustment().

◆ _rotation

enum Rotation AP_Compass_AK8963::_rotation
private

Definition at line 65 of file AP_Compass_AK8963.h.

Referenced by init().

◆ name

constexpr const char* AP_Compass_AK8963::name = "AK8963"
static

Definition at line 34 of file AP_Compass_AK8963.h.

Referenced by Compass::_detect_backends().


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