xpcc
xpcc::Lis3dsh< Transport > Class Template Reference

LIS3DSH 3-Axis accelerometer. More...

#include <xpcc/driver/inertial/lis3dsh.hpp>

Inheritance diagram for xpcc::Lis3dsh< Transport >:
xpcc::lis3dsh

Public Member Functions

 Lis3dsh (Data &data, uint8_t address=0x1D)
 Constructor, requires a lis3dsh::Data object. More...
 
bool configureBlocking (Scale scale, MeasurementRate rate=MeasurementRate::Hz100)
 
xpcc::ResumableResult< bool > configure (Scale scale, MeasurementRate rate=MeasurementRate::Hz100)
 
xpcc::ResumableResult< bool > updateSmControl1 (SmControl_t setMask, SmControl_t clearMask=SmControl_t(0xff))
 
xpcc::ResumableResult< bool > updateSmControl2 (SmControl_t setMask, SmControl_t clearMask=SmControl_t(0xff))
 
xpcc::ResumableResult< bool > updateControl (Control3_t setMask, Control3_t clearMask=Control3_t(0xff))
 
xpcc::ResumableResult< bool > updateControl (Control4_t setMask, Control4_t clearMask=Control4_t(0xff))
 
xpcc::ResumableResult< bool > updateControl (Control5_t setMask, Control5_t clearMask=Control5_t(0xff))
 
xpcc::ResumableResult< bool > updateControl (Control6_t setMask, Control6_t clearMask=Control6_t(0xff))
 
xpcc::ResumableResult< bool > readAcceleration ()
 
SmControl_t getControl1 ()
 
SmControl_t getControl2 ()
 
Control3_t getControl3 ()
 
Control4_t getControl4 ()
 
Control5_t getControl5 ()
 
Control6_t getControl6 ()
 
FifoControl_t getFifoControl ()
 
Status_t getStatus ()
 
FifoSource_t getFifoSource ()
 
DatagetData ()
 Get the data object for this sensor.
 

Additional Inherited Members

- Public Types inherited from xpcc::lis3dsh
enum  Register : uint8_t {
  Register::INFO1,
  Register::INFO2,
  Register::WHO_AM_I,
  Register::CTRL_REG3,
  Register::CTRL_REG4,
  Register::CTRL_REG5,
  Register::CTRL_REG6,
  Register::STATUS,
  Register::OUT_T,
  Register::OFF_X,
  Register::OFF_Y,
  Register::OFF_Z,
  Register::CS_X,
  Register::CS_Y,
  Register::CS_Z,
  Register::LC_L,
  Register::LC_H,
  Register::STAT,
  Register::VFC_1,
  Register::VFC_2,
  Register::VFC_3,
  Register::VFC_4,
  Register::THRS3,
  Register::OUT_X_L,
  Register::OUT_X_H,
  Register::OUT_Y_L,
  Register::OUT_Y_H,
  Register::OUT_Z_L,
  Register::OUT_Z_H,
  Register::FIFO_CTRL,
  Register::FIFO_SRC,
  Register::CTRL_REG1,
  Register::ST1_0,
  Register::TIM4_1,
  Register::TIM3_1,
  Register::TIM2_1_L,
  Register::TIM2_1_H,
  Register::TIM1_1_L,
  Register::TIM1_1_H,
  Register::THRS2_1,
  Register::THRS1_1,
  Register::MASK1_B,
  Register::MASK1_A,
  Register::SETT1,
  Register::PR1,
  Register::TC1_L,
  Register::TC1_H,
  Register::OUTS1,
  Register::PEAK1,
  Register::CTRL_REG2,
  Register::ST2_0,
  Register::TIM4_2,
  Register::TIM3_2,
  Register::TIM2_2_L,
  Register::TIM2_2_H,
  Register::TIM1_2_L,
  Register::TIM1_2_H,
  Register::THRS2_2,
  Register::THRS1_2,
  Register::MASK2_B,
  Register::MASK2_A,
  Register::SETT2,
  Register::PR2,
  Register::TC2_L,
  Register::TC2_H,
  Register::OUTS2,
  Register::PEAK2,
  Register::DES2
}
 
enum  Control3 : uint8_t {
  Control3::DR_EN,
  Control3::IEA,
  Control3::IEL,
  Control3::INT2_EN,
  Control3::INT1_EN,
  Control3::VFILT,
  Control3::STRT
}
 CTRL_REG3 default value is 0x00. More...
 
enum  Control4 : uint8_t {
  ODR3,
  ODR2,
  ODR1,
  ODR0,
  ODR_Mask,
  Control4::BDU,
  Control4::ZEN,
  Control4::YEN,
  Control4::XEN
}
 CTRL_REG4 default value is 0x07. More...
 
enum  Control5 : uint8_t {
  BW2,
  BW1,
  FSCALE2,
  FSCALE1,
  FSCALE0,
  FSCALE_Mask,
  ST2,
  ST1,
  Control5::SIM
}
 CTRL_REG5 default value is 0x00. More...
 
enum  Control6 : uint8_t {
  Control6::BOOT,
  Control6::FIFO_EN,
  Control6::WTM_EN,
  Control6::ADD_INC,
  Control6::P1_EMPTY,
  Control6::P1_WTM,
  Control6::P1_OVERRUN,
  Control6::P2_BOOT
}
 CTRL_REG6 default value is 0x00. More...
 
enum  Status : uint8_t {
  Status::ZYXOR,
  Status::ZOR,
  Status::YOR,
  Status::XOR,
  Status::ZYXDA,
  Status::ZDA,
  Status::YDA,
  Status::XDA
}
 STATUS is read-only. More...
 
enum  IntStatus : uint8_t {
  IntStatus::LONG,
  IntStatus::SYNCW,
  IntStatus::SYNC1,
  IntStatus::SYNC2,
  IntStatus::INT_SM1,
  IntStatus::INT_SM2,
  IntStatus::DOR,
  IntStatus::DRDY
}
 STAT is read-only. More...
 
enum  FifoControl : uint8_t {
  FMODE2,
  FMODE1,
  FMODE0,
  FMODE_Mask,
  WTMP4,
  WTMP3,
  WTMP2,
  WTMP1,
  WTMP0,
  WTMP_Mask
}
 FIFO_CTRL default value is 0x00.
 
enum  FifoSource : uint8_t {
  WTM,
  OVRN_FIFO,
  EMPTY,
  FSS4,
  FSS3,
  FSS2,
  FSS1,
  FSS0,
  FSS_Mask
}
 FIFO_SRC is read-only.
 
enum  AxisSign : uint8_t {
  P_X,
  N_X,
  P_Y,
  N_Y,
  P_Z,
  N_Z,
  P_V,
  N_V
}
 MASK1_A, MASK1_B, MASK2_A, MASK2_B, OUTS1, OUTS2.
 
enum  SmControl : uint8_t {
  HYST2,
  HYST1,
  HYST0,
  HYST_Mask,
  SM_PIN,
  SM_EN
}
 CTRL_REG1, CTRL_REG2.
 
enum  Sett : uint8_t {
  P_DET,
  THR3_SA,
  ABS,
  THR3_MA,
  R_TAM,
  SITR
}
 SETT1, SETT2.
 
enum  NR : uint8_t {
  NOP,
  TI1,
  TI2,
  TI3,
  TI4,
  GNTH1,
  GNTH2,
  LNTH1,
  LNTH2,
  GRTH1,
  GRTH2,
  LRTH1,
  LRTH2,
  GTTH1,
  LLTH2,
  NZERO
}
 
enum  CMD : uint8_t {
  STOP,
  CONT,
  JMP,
  SRP,
  CRP,
  SETP,
  SETS1,
  STHR1,
  OUTC,
  OUTW,
  STHR2,
  DEC,
  SISW,
  REL,
  STHR3,
  SSYNC,
  SABS0,
  SABS1,
  SELMA,
  SRADI0,
  SRADI1,
  SELSA,
  SCS0,
  SCS1,
  SRTAM0,
  STIM3,
  STIM4,
  SRTAM1
}
 
enum  FifoMode : uint8_t {
  Bypass,
  Fifo,
  Stream,
  StreamTriggerFifo,
  BypassTriggerStream,
  BypassTriggerFifo
}
 
enum  MeasurementRate : uint8_t {
  Off,
  Hz3_125,
  Hz6_25,
  Hz12_5,
  Hz25,
  Hz50,
  Hz100,
  Hz400,
  Hz800,
  Hz1600
}
 
enum  Scale : uint8_t {
  G2,
  G4,
  G6,
  G8,
  G16
}
 
enum  Interrupt : uint8_t {
  One,
  Two
}
 
enum  Axis : uint8_t {
  X,
  Y,
  Z
}
 
typedef xpcc::Flags8< Control3Control3_t
 
typedef xpcc::Flags8< Control4Control4_t
 
typedef xpcc::Flags8< Control5Control5_t
 
typedef xpcc::Flags8< Control6Control6_t
 
typedef xpcc::Flags8< StatusStatus_t
 
typedef xpcc::Flags8< IntStatusIntStatus_t
 
typedef xpcc::Flags8< FifoControlFifoControl_t
 
typedef xpcc::Flags8< FifoSourceFifoSource_t
 
typedef xpcc::Flags8< AxisSignAxisSign_t
 
typedef xpcc::Flags8< SmControlSmControl_t
 
typedef xpcc::Flags8< SettSett_t
 
typedef FlagsGroup< SmControl_t, Control3_t, Control4_t, Control5_t, Control6_tControl_t
 
- Static Public Member Functions inherited from xpcc::lis3dsh
static constexpr NR next (NR cond)
 
static constexpr NR reset (NR cond)
 

Detailed Description

template<class Transport>
class xpcc::Lis3dsh< Transport >

The LIS3DSH is an ultra low-power high performance three-axis linear accelerometer belonging to the "nano" family with embedded state machine that can be programmed to implement autonomous applications. The LIS3DSH has dynamically selectable full scales of ±2g/±4g/±6g/±8g/±16g and it is capable of measuring accelerations with output data rates from 3.125 Hz to 1.6 kHz.

Template Parameters
TransportEither the I2C or SPI Transport Layer.
See also
Lis3TransportI2c
Lis3TransportSpi
Author
Niklas Hauser

Constructor & Destructor Documentation

◆ Lis3dsh()

template<class Transport >
xpcc::Lis3dsh< Transport >::Lis3dsh ( Data data,
uint8_t  address = 0x1D 
)

For I2c this also sets the address to 0x1D (alternative: 0x1C).


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