Pololu Zumo Shield Arduino Library
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
LSM303 Class Reference

Classes

struct  vector
 

Public Types

enum  deviceType {
  device_DLH, device_DLM, device_DLHC, device_D,
  device_auto
}
 
enum  sa0State { sa0_low, sa0_high, sa0_auto }
 
enum  regAddr {
  TEMP_OUT_L = 0x05, TEMP_OUT_H = 0x06, STATUS_M = 0x07, INT_CTRL_M = 0x12,
  INT_SRC_M = 0x13, INT_THS_L_M = 0x14, INT_THS_H_M = 0x15, OFFSET_X_L_M = 0x16,
  OFFSET_X_H_M = 0x17, OFFSET_Y_L_M = 0x18, OFFSET_Y_H_M = 0x19, OFFSET_Z_L_M = 0x1A,
  OFFSET_Z_H_M = 0x1B, REFERENCE_X = 0x1C, REFERENCE_Y = 0x1D, REFERENCE_Z = 0x1E,
  CTRL0 = 0x1F, CTRL1 = 0x20, CTRL_REG1_A = 0x20, CTRL2 = 0x21,
  CTRL_REG2_A = 0x21, CTRL3 = 0x22, CTRL_REG3_A = 0x22, CTRL4 = 0x23,
  CTRL_REG4_A = 0x23, CTRL5 = 0x24, CTRL_REG5_A = 0x24, CTRL6 = 0x25,
  CTRL_REG6_A = 0x25, HP_FILTER_RESET_A = 0x25, CTRL7 = 0x26, REFERENCE_A = 0x26,
  STATUS_A = 0x27, STATUS_REG_A = 0x27, OUT_X_L_A = 0x28, OUT_X_H_A = 0x29,
  OUT_Y_L_A = 0x2A, OUT_Y_H_A = 0x2B, OUT_Z_L_A = 0x2C, OUT_Z_H_A = 0x2D,
  FIFO_CTRL = 0x2E, FIFO_CTRL_REG_A = 0x2E, FIFO_SRC = 0x2F, FIFO_SRC_REG_A = 0x2F,
  IG_CFG1 = 0x30, INT1_CFG_A = 0x30, IG_SRC1 = 0x31, INT1_SRC_A = 0x31,
  IG_THS1 = 0x32, INT1_THS_A = 0x32, IG_DUR1 = 0x33, INT1_DURATION_A = 0x33,
  IG_CFG2 = 0x34, INT2_CFG_A = 0x34, IG_SRC2 = 0x35, INT2_SRC_A = 0x35,
  IG_THS2 = 0x36, INT2_THS_A = 0x36, IG_DUR2 = 0x37, INT2_DURATION_A = 0x37,
  CLICK_CFG = 0x38, CLICK_CFG_A = 0x38, CLICK_SRC = 0x39, CLICK_SRC_A = 0x39,
  CLICK_THS = 0x3A, CLICK_THS_A = 0x3A, TIME_LIMIT = 0x3B, TIME_LIMIT_A = 0x3B,
  TIME_LATENCY = 0x3C, TIME_LATENCY_A = 0x3C, TIME_WINDOW = 0x3D, TIME_WINDOW_A = 0x3D,
  Act_THS = 0x3E, Act_DUR = 0x3F, CRA_REG_M = 0x00, CRB_REG_M = 0x01,
  MR_REG_M = 0x02, SR_REG_M = 0x09, IRA_REG_M = 0x0A, IRB_REG_M = 0x0B,
  IRC_REG_M = 0x0C, WHO_AM_I = 0x0F, WHO_AM_I_M = 0x0F, TEMP_OUT_H_M = 0x31,
  TEMP_OUT_L_M = 0x32, OUT_X_H_M = -1, OUT_X_L_M = -2, OUT_Y_H_M = -3,
  OUT_Y_L_M = -4, OUT_Z_H_M = -5, OUT_Z_L_M = -6, DLH_OUT_X_H_M = 0x03,
  DLH_OUT_X_L_M = 0x04, DLH_OUT_Y_H_M = 0x05, DLH_OUT_Y_L_M = 0x06, DLH_OUT_Z_H_M = 0x07,
  DLH_OUT_Z_L_M = 0x08, DLM_OUT_X_H_M = 0x03, DLM_OUT_X_L_M = 0x04, DLM_OUT_Z_H_M = 0x05,
  DLM_OUT_Z_L_M = 0x06, DLM_OUT_Y_H_M = 0x07, DLM_OUT_Y_L_M = 0x08, DLHC_OUT_X_H_M = 0x03,
  DLHC_OUT_X_L_M = 0x04, DLHC_OUT_Z_H_M = 0x05, DLHC_OUT_Z_L_M = 0x06, DLHC_OUT_Y_H_M = 0x07,
  DLHC_OUT_Y_L_M = 0x08, D_OUT_X_L_M = 0x08, D_OUT_X_H_M = 0x09, D_OUT_Y_L_M = 0x0A,
  D_OUT_Y_H_M = 0x0B, D_OUT_Z_L_M = 0x0C, D_OUT_Z_H_M = 0x0D
}
 

Public Member Functions

bool init (deviceType device=device_auto, sa0State sa0=sa0_auto)
 
deviceType getDeviceType (void)
 
void enableDefault (void)
 
void writeAccReg (byte reg, byte value)
 
byte readAccReg (byte reg)
 
void writeMagReg (byte reg, byte value)
 
byte readMagReg (int reg)
 
void writeReg (byte reg, byte value)
 
byte readReg (int reg)
 
void readAcc (void)
 
void readMag (void)
 
void read (void)
 
void setTimeout (unsigned int timeout)
 
unsigned int getTimeout (void)
 
bool timeoutOccurred (void)
 
float heading (void)
 
template<typename T >
float heading (vector< T > from)
 

Static Public Member Functions

template<typename Ta , typename Tb , typename To >
static void vector_cross (const vector< Ta > *a, const vector< Tb > *b, vector< To > *out)
 
template<typename Ta , typename Tb >
static float vector_dot (const vector< Ta > *a, const vector< Tb > *b)
 
static void vector_normalize (vector< float > *a)
 

Public Attributes

vector< int16_t > a
 
vector< int16_t > m
 
vector< int16_t > m_max
 
vector< int16_t > m_min
 
byte last_status
 

Detailed Description

Definition at line 6 of file LSM303.h.


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