|
upm
0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
|
API for the MMA7660 I2C 3-Axis Digital Accelerometer. More...
UPM module for the MMA7660 I2C 3-axis digital accelerometer. This device supports a variety of capabilities, including the generation of interrupts for various conditions, tilt and basic gesture detection, and X/Y/Z-axis measurements of g-forces being applied (up to 1.5g)
This module was tested with the Grove 3-Axis Digital Accelerometer (1.5g)
Classes | |
| class | MMA7660_AUTOSLEEP_T |
| class | MMA7660_INTR_T |
| class | MMA7660_MODE_T |
| class | MMA7660_REG_T |
| class | MMA7660_TILT_BF_T |
| class | MMA7660_TILT_LP_T |
Public Member Functions | |
| synchronized void | delete () |
| MMA7660 (int bus, short address) | |
| MMA7660 (int bus) | |
| boolean | writeByte (short reg, short arg1) |
| short | readByte (short reg) |
| int[] | getRawValues () |
| float[] | getAcceleration () |
| int | getVerifiedAxis (MMA7660.MMA7660_REG_T axis) |
| short | getVerifiedTilt () |
| void | setModeActive () |
| void | setModeStandby () |
| short | tiltBackFront () |
| short | tiltLandscapePortrait () |
| boolean | tiltTap () |
| boolean | tiltShake () |
| void | installISR (int pin, IsrCallback cb) |
| void | uninstallISR () |
| boolean | setInterruptBits (short ibits) |
| boolean | setSampleRate (MMA7660.MMA7660_AUTOSLEEP_T sr) |
| MMA7660 | ( | int | bus, |
| short | address | ||
| ) |
MMA7660 constructor
| bus | I2C bus to use |
| address | Address for this sensor; default is 0x55 |
| float [] getAcceleration | ( | ) |
Gets the computed acceleration
| int [] getRawValues | ( | ) |
Reads the current value of conversion
| int getVerifiedAxis | ( | MMA7660.MMA7660_REG_T | axis | ) |
Reads an axis, verifying its validity. The value passed must be one of REG_XOUT, REG_YOUT, or REG_ZOUT.
| axis | Axis to read |
| short getVerifiedTilt | ( | ) |
Reads the tilt register, verifying its validity
| void installISR | ( | int | pin, |
| IsrCallback | cb | ||
| ) |
Installs an interrupt service routine (ISR) to be called when an interrupt occurs
| pin | GPIO pin to use as the interrupt pin |
| fptr | Pointer to a function to be called on interrupt |
| arg | Pointer to an object to be supplied as an argument to the ISR. |
| short readByte | ( | short | reg | ) |
Reads a byte value from a register
| reg | Register location to read from |
| boolean setInterruptBits | ( | short | ibits | ) |
Enables interrupt generation based on passed interrupt bits. The bits are a bitmask of the requested MMA7660_INTR_T values. Note: the device must be in the standby mode to set this register.
| ibits | Sets the requested interrupt bits |
| void setModeActive | ( | ) |
Puts the device in the active mode. In this mode, register writes are not allowed. Place the device in the standby mode before attempting to write registers.
| void setModeStandby | ( | ) |
Puts the device in the standby (power saving) mode. Note: when in the standby mode, there is no valid data in the registers. In addition, the only way to write a register is to put the device in the standby mode.
| boolean setSampleRate | ( | MMA7660.MMA7660_AUTOSLEEP_T | sr | ) |
Sets the sampling rate of the sensor. The value supplied must be one of the MMA7660_AUTOSLEEP_T values.
| sr | One of the MMA7660_AUTOSLEEP_T values |
| short tiltBackFront | ( | ) |
Reads tiltBackFront bits
The value returned is one of the MMA7660_TILT_BF_T values
| short tiltLandscapePortrait | ( | ) |
Reads tiltLandscapePortrait bits
The value returned is one of the MMA7660_TILT_LP_T values
| boolean tiltShake | ( | ) |
Reads the tiltShake status
| boolean tiltTap | ( | ) |
Reads the tiltTap status
| void uninstallISR | ( | ) |
Uninstalls the previously installed ISR
| boolean writeByte | ( | short | reg, |
| short | arg1 | ||
| ) |
Writes a byte value into a register
| reg | Register location to write into |
| byte | Byte to write |
1.8.9.1