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

#include <AP_InertialSensor_LSM9DS0.h>

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

Classes

struct  sensor_raw_data
 

Public Member Functions

virtual ~AP_InertialSensor_LSM9DS0 ()
 
void start (void) override
 
bool update () override
 
- Public Member Functions inherited from AP_InertialSensor_Backend
 AP_InertialSensor_Backend (AP_InertialSensor &imu)
 
 AP_InertialSensor_Backend (const AP_InertialSensor_Backend &that)=delete
 
virtual ~AP_InertialSensor_Backend (void)
 
virtual void accumulate ()
 
virtual AuxiliaryBusget_auxiliary_bus ()
 
int16_t get_id () const
 
void notify_fifo_reset (void)
 

Static Public Member Functions

static AP_InertialSensor_Backendprobe (AP_InertialSensor &imu, AP_HAL::OwnPtr< AP_HAL::SPIDevice > dev_gyro, AP_HAL::OwnPtr< AP_HAL::SPIDevice > dev_accel, enum Rotation rotation_a=ROTATION_NONE, enum Rotation rotation_g=ROTATION_NONE, enum Rotation rotation_gH=ROTATION_NONE)
 

Private Types

enum  gyro_scale { G_SCALE_245DPS = 0, G_SCALE_500DPS, G_SCALE_2000DPS }
 
enum  accel_scale {
  A_SCALE_2G = 0, A_SCALE_4G, A_SCALE_6G, A_SCALE_8G,
  A_SCALE_16G
}
 

Private Member Functions

 AP_InertialSensor_LSM9DS0 (AP_InertialSensor &imu, AP_HAL::OwnPtr< AP_HAL::SPIDevice > dev_gyro, AP_HAL::OwnPtr< AP_HAL::SPIDevice > dev_accel, int drdy_pin_num_a, int drdy_pin_num_b, enum Rotation rotation_a, enum Rotation rotation_g, enum Rotation rotation_gH)
 
bool _accel_data_ready ()
 
bool _gyro_data_ready ()
 
void _poll_data ()
 
bool _init_sensor ()
 
bool _hardware_init ()
 
void _gyro_init ()
 
void _accel_init ()
 
void _gyro_disable_i2c ()
 
void _accel_disable_i2c ()
 
void _set_gyro_scale (gyro_scale scale)
 
void _set_accel_scale (accel_scale scale)
 
uint8_t _register_read_xm (uint8_t reg)
 
uint8_t _register_read_g (uint8_t reg)
 
void _register_write_xm (uint8_t reg, uint8_t val, bool checked=false)
 
void _register_write_g (uint8_t reg, uint8_t val, bool checked=false)
 
void _read_data_transaction_a ()
 
void _read_data_transaction_g ()
 

Private Attributes

AP_HAL::OwnPtr< AP_HAL::SPIDevice_dev_gyro
 
AP_HAL::OwnPtr< AP_HAL::SPIDevice_dev_accel
 
AP_HAL::Semaphore_spi_sem
 
AP_HAL::DigitalSource_drdy_pin_a
 
AP_HAL::DigitalSource_drdy_pin_g
 
float _gyro_scale
 
float _accel_scale
 
int _drdy_pin_num_a
 
int _drdy_pin_num_g
 
uint8_t _gyro_instance
 
uint8_t _accel_instance
 
uint8_t whoami_g
 
enum Rotation _rotation_a
 
enum Rotation _rotation_g
 
enum Rotation _rotation_gH
 

Additional Inherited Members

- Public Types inherited from AP_InertialSensor_Backend
enum  DevTypes {
  DEVTYPE_BMI160 = 0x09, DEVTYPE_L3G4200D = 0x10, DEVTYPE_ACC_LSM303D = 0x11, DEVTYPE_ACC_BMA180 = 0x12,
  DEVTYPE_ACC_MPU6000 = 0x13, DEVTYPE_ACC_MPU9250 = 0x16, DEVTYPE_ACC_IIS328DQ = 0x17, DEVTYPE_ACC_LSM9DS1 = 0x18,
  DEVTYPE_GYR_MPU6000 = 0x21, DEVTYPE_GYR_L3GD20 = 0x22, DEVTYPE_GYR_MPU9250 = 0x24, DEVTYPE_GYR_I3G4250D = 0x25,
  DEVTYPE_GYR_LSM9DS1 = 0x26, DEVTYPE_INS_ICM20789 = 0x27, DEVTYPE_INS_ICM20689 = 0x28
}
 
