Adafruit MSA301 Sensor Library
Classes | Macros | Enumerations
Adafruit_MSA301.h File Reference
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>

Go to the source code of this file.

Classes

class  Adafruit_MSA301
 

Macros

#define MSA301_I2CADDR_DEFAULT   (0x26)
 Fixed I2C address.
 
#define MSA301_REG_PARTID   0x01
 Register that contains the part ID.
 
#define MSA301_REG_OUT_X_L   0x02
 Register address for X axis lower byte.
 
#define MSA301_REG_OUT_X_H   0x03
 Register address for X axis higher byte.
 
#define MSA301_REG_OUT_Y_L   0x04
 Register address for Y axis lower byte.
 
#define MSA301_REG_OUT_Y_H   0x05
 Register address for Y axis higher byte.
 
#define MSA301_REG_OUT_Z_L   0x06
 Register address for Z axis lower byte.
 
#define MSA301_REG_OUT_Z_H   0x07
 Register address for Z axis higher byte.
 
#define MSA301_REG_MOTIONINT   0x09
 Register address for motion interrupt.
 
#define MSA301_REG_DATAINT   0x0A
 Register address for data interrupt.
 
#define MSA301_REG_CLICKSTATUS   0x0B
 Register address for click/doubleclick status.
 
#define MSA301_REG_RESRANGE   0x0F
 Register address for resolution range.
 
#define MSA301_REG_ODR   0x10
 Register address for data rate setting.
 
#define MSA301_REG_POWERMODE   0x11
 Register address for power mode setting.
 
#define MSA301_REG_INTSET0   0x16
 Register address for interrupt setting #0.
 
#define MSA301_REG_INTSET1   0x17
 Register address for interrupt setting #1.
 
#define MSA301_REG_INTMAP0   0x19
 Register address for interrupt map #0.
 
#define MSA301_REG_INTMAP1   0x1A
 Register address for interrupt map #1.
 
#define MSA301_REG_TAPDUR   0x2A
 Register address for tap duration.
 
#define MSA301_REG_TAPTH   0x2B
 Register address for tap threshold.
 

Enumerations

enum  msa301_range_t { MSA301_RANGE_2_G = 0b00, MSA301_RANGE_4_G = 0b01, MSA301_RANGE_8_G = 0b10, MSA301_RANGE_16_G = 0b11 }
 
enum  msa301_axis_t { MSA301_AXIS_X = 0x0, MSA301_AXIS_Y = 0x1, MSA301_AXIS_Z = 0x2 }
 
enum  msa301_dataRate_t {
  MSA301_DATARATE_1_HZ = 0b0000, MSA301_DATARATE_1_95_HZ = 0b0001, MSA301_DATARATE_3_9_HZ = 0b0010, MSA301_DATARATE_7_81_HZ = 0b0011,
  MSA301_DATARATE_15_63_HZ = 0b0100, MSA301_DATARATE_31_25_HZ = 0b0101, MSA301_DATARATE_62_5_HZ = 0b0110, MSA301_DATARATE_125_HZ = 0b0111,
  MSA301_DATARATE_250_HZ = 0b1000, MSA301_DATARATE_500_HZ = 0b1001, MSA301_DATARATE_1000_HZ = 0b1010
}
 
enum  msa301_bandwidth_t {
  MSA301_BANDWIDTH_1_95_HZ = 0b0000, MSA301_BANDWIDTH_3_9_HZ = 0b0011, MSA301_BANDWIDTH_7_81_HZ = 0b0100, MSA301_BANDWIDTH_15_63_HZ = 0b0101,
  MSA301_BANDWIDTH_31_25_HZ = 0b0110, MSA301_BANDWIDTH_62_5_HZ = 0b0111, MSA301_BANDWIDTH_125_HZ = 0b1000, MSA301_BANDWIDTH_250_HZ = 0b1001,
  MSA301_BANDWIDTH_500_HZ = 0b1010
}
 
enum  msa301_powermode_t { MSA301_NORMALMODE = 0b00, MSA301_LOWPOWERMODE = 0b01, MSA301_SUSPENDMODE = 0b010 }
 
enum  msa301_resolution_t { MSA301_RESOLUTION_14 = 0b00, MSA301_RESOLUTION_12 = 0b01, MSA301_RESOLUTION_10 = 0b10, MSA301_RESOLUTION_8 = 0b11 }
 
