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

#include <AP_InertialSensor_LSM9DS1.h>

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

Classes

struct  sensor_raw_data
 

Public Member Functions

virtual ~AP_InertialSensor_LSM9DS1 ()
 
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, enum Rotation rotation=ROTATION_NONE)
 

Private Types

enum  accel_scale { A_SCALE_2G = 0, A_SCALE_4G, A_SCALE_8G, A_SCALE_16G }
 

Private Member Functions

 AP_InertialSensor_LSM9DS1 (AP_InertialSensor &imu, AP_HAL::OwnPtr< AP_HAL::SPIDevice > dev, int drdy_pin_num_xg, enum Rotation rotation)
 
void _poll_data ()
 
void _fifo_reset ()
 
bool _init_sensor ()
 
bool _hardware_init ()
 
void _gyro_init ()
 
void _accel_init ()
 
void _set_gyro_scale ()
 
void _set_accel_scale (accel_scale scale)
 
uint8_t _register_read (uint8_t reg)
 
void _register_write (uint8_t reg, uint8_t val, bool checked=false)
 
void _read_data_transaction_x (uint16_t samples)
 
void _read_data_transaction_g (uint16_t samples)
 

Static Private Member Functions

static AP_InertialSensor_Backenddetect (AP_InertialSensor &imu)
 

Private Attributes

AP_HAL::OwnPtr< AP_HAL::SPIDevice_dev
 
AP_HAL::Semaphore_spi_sem
 
AP_HAL::DigitalSource_drdy_pin_xg
 
float _gyro_scale
 
float _accel_scale
 
int _drdy_pin_num_xg
 
uint8_t _gyro_instance
 
uint8_t _accel_instance
 
enum Rotation _rotation
 

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 12 of file AP_InertialSensor_LSM9DS1.h.

Member Enumeration Documentation

◆ accel_scale

Enumerator
A_SCALE_2G 
A_SCALE_4G 
A_SCALE_8G 
A_SCALE_16G 

Definition at line 36 of file AP_InertialSensor_LSM9DS1.h.

Constructor & Destructor Documentation

◆ ~AP_InertialSensor_LSM9DS1()

virtual AP_InertialSensor_LSM9DS1::~AP_InertialSensor_LSM9DS1 ( )
inlinevirtual

Definition at line 15 of file AP_InertialSensor_LSM9DS1.h.

Here is the call graph for this function:

◆ AP_InertialSensor_LSM9DS1()

AP_InertialSensor_LSM9DS1::AP_InertialSensor_LSM9DS1 ( AP_InertialSensor imu,
AP_HAL::OwnPtr< AP_HAL::SPIDevice dev,
int  drdy_pin_num_xg,
enum Rotation  rotation 
)
private

Definition at line 196 of file AP_InertialSensor_LSM9DS1.cpp.

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

Here is the caller graph for this function:

Member Function Documentation

◆ _accel_init()

void AP_InertialSensor_LSM9DS1::_accel_init ( )
private

Definition at line 373 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _hardware_init().

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

◆ _fifo_reset()

void AP_InertialSensor_LSM9DS1::_fifo_reset ( )
private

Definition at line 302 of file AP_InertialSensor_LSM9DS1.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_init()

void AP_InertialSensor_LSM9DS1::_gyro_init ( )
private

Definition at line 360 of file AP_InertialSensor_LSM9DS1.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_LSM9DS1::_hardware_init ( void  )
private

Definition at line 247 of file AP_InertialSensor_LSM9DS1.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_LSM9DS1::_init_sensor ( void  )
private

Definition at line 227 of file AP_InertialSensor_LSM9DS1.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_LSM9DS1::_poll_data ( )
private

Timer process to poll for new data from the LSM9DS1.

Definition at line 415 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by start().

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

◆ _read_data_transaction_g()

void AP_InertialSensor_LSM9DS1::_read_data_transaction_g ( uint16_t  samples)
private

Definition at line 473 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _poll_data().

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

◆ _read_data_transaction_x()