- Protected Member Functions inherited from AP_InertialSensor_Backend
void _rotate_and_correct_accel (uint8_t instance, Vector3f &accel)
 
void _rotate_and_correct_gyro (uint8_t instance, Vector3f &gyro)
 
void _publish_gyro (uint8_t instance, const Vector3f &gyro)
 
void _notify_new_gyro_raw_sample (uint8_t instance, const Vector3f &accel, uint64_t sample_us=0)
 
void _publish_accel (uint8_t instance, const Vector3f &accel)
 
void _notify_new_accel_raw_sample (uint8_t instance, const Vector3f &accel, uint64_t sample_us=0, bool fsync_set=false)
 
void _set_accel_oversampling (uint8_t instance, uint8_t n)
 
void _set_gyro_oversampling (uint8_t instance, uint8_t n)
 
void _set_accel_sensor_rate_sampling_enabled (uint8_t instance, bool value)
 
void _set_gyro_sensor_rate_sampling_enabled (uint8_t instance, bool value)
 
void _set_raw_sample_accel_multiplier (uint8_t instance, uint16_t mul)
 
void _set_raw_sampl_gyro_multiplier (uint8_t instance, uint16_t mul)
 
void _update_sensor_rate (uint16_t &count, uint32_t &start_us, float &rate_hz) const
 
void _set_accel_max_abs_offset (uint8_t instance, float offset)
 
uint32_t _accel_raw_sample_rate (uint8_t instance) const
 
void _set_accel_raw_sample_rate (uint8_t instance, uint16_t rate_hz)
 
uint32_t _gyro_raw_sample_rate (uint8_t instance) const
 
void _set_gyro_raw_sample_rate (uint8_t instance, uint16_t rate_hz)
 
void _publish_temperature (uint8_t instance, float temperature)
 
void _set_accel_error_count (uint8_t instance, uint32_t error_count)
 
void _set_gyro_error_count (uint8_t instance, uint32_t error_count)
 
void _inc_accel_error_count (uint8_t instance)
 
void _inc_gyro_error_count (uint8_t instance)
 
uint8_t _accel_filter_cutoff (void) const
 
uint8_t _gyro_filter_cutoff (void) const
 
uint16_t get_sample_rate_hz (void) const
 
void update_gyro (uint8_t instance)
 
void update_accel (uint8_t instance)
 
void set_gyro_orientation (uint8_t instance, enum Rotation rotation)
 
void set_accel_orientation (uint8_t instance, enum Rotation rotation)
 
void increment_clip_count (uint8_t instance)
 
bool enable_fast_sampling (uint8_t instance)
 
void _notify_new_accel_sensor_rate_sample (uint8_t instance, const Vector3f &accel)
 
void _notify_new_gyro_sensor_rate_sample (uint8_t instance, const Vector3f &gyro)
 
void notify_accel_fifo_reset (uint8_t instance)
 
void notify_gyro_fifo_reset (uint8_t instance)
 
- Protected Attributes inherited from AP_InertialSensor_Backend
AP_InertialSensor_imu
 
AP_HAL::Semaphore_sem
 
int16_t _id = -1
 
int8_t _last_accel_filter_hz [INS_MAX_INSTANCES]
 
int8_t _last_gyro_filter_hz [INS_MAX_INSTANCES]
 

Detailed Description

Definition at line 11 of file AP_InertialSensor_LSM9DS0.h.

Member Enumeration Documentation

◆ accel_scale

Enumerator
A_SCALE_2G 
A_SCALE_4G 
A_SCALE_6G 
A_SCALE_8G 
A_SCALE_16G 

Definition at line 46 of file AP_InertialSensor_LSM9DS0.h.

◆ gyro_scale

Enumerator
G_SCALE_245DPS 
G_SCALE_500DPS 
G_SCALE_2000DPS 

Definition at line 40 of file AP_InertialSensor_LSM9DS0.h.

Constructor & Destructor Documentation

◆ ~AP_InertialSensor_LSM9DS0()

virtual AP_InertialSensor_LSM9DS0::~AP_InertialSensor_LSM9DS0 ( )
inlinevirtual

Definition at line 14 of file AP_InertialSensor_LSM9DS0.h.

Here is the call graph for this function:

◆ AP_InertialSensor_LSM9DS0()

AP_InertialSensor_LSM9DS0::AP_InertialSensor_LSM9DS0 ( AP_InertialSensor imu,
AP_HAL::OwnPtr< AP_HAL::SPIDevice dev_gyro,
AP_HAL::OwnPtr< AP_HAL::SPIDevice dev_accel,
int  drdy_pin_num_a,
int  drdy_pin_num_b,
enum Rotation  rotation_a,
enum Rotation  rotation_g,
enum Rotation  rotation_gH 
)
private

Definition at line 374 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by probe(), and ~AP_InertialSensor_LSM9DS0().

Here is the caller graph for this function:

Member Function Documentation

◆ _accel_data_ready()

bool AP_InertialSensor_LSM9DS0::_accel_data_ready ( )
private

Definition at line 706 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _hardware_init(), and _poll_data().

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

◆ _accel_disable_i2c()

void AP_InertialSensor_LSM9DS0::_accel_disable_i2c ( )
private

Definition at line 577 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _accel_init().

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

◆ _accel_init()

void AP_InertialSensor_LSM9DS0::_accel_init ( )
private

Definition at line 621 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _hardware_init().

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

◆ _gyro_data_ready()

bool AP_InertialSensor_LSM9DS0::_gyro_data_ready ( )
private

Definition at line 716 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _hardware_init(), and _poll_data().

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

◆ _gyro_disable_i2c()

void AP_InertialSensor_LSM9DS0::_gyro_disable_i2c ( )
private

Definition at line 563 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _gyro_init().

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

◆ _gyro_init()

void AP_InertialSensor_LSM9DS0::_gyro_init ( )
private

Definition at line 589 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _hardware_init().

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

◆ _hardware_init()

bool AP_InertialSensor_LSM9DS0::_hardware_init ( void  )
private

Definition at line 450 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _init_sensor().

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

◆ _init_sensor()

bool AP_InertialSensor_LSM9DS0::_init_sensor ( void  )
private

Definition at line 415 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by probe().

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

◆ _poll_data()

void AP_InertialSensor_LSM9DS0::_poll_data ( )
private

Timer process to poll for new data from the LSM9DS0.

Definition at line 688 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by start().

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

◆ _read_data_transaction_a()

void AP_InertialSensor_LSM9DS0::_read_data_transaction_a ( )
private

Definition at line 726 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _poll_data().

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

◆ _read_data_transaction_g()

void AP_InertialSensor_LSM9DS0::_read_data_transaction_g ( )
private

Definition at line 746 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _poll_data().

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

◆ _register_read_g()

uint8_t AP_InertialSensor_LSM9DS0::_register_read_g ( uint8_t  reg)
private

Definition at line 544 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _gyro_data_ready(), _gyro_disable_i2c(), _hardware_init(), and update().

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

◆ _register_read_xm()

uint8_t AP_InertialSensor_LSM9DS0::_register_read_xm ( uint8_t  reg)
private

Definition at line 535 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _accel_data_ready(), _accel_disable_i2c(), _hardware_init(), and update().

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

◆ _register_write_g()

void AP_InertialSensor_LSM9DS0::_register_write_g ( uint8_t  reg,
uint8_t  val,
bool  checked = false 
)
private

Definition at line 558 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _gyro_disable_i2c(), and _gyro_init().

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

◆ _register_write_xm()

void AP_InertialSensor_LSM9DS0::_register_write_xm ( uint8_t  reg,
uint8_t  val,
bool  checked = false 
)
private

Definition at line 553 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _accel_disable_i2c(), and _accel_init().

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

◆ _set_accel_scale()

void AP_InertialSensor_LSM9DS0::_set_accel_scale ( accel_scale  scale)
private

Definition at line 669 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _accel_init().

Here is the caller graph for this function:

◆ _set_gyro_scale()

void AP_InertialSensor_LSM9DS0::_set_gyro_scale ( gyro_scale  scale)
private

Definition at line 648 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by _gyro_init().

Here is the caller graph for this function:

◆ probe()

AP_InertialSensor_Backend * AP_InertialSensor_LSM9DS0::probe ( AP_InertialSensor imu,
AP_HAL::OwnPtr< AP_HAL::SPIDevice dev_gyro,
AP_HAL::OwnPtr< AP_HAL::SPIDevice dev_accel,
enum Rotation  rotation_a = ROTATION_NONE,
enum Rotation  rotation_g = ROTATION_NONE,
enum Rotation  rotation_gH = ROTATION_NONE 
)
static

Definition at line 393 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by AP_InertialSensor::detect_backends(), and ~AP_InertialSensor_LSM9DS0().

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

◆ start()

void AP_InertialSensor_LSM9DS0::start ( void  )
overridevirtual

Reimplemented from AP_InertialSensor_Backend.

Definition at line 516 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by ~AP_InertialSensor_LSM9DS0().

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

◆ update()

bool AP_InertialSensor_LSM9DS0::update ( void  )
overridevirtual

Implements AP_InertialSensor_Backend.

Definition at line 764 of file AP_InertialSensor_LSM9DS0.cpp.

Referenced by ~AP_InertialSensor_LSM9DS0().

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

Member Data Documentation

◆ _accel_instance

uint8_t AP_InertialSensor_LSM9DS0::_accel_instance
private

Definition at line 100 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _poll_data(), _read_data_transaction_a(), start(), and update().

◆ _accel_scale

float AP_InertialSensor_LSM9DS0::_accel_scale
private

Definition at line 96 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _read_data_transaction_a(), and _set_accel_scale().

◆ _dev_accel

AP_HAL::OwnPtr<AP_HAL::SPIDevice> AP_InertialSensor_LSM9DS0::_dev_accel
private

◆ _dev_gyro

AP_HAL::OwnPtr<AP_HAL::SPIDevice> AP_InertialSensor_LSM9DS0::_dev_gyro
private

◆ _drdy_pin_a

AP_HAL::DigitalSource* AP_InertialSensor_LSM9DS0::_drdy_pin_a
private

Definition at line 93 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _accel_data_ready(), and _init_sensor().

◆ _drdy_pin_g

AP_HAL::DigitalSource* AP_InertialSensor_LSM9DS0::_drdy_pin_g
private

Definition at line 94 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _gyro_data_ready(), and _init_sensor().

◆ _drdy_pin_num_a

int AP_InertialSensor_LSM9DS0::_drdy_pin_num_a
private

Definition at line 97 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _init_sensor().

◆ _drdy_pin_num_g

int AP_InertialSensor_LSM9DS0::_drdy_pin_num_g
private

Definition at line 98 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _init_sensor().

◆ _gyro_instance

uint8_t AP_InertialSensor_LSM9DS0::_gyro_instance
private

Definition at line 99 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _poll_data(), _read_data_transaction_g(), start(), and update().

◆ _gyro_scale

float AP_InertialSensor_LSM9DS0::_gyro_scale
private

Definition at line 95 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _read_data_transaction_g(), and _set_gyro_scale().

◆ _rotation_a

enum Rotation AP_InertialSensor_LSM9DS0::_rotation_a
private

Definition at line 109 of file AP_InertialSensor_LSM9DS0.h.

Referenced by start().

◆ _rotation_g

enum Rotation AP_InertialSensor_LSM9DS0::_rotation_g
private

Definition at line 110 of file AP_InertialSensor_LSM9DS0.h.

Referenced by start().

◆ _rotation_gH

enum Rotation AP_InertialSensor_LSM9DS0::_rotation_gH
private

Definition at line 111 of file AP_InertialSensor_LSM9DS0.h.

Referenced by start().

◆ _spi_sem

AP_HAL::Semaphore* AP_InertialSensor_LSM9DS0::_spi_sem
private

Definition at line 85 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _hardware_init(), and _init_sensor().

◆ whoami_g

uint8_t AP_InertialSensor_LSM9DS0::whoami_g
private

Definition at line 103 of file AP_InertialSensor_LSM9DS0.h.

Referenced by _hardware_init(), and start().


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