API for the BMA220 3-axis Accelerometer.
More...
The BMA220 is a low cost, very small 3-axis accelerometer with 6 bits of resolution. It can also detect orientation and tap events.
The BMA220 has a linear acceleration full scale of 2g/4g/8g/16g.
While not all of the functionality of this device is supported initially, methods and register definitions are provided that should allow an end user to implement whatever features are required.
This driver was developed on a DFRobot BMA (Tiny).
|
class | CONFIG2_LAT_T |
|
class | CONFIG_ORIENT_T |
|
class | ENABLE_CONFIG2_BITS_T |
|
class | ENABLE_CONFIG3_BITS_T |
|
class | ENABLE_CONFIG_BITS_T |
|
class | FILTER_CONFIG_BITS_T |
|
class | FILTER_CONFIG_T |
|
class | FSL_RANGE_T |
|
class | H_HYST_DUR_HIGH_BITS_T |
|
class | I2C_WATCHDOG_BITS_T |
|
class | INT_STATUS1_BITS_T |
|
class | INT_STATUS2_BITS_T |
|
class | L_HYST_DUR_LOW_BITS_T |
|
class | REG_T |
|
class | SBIST_FSL_CONFIG_BITS_T |
|
class | SBIST_T |
|
class | SLEEP_DUR_T |
|
class | SLOPE_CONFIG_BITS_T |
|
class | TAP_CONFIG2_BITS_T |
|
class | TAP_CONFIG_BITS_T |
|
class | TAP_ORIENT_BLOCK_T |
|
class | TAP_SAMP_T |
|
class | THRESHOLD_BITS_T |
|
BMA220 |
( |
int |
bus, |
|
|
short |
addr |
|
) |
| |
BMA220 constructor
- Parameters
-
bus | i2c bus to use |
address | the address for this device |
boolean enableAxes |
( |
boolean |
xEn, |
|
|
boolean |
yEn, |
|
|
boolean |
zEn |
|
) |
| |
enable or disable axis channels
- Parameters
-
xEn | true to enable the axis, false otherwise |
yEn | true to enable the axis, false otherwise |
zEn | true to enable the axis, false otherwise |
- Returns
- true if successful
boolean enableSlopeFilter |
( |
boolean |
filt | ) |
|
enable or disable slope filtering
- Parameters
-
filt | true to enable filtering, false otherwise |
- Returns
- true if successful
boolean enableTapFilter |
( |
boolean |
filt | ) |
|
unable to disable tap filtering
- Parameters
-
filt | true to enable, false otherwise |
- Returns
- true if successful
float [] getAccelerometer |
( |
| ) |
|
get the accelerometer values in gravities
- Returns
- Array containing X, Y, Z acceleration values
return the chip ID
- Returns
- the chip ID (usually 0xdd)
short getChipRevision |
( |
| ) |
|
return the chip revision
- Returns
- the chip revision (usually 0x00)
short getInterruptEnables1 |
( |
| ) |
|
return the enabled interrupts for events in interrupt config register 1
- Returns
- bitmask of ENABLE_CONFIG_BITS_T values
short getInterruptEnables2 |
( |
| ) |
|
return the enabled interrupts for events in interrupt config register 2
- Returns
- bitmask of ENABLE_CONFIG2_BITS_T values
short getInterruptStatus1 |
( |
| ) |
|
return a bitmask of the interrupt status 1 register
- Returns
- bitmask of INT_STATUS1_BITS_T bits (minus the orient value)
short getInterruptStatus2 |
( |
| ) |
|
return a bitmask of the interrupt status 2 register
- Returns
- bitmask of INT_STATUS2_BITS_T bits
BMA220.CONFIG_ORIENT_T getOrient |
( |
| ) |
|
return the orient value from the interrupt status 1 register
- Returns
- one of the CONFIG_ORIENT_T values
short readReg |
( |
short |
reg | ) |
|
read a register
- Parameters
-
dev | the device to access (XM or G) |
reg | the register to read |
- Returns
- the value of the register
boolean resetInterrupts |
( |
| ) |
|
reset the interrupt controller. This should be called after any changes are made to interrupt configuration, or to reset interrupts if latched interrupts have been enabled and an interrupt has occurred..
- Returns
- true if successful
boolean setAccelerometerScale |
( |
BMA220.FSL_RANGE_T |
scale | ) |
|
set the scaling mode of the accelerometer (2g/4g/8g/16g)
- Parameters
-
scale | one of the FSL_RANGE_T values |
- Returns
- true if successful, false otherwise
boolean setFilterConfig |
( |
BMA220.FILTER_CONFIG_T |
filter | ) |
|
set the filtering configuration
- Parameters
-
filter | one of the FILTER_CONFIG_T values |
- Returns
- true if successful
boolean setHighGDuration |
( |
short |
dur | ) |
|
specify the sample duration for high G detection
- Parameters
-
dur | the number of samples (depends on bandwidth) |
- Returns
- true if successful
boolean setHighGHysteresis |
( |
short |
hyst | ) |
|
specify the hysteresis for high G detection
- Parameters
-
hyst | 2 bit hysteresis value |
- Returns
- true if successful
boolean setHighGThreshold |
( |
short |
thresh | ) |
|
specify the threshold for high G detection
- Parameters
-
- Returns
- true if successful
boolean setInterruptEnables1 |
( |
short |
bits | ) |
|
enable interrupts for events in interrupt config register 1
- Parameters
-
bits | bitmask of ENABLE_CONFIG_BITS_T values |
- Returns
- true if successful
boolean setInterruptEnables2 |
( |
short |
bits | ) |
|
enable interrupts for events in interrupt config register 2
- Parameters
-
bits | bitmask of ENABLE_CONFIG2_BITS_T values |
- Returns
- true if successful
boolean setInterruptLatch |
( |
BMA220.CONFIG2_LAT_T |
lat | ) |
|
configure interrupt latching behavior
- Parameters
-
lat | one of the CONFIG2_LAT_T values |
- Returns
- true if successful
boolean setLowGDuration |
( |
short |
dur | ) |
|
specify the sample duration for low G detection
- Parameters
-
dur | the number of samples (depends on bandwidth) |
- Returns
- true if successful
boolean setLowGHysteresis |
( |
short |
hyst | ) |
|
specify the hysteresis for low G detection
- Parameters
-
hyst | 2 bit hysteresis value |
- Returns
- true if successful
boolean setLowGThreshold |
( |
short |
thresh | ) |
|
specify the threshold for low G detection
- Parameters
-
- Returns
- true if successful
boolean setSerialHighBW |
( |
boolean |
high | ) |
|
enable or disable high bandwidth serial access (1Khz). This essentially disables filtering and makes the raw unfiltered data available in the axis registers.
- Parameters
-
high | true to enable high bw access, false otherwise |
- Returns
- true if successful
boolean setSleepDuration |
( |
BMA220.SLEEP_DUR_T |
dur | ) |
|
when in low power (sleep) mode, specify how often the device wakes up to acquire samples.
- Parameters
-
dur | one of the SLEEP_DUR_T values |
- Returns
- true if successful
boolean setSlopeDuration |
( |
short |
dur | ) |
|
specify the sample duration for slope detection
- Parameters
-
dur | the number of samples (depends on bandwidth) |
- Returns
- true if successful
boolean setSlopeThreshold |
( |
short |
thresh | ) |
|
specify the threshold for slope detection
- Parameters
-
- Returns
- true if successful
boolean setTapDuration |
( |
short |
dur | ) |
|
specify the sample duration for tap detection
- Parameters
-
dur | the number of samples (depends on bandwidth) |
- Returns
- true if successful
boolean setTapThreshold |
( |
short |
thresh | ) |
|
specify the threshold for tap detection
- Parameters
-
- Returns
- true if successful
boolean sleep |
( |
boolean |
enable | ) |
|
place the device into, or take the device out of low power mode. See the datasheet for information on how low power mode is implemented on this device.
- Parameters
-
enable | true to set low power mode, false otherwise |
- Returns
- true if successful
place the device into, or take the device out of soft reset mode
- Returns
- 0x00 if the device was in active mode, 0xff if the device was in soft reset mode
place the device into, or take the device out of suspend mode
- Returns
- 0x00 if the device was in active mode, 0xff if the device was in suspend mode
uninstall a previously installed interrupt handler
update the accelerometer values
boolean writeReg |
( |
short |
reg, |
|
|
short |
val |
|
) |
| |
write to a register
- Parameters
-
dev | the device to access (XM or G) |
reg | the register to write to |
val | the value to write |
- Returns
- true if successful, false otherwise
The documentation for this class was generated from the following file:
- /var/lib/jenkins/workspace/upm-doc-stable/build-33/src/bma220/BMA220.java