void AP_InertialSensor_LSM9DS1::_read_data_transaction_x ( uint16_t  samples)
private

Definition at line 436 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _poll_data().

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

◆ _register_read()

uint8_t AP_InertialSensor_LSM9DS1::_register_read ( uint8_t  reg)
private

Definition at line 347 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _fifo_reset(), _hardware_init(), _poll_data(), and update().

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

◆ _register_write()

void AP_InertialSensor_LSM9DS1::_register_write ( uint8_t  reg,
uint8_t  val,
bool  checked = false 
)
private

Definition at line 355 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _accel_init(), and _gyro_init().

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

◆ _set_accel_scale()

void AP_InertialSensor_LSM9DS1::_set_accel_scale ( accel_scale  scale)
private

Definition at line 396 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _accel_init().

Here is the caller graph for this function:

◆ _set_gyro_scale()

void AP_InertialSensor_LSM9DS1::_set_gyro_scale ( )
private

Definition at line 386 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by _gyro_init().

Here is the caller graph for this function:

◆ detect()

static AP_InertialSensor_Backend* AP_InertialSensor_LSM9DS1::detect ( AP_InertialSensor imu)
staticprivate

Referenced by ~AP_InertialSensor_LSM9DS1().

Here is the caller graph for this function:

◆ probe()

AP_InertialSensor_Backend * AP_InertialSensor_LSM9DS1::probe ( AP_InertialSensor imu,
AP_HAL::OwnPtr< AP_HAL::SPIDevice dev,
enum Rotation  rotation = ROTATION_NONE 
)
static

Definition at line 208 of file AP_InertialSensor_LSM9DS1.cpp.

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

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

◆ start()

void AP_InertialSensor_LSM9DS1::start ( void  )
overridevirtual

Reimplemented from AP_InertialSensor_Backend.

Definition at line 333 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by ~AP_InertialSensor_LSM9DS1().

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

◆ update()

bool AP_InertialSensor_LSM9DS1::update ( void  )
overridevirtual

Implements AP_InertialSensor_Backend.

Definition at line 506 of file AP_InertialSensor_LSM9DS1.cpp.

Referenced by ~AP_InertialSensor_LSM9DS1().

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_LSM9DS1::_accel_instance
private

◆ _accel_scale

float AP_InertialSensor_LSM9DS1::_accel_scale
private

Definition at line 69 of file AP_InertialSensor_LSM9DS1.h.

Referenced by _read_data_transaction_x(), and _set_accel_scale().

◆ _dev

AP_HAL::OwnPtr<AP_HAL::SPIDevice> AP_InertialSensor_LSM9DS1::_dev
private

◆ _drdy_pin_num_xg

int AP_InertialSensor_LSM9DS1::_drdy_pin_num_xg
private

Definition at line 70 of file AP_InertialSensor_LSM9DS1.h.

Referenced by _init_sensor().

◆ _drdy_pin_xg

AP_HAL::DigitalSource* AP_InertialSensor_LSM9DS1::_drdy_pin_xg
private

Definition at line 67 of file AP_InertialSensor_LSM9DS1.h.

Referenced by _init_sensor().

◆ _gyro_instance

uint8_t AP_InertialSensor_LSM9DS1::_gyro_instance
private

Definition at line 71 of file AP_InertialSensor_LSM9DS1.h.

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

◆ _gyro_scale

float AP_InertialSensor_LSM9DS1::_gyro_scale
private

Definition at line 68 of file AP_InertialSensor_LSM9DS1.h.

Referenced by _read_data_transaction_g(), and _set_gyro_scale().

◆ _rotation

enum Rotation AP_InertialSensor_LSM9DS1::_rotation
private

Definition at line 73 of file AP_InertialSensor_LSM9DS1.h.

Referenced by start().

◆ _spi_sem

AP_HAL::Semaphore* AP_InertialSensor_LSM9DS1::_spi_sem
private

Definition at line 66 of file AP_InertialSensor_LSM9DS1.h.

Referenced by _hardware_init(), and _init_sensor().


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