enum  msa301_tapduration_t {
  MSA301_TAPDUR_50_MS = 0b000, MSA301_TAPDUR_100_MS = 0b001, MSA301_TAPDUR_150_MS = 0b010, MSA301_TAPDUR_200_MS = 0b011,
  MSA301_TAPDUR_250_MS = 0b100, MSA301_TAPDUR_375_MS = 0b101, MSA301_TAPDUR_500_MS = 0b110, MSA301_TAPDUR_700_MS = 0b111
}
 
enum  msa301_interrupt_t {
  MSA301_INT_ORIENT = 0b100000, MSA301_INT_SINGLETAP, MSA301_INT_DOUBLETAP, MSA301_INT_ACTIVE,
  MSA301_INT_NEWDATA
}
 

Enumeration Type Documentation

◆ msa301_range_t

The accelerometer ranges

Enumerator
MSA301_RANGE_2_G 

+/- 2g (default value)

MSA301_RANGE_4_G 

+/- 4g

MSA301_RANGE_8_G 

+/- 8g

MSA301_RANGE_16_G 

+/- 16g

◆ msa301_axis_t

The accelerometer axes

Enumerator
MSA301_AXIS_X 

X axis bit.

MSA301_AXIS_Y 

Y axis bit.

MSA301_AXIS_Z 

Z axis bit.

◆ msa301_dataRate_t

The accelerometer data rate

Enumerator
MSA301_DATARATE_1_HZ 

1 Hz

MSA301_DATARATE_1_95_HZ 

1.95 Hz

MSA301_DATARATE_3_9_HZ 

3.9 Hz

MSA301_DATARATE_7_81_HZ 

7.81 Hz

MSA301_DATARATE_15_63_HZ 

15.63 Hz

MSA301_DATARATE_31_25_HZ 

31.25 Hz

MSA301_DATARATE_62_5_HZ 

62.5 Hz

MSA301_DATARATE_125_HZ 

125 Hz

MSA301_DATARATE_250_HZ 

250 Hz

MSA301_DATARATE_500_HZ 

500 Hz

MSA301_DATARATE_1000_HZ 

1000 Hz

◆ msa301_bandwidth_t

The accelerometer bandwidth

Enumerator
MSA301_BANDWIDTH_1_95_HZ 

1.95 Hz

MSA301_BANDWIDTH_3_9_HZ 

3.9 Hz

MSA301_BANDWIDTH_7_81_HZ 

7.81 Hz

MSA301_BANDWIDTH_15_63_HZ 

15.63 Hz

MSA301_BANDWIDTH_31_25_HZ 

31.25 Hz

MSA301_BANDWIDTH_62_5_HZ 

62.5 Hz

MSA301_BANDWIDTH_125_HZ 

125 Hz

MSA301_BANDWIDTH_250_HZ 

250 Hz

MSA301_BANDWIDTH_500_HZ 

500 Hz

◆ msa301_powermode_t

The accelerometer power mode

Enumerator
MSA301_NORMALMODE 

Normal (high speed) mode.

MSA301_LOWPOWERMODE 

Low power (slow speed) mode.

MSA301_SUSPENDMODE 

Suspend (sleep) mode.

◆ msa301_resolution_t

The accelerometer read resolution

Enumerator
MSA301_RESOLUTION_14 

14-bit resolution

MSA301_RESOLUTION_12 

12-bit resolution

MSA301_RESOLUTION_10 

10-bit resolution

MSA301_RESOLUTION_8 

8-bit resolution

◆ msa301_tapduration_t

Tap duration parameter

Enumerator
MSA301_TAPDUR_50_MS 

50 millis

MSA301_TAPDUR_100_MS 

100 millis

MSA301_TAPDUR_150_MS 

150 millis

MSA301_TAPDUR_200_MS 

200 millis

MSA301_TAPDUR_250_MS 

250 millis

MSA301_TAPDUR_375_MS 

375 millis

MSA301_TAPDUR_500_MS 

500 millis

MSA301_TAPDUR_700_MS 

50 millis700 millis

◆ msa301_interrupt_t

Interrupts available

Enumerator
MSA301_INT_ORIENT 

Orientation change interrupt.

MSA301_INT_SINGLETAP 

Single tap interrupt.

MSA301_INT_DOUBLETAP 

Double tap interrupt.

MSA301_INT_ACTIVE 

Active motion interrupt.

MSA301_INT_NEWDATA 

New data interrupt.