ADXL345::ADXL345 | ( | ) |
Default constructor, uses default I2C address.
ADXL345::ADXL345 | ( | uint8_t | address | ) |
Specific address constructor.
address | I2C address |
void ADXL345::getAcceleration | ( | int16_t * | x, |
int16_t * | y, | ||
int16_t * | z | ||
) |
Get 3-axis accleration measurements. These six bytes (Register 0x32 to Register 0x37) are eight bits each and hold the output data for each axis. Register 0x32 and Register 0x33 hold the output data for the x-axis, Register 0x34 and Register 0x35 hold the output data for the y-axis, and Register 0x36 and Register 0x37 hold the output data for the z-axis. The output data is twos complement, with DATAx0 as the least significant byte and DATAx1 as the most significant byte, where x represent X, Y, or Z. The DATA_FORMAT register (Address 0x31) controls the format of the data. It is recommended that a multiple-byte read of all registers be performed to prevent a change in data between reads of sequential registers.
The DATA_FORMAT register controls the presentation of data to Register 0x32 through Register 0x37. All data, except that for the +/-16 g range, must be clipped to avoid rollover.
x | 16-bit signed integer container for X-axis acceleration |
y | 16-bit signed integer container for Y-axis acceleration |
z | 16-bit signed integer container for Z-axis acceleration |
int16_t ADXL345::getAccelerationX | ( | ) |
Get X-axis accleration measurement.
int16_t ADXL345::getAccelerationY | ( | ) |
Get Y-axis accleration measurement.
int16_t ADXL345::getAccelerationZ | ( | ) |
Get Z-axis accleration measurement.
bool ADXL345::getActivityAC | ( | ) |
Get activity AC/DC coupling. A setting of 0 selects dc-coupled operation, and a setting of 1 enables ac-coupled operation. In dc-coupled operation, the current acceleration magnitude is compared directly with THRESH_ACT and THRESH_INACT to determine whether activity or inactivity is detected.
In ac-coupled operation for activity detection, the acceleration value at the start of activity detection is taken as a reference value. New samples of acceleration are then compared to this reference value, and if the magnitude of the difference exceeds the THRESH_ACT value, the device triggers an activity interrupt.
Similarly, in ac-coupled operation for inactivity detection, a reference value is used for comparison and is updated whenever the device exceeds the inactivity threshold. After the reference value is selected, the device compares the magnitude of the difference between the reference value and the current acceleration with THRESH_INACT. If the difference is less than the value in THRESH_INACT for the time in TIME_INACT, the device is considered inactive and the inactivity interrupt is triggered.
bool ADXL345::getActivitySourceX | ( | ) |
Get X axis activity source flag. These bits indicate the first axis involved in a tap or activity event. A setting of 1 corresponds to involvement in the event, and a setting of 0 corresponds to no involvement. When new data is available, these bits are not cleared but are overwritten by the new data. The ACT_TAP_STATUS register should be read before clearing the interrupt. Disabling an axis from participation clears the corresponding source bit when the next activity or single tap/double tap event occurs.
bool ADXL345::getActivitySourceY | ( | ) |
Get Y axis activity source flag.
bool ADXL345::getActivitySourceZ | ( | ) |
Get Z axis activity source flag.
uint8_t ADXL345::getActivityThreshold | ( | ) |
Get activity threshold. The THRESH_ACT register is eight bits and holds the threshold value for detecting activity. The data format is unsigned, so the magnitude of the activity event is compared with the value in the THRESH_ACT register. The scale factor is 62.5 mg/LSB. A value of 0 may result in undesirable behavior if the activity interrupt is enabled.
bool ADXL345::getActivityXEnabled | ( | ) |
Get X axis activity monitoring inclusion. For all "get[In]Activity*Enabled()" methods: a setting of 1 enables x-, y-, or z-axis participation in detecting activity or inactivity. A setting of 0 excludes the selected axis from participation. If all axes are excluded, the function is disabled. For activity detection, all participating axes are logically OR�ed, causing the activity function to trigger when any of the participating axes exceeds the threshold. For inactivity detection, all participating axes are logically AND�ed, causing the inactivity function to trigger only if all participating axes are below the threshold for the specified time.
bool ADXL345::getActivityYEnabled | ( | ) |
Get Y axis activity monitoring.
bool ADXL345::getActivityZEnabled | ( | ) |
Get Z axis activity monitoring.
bool ADXL345::getAsleep | ( | ) |
Get sleep mode flag. A setting of 1 in the asleep bit indicates that the part is asleep, and a setting of 0 indicates that the part is not asleep. This bit toggles only if the device is configured for auto sleep. See the AUTO_SLEEP Bit section of the datasheet for more information on autosleep mode.
bool ADXL345::getAutoSleepEnabled | ( | ) |
Get auto-sleep enabled status. If the link bit is set, a setting of 1 in the AUTO_SLEEP bit enables the auto-sleep functionality. In this mode, the ADXL345 auto-matically switches to sleep mode if the inactivity function is enabled and inactivity is detected (that is, when acceleration is below the THRESH_INACT value for at least the time indicated by TIME_INACT). If activity is also enabled, the ADXL345 automatically wakes up from sleep after detecting activity and returns to operation at the output data rate set in the BW_RATE register. A setting of 0 in the AUTO_SLEEP bit disables automatic switching to sleep mode. See the description of the Sleep Bit in this section of the datasheet for more information on sleep mode.
If the link bit is not set, the AUTO_SLEEP feature is disabled and setting the AUTO_SLEEP bit does not have an impact on device operation. Refer to the Link Bit section or the Link Mode section for more information on utilization of the link feature.
When clearing the AUTO_SLEEP bit, it is recommended that the part be placed into standby mode and then set back to measure-ment mode with a subsequent write. This is done to ensure that the device is properly biased if sleep mode is manually disabled; otherwise, the first few samples of data after the AUTO_SLEEP bit is cleared may have additional noise, especially if the device was asleep when the bit was cleared.
uint8_t ADXL345::getDataJustification | ( | ) |
Get data justification mode setting. A setting of 1 in the justify bit selects left-justified (MSB) mode, and a setting of 0 selects right-justified mode with sign extension.
uint8_t ADXL345::getDeviceID | ( | ) |
Get Device ID. The DEVID register holds a fixed device ID code of 0xE5 (345 octal).
uint8_t ADXL345::getDoubleTapLatency | ( | ) |
Get tap duration. The latent register is eight bits and contains an unsigned time value representing the wait time from the detection of a tap event to the start of the time window (defined by the window register) during which a possible second tap event can be detected. The scale factor is 1.25 ms/LSB. A value of 0 disables the double tap function.
uint8_t ADXL345::getDoubleTapWindow | ( | ) |
Get double tap window. The window register is eight bits and contains an unsigned time value representing the amount of time after the expiration of the latency time (determined by the latent register) during which a second valid tap can begin. The scale factor is 1.25 ms/LSB. A value of 0 disables the double tap function.
uint8_t ADXL345::getFIFOLength | ( | ) |
Get FIFO length. These bits report how many data values are stored in FIFO. Access to collect the data from FIFO is provided through the DATAX, DATAY, and DATAZ registers. FIFO reads must be done in burst or multiple-byte mode because each FIFO level is cleared after any read (single- or multiple-byte) of FIFO. FIFO stores a maximum of 32 entries, which equates to a maximum of 33 entries available at any given time because an additional entry is available at the output filter of the I2Cdev::
uint8_t ADXL345::getFIFOMode | ( | ) |
Get FIFO mode. These bits set the FIFO mode, as described in Table 22. That is:
0x0 = Bypass (FIFO is bypassed.)
0x1 = FIFO (FIFO collects up to 32 values and then stops collecting data, collecting new data only when FIFO is not full.)
0x2 = Stream (FIFO holds the last 32 data values. When FIFO is full, the oldest data is overwritten with newer data.)
0x3 = Trigger (When triggered by the trigger bit, FIFO holds the last data samples before the trigger event and then continues to collect data until full. New data is collected only when FIFO is not full.)
uint8_t ADXL345::getFIFOSamples | ( | ) |
Get FIFO samples setting. The function of these bits depends on the FIFO mode selected (see Table 23). Entering a value of 0 in the samples bits immediately sets the watermark status bit in the INT_SOURCE register, regardless of which FIFO mode is selected. Undesirable operation may occur if a value of 0 is used for the samples bits when trigger mode is used.
MODE | EFFECT --------+------------------------------------------------------------------- Bypass | None. FIFO | FIFO entries needed to trigger a watermark interrupt. Stream | FIFO entries needed to trigger a watermark interrupt. Trigger | Samples are retained in the FIFO buffer before a trigger event.
uint8_t ADXL345::getFIFOTriggerInterruptPin | ( | ) |
Get FIFO trigger interrupt setting. A value of 0 in the trigger bit links the trigger event of trigger mode to INT1, and a value of 1 links the trigger event to INT2.
bool ADXL345::getFIFOTriggerOccurred | ( | ) |
Get FIFO trigger occurred status. A 1 in the FIFO_TRIG bit corresponds to a trigger event occurring, and a 0 means that a FIFO trigger event has not occurred.
uint8_t ADXL345::getFreefallThreshold | ( | ) |
Get freefall threshold value. The THRESH_FF register is eight bits and holds the threshold value, in unsigned format, for free-fall detection. The acceleration on all axes is compared with the value in THRESH_FF to determine if a free-fall event occurred. The scale factor is 62.5 mg/LSB. Note that a value of 0 mg may result in undesirable behavior if the free-fall interrupt is enabled. Values between 300 mg and 600 mg (0x05 to 0x09) are recommended.
uint8_t ADXL345::getFreefallTime | ( | ) |
Get freefall time value. The TIME_FF register is eight bits and stores an unsigned time value representing the minimum time that the value of all axes must be less than THRESH_FF to generate a free-fall interrupt. The scale factor is 5 ms/LSB. A value of 0 may result in undesirable behavior if the free-fall interrupt is enabled. Values between 100 ms and 350 ms (0x14 to 0x46) are recommended.
uint8_t ADXL345::getFullResolution | ( | ) |
Get full resolution mode setting. When this bit is set to a value of 1, the device is in full resolution mode, where the output resolution increases with the g range set by the range bits to maintain a 4 mg/LSB scale factor. When the FULL_RES bit is set to 0, the device is in 10-bit mode, and the range bits determine the maximum g range and scale factor.
bool ADXL345::getInactivityAC | ( | ) |
Get inactivity AC/DC coupling.
uint8_t ADXL345::getInactivityThreshold | ( | ) |
Get inactivity threshold. The THRESH_INACT register is eight bits and holds the threshold value for detecting inactivity. The data format is unsigned, so the magnitude of the inactivity event is compared with the value in the THRESH_INACT register. The scale factor is 62.5 mg/LSB. A value of 0 may result in undesirable behavior if the inactivity interrupt is enabled.
uint8_t ADXL345::getInactivityTime | ( | ) |
Set inactivity time. The TIME_INACT register is eight bits and contains an unsigned time value representing the amount of time that acceleration must be less than the value in the THRESH_INACT register for inactivity to be declared. The scale factor is 1 sec/LSB. Unlike the other interrupt functions, which use unfiltered data (see the Threshold sectionof the datasheet), the inactivity function uses filtered output data. At least one output sample must be generated for the inactivity interrupt to be triggered. This results in the function appearing unresponsive if the TIME_INACT register is set to a value less than the time constant of the output data rate. A value of 0 results in an interrupt when the output data is less than the value in the THRESH_INACT register.
bool ADXL345::getInactivityXEnabled | ( | ) |
Get X axis inactivity monitoring.
bool ADXL345::getInactivityYEnabled | ( | ) |
Get Y axis inactivity monitoring.
bool ADXL345::getInactivityZEnabled | ( | ) |
Get Z axis inactivity monitoring.
bool ADXL345::getIntActivityEnabled | ( | ) |
Set ACTIVITY interrupt enabled status.
uint8_t ADXL345::getIntActivityPin | ( | ) |
Get ACTIVITY interrupt pin.
uint8_t ADXL345::getIntActivitySource | ( | ) |
Get ACTIVITY interrupt source flag.
bool ADXL345::getIntDataReadyEnabled | ( | ) |
Get DATA_READY interrupt enabled status. Setting bits in this register to a value of 1 enables their respective functions to generate interrupts, whereas a value of 0 prevents the functions from generating interrupts. The DATA_READY, watermark, and overrun bits enable only the interrupt output; the functions are always enabled. It is recommended that interrupts be configured before enabling their outputs.
uint8_t ADXL345::getIntDataReadyPin | ( | ) |
Get DATA_READY interrupt pin. Any bits set to 0 in this register send their respective interrupts to the INT1 pin, whereas bits set to 1 send their respective interrupts to the INT2 pin. All selected interrupts for a given pin are OR'ed.
uint8_t ADXL345::getIntDataReadySource | ( | ) |
Get DATA_READY interrupt source flag. Bits set to 1 in this register indicate that their respective functions have triggered an event, whereas a value of 0 indicates that the corresponding event has not occurred. The DATA_READY, watermark, and overrun bits are always set if the corresponding events occur, regardless of the INT_ENABLE register settings, and are cleared by reading data from the DATAX, DATAY, and DATAZ registers. The DATA_READY and watermark bits may require multiple reads, as indicated in the FIFO mode descriptions in the FIFO section. Other bits, and the corresponding interrupts, are cleared by reading the INT_SOURCE register.
bool ADXL345::getIntDoubleTapEnabled | ( | ) |
Get DOUBLE_TAP interrupt enabled status.
uint8_t ADXL345::getIntDoubleTapPin | ( | ) |
Get DOUBLE_TAP interrupt pin.
uint8_t ADXL345::getIntDoubleTapSource | ( | ) |
Get DOUBLE_TAP interrupt source flag.
uint8_t ADXL345::getInterruptMode | ( | ) |
Get interrupt mode setting. A value of 0 in the INT_INVERT bit sets the interrupts to active high, and a value of 1 sets the interrupts to active low.
bool ADXL345::getIntFreefallEnabled | ( | ) |
Get FREE_FALL interrupt enabled status.
uint8_t ADXL345::getIntFreefallPin | ( | ) |
Get FREE_FALL interrupt pin.
uint8_t ADXL345::getIntFreefallSource | ( | ) |
Get FREE_FALL interrupt source flag.
bool ADXL345::getIntInactivityEnabled | ( | ) |
Get INACTIVITY interrupt enabled status.
uint8_t ADXL345::getIntInactivityPin | ( | ) |
Get INACTIVITY interrupt pin.
uint8_t ADXL345::getIntInactivitySource | ( | ) |
Get INACTIVITY interrupt source flag.
bool ADXL345::getIntOverrunEnabled | ( | ) |
Get OVERRUN interrupt enabled status.
uint8_t ADXL345::getIntOverrunPin | ( | ) |
Get OVERRUN interrupt pin.
uint8_t ADXL345::getIntOverrunSource | ( | ) |
Get OVERRUN interrupt source flag.
bool ADXL345::getIntSingleTapEnabled | ( | ) |
Set SINGLE_TAP interrupt enabled status.
enabled | New interrupt enabled status |
uint8_t ADXL345::getIntSingleTapPin | ( | ) |
Get SINGLE_TAP interrupt pin.
uint8_t ADXL345::getIntSingleTapSource | ( | ) |
Get SINGLE_TAP interrupt source flag.
bool ADXL345::getIntWatermarkEnabled | ( | ) |
Get WATERMARK interrupt enabled status.
uint8_t ADXL345::getIntWatermarkPin | ( | ) |
Get WATERMARK interrupt pin.
uint8_t ADXL345::getIntWatermarkSource | ( | ) |
Get WATERMARK interrupt source flag.
bool ADXL345::getLinkEnabled | ( | ) |
Get activity/inactivity serial linkage status. A setting of 1 in the link bit with both the activity and inactivity functions enabled delays the start of the activity function until inactivity is detected. After activity is detected, inactivity detection begins, preventing the detection of activity. This bit serially links the activity and inactivity functions. When this bit is set to 0, the inactivity and activity functions are concurrent. Additional information can be found in the Link Mode section of the datasheet.
When clearing the link bit, it is recommended that the part be placed into standby mode and then set back to measurement mode with a subsequent write. This is done to ensure that the device is properly biased if sleep mode is manually disabled; otherwise, the first few samples of data after the link bit is cleared may have additional noise, especially if the device was asleep when the bit was cleared.
bool ADXL345::getLowPowerEnabled | ( | ) |
Get low power enabled status. A setting of 0 in the LOW_POWER bit selects normal operation, and a setting of 1 selects reduced power operation, which has somewhat higher noise (see the Power Modes section of the datasheet for details).
bool ADXL345::getMeasureEnabled | ( | ) |
Get measurement enabled status. A setting of 0 in the measure bit places the part into standby mode, and a setting of 1 places the part into measurement mode. The ADXL345 powers up in standby mode with minimum power consumption.
void ADXL345::getOffset | ( | int8_t * | x, |
int8_t * | y, | ||
int8_t * | z | ||
) |
Get axis offsets. The OFSX, OFSY, and OFSZ registers are each eight bits and offer user-set offset adjustments in twos complement format with a scale factor of 15.6 mg/LSB (that is, 0x7F = 2 g). The value stored in the offset registers is automatically added to the acceleration data, and the resulting value is stored in the output data registers. For additional information regarding offset calibration and the use of the offset registers, refer to the Offset Calibration section of the datasheet.
x | X axis offset container |
y | Y axis offset container |
z | Z axis offset container |
int8_t ADXL345::getOffsetX | ( | ) |
int8_t ADXL345::getOffsetY | ( | ) |
int8_t ADXL345::getOffsetZ | ( | ) |
uint8_t ADXL345::getRange | ( | ) |
Get data range setting. These bits set the g range as described in Table 21. (That is, 0x0 - 0x3 to indicate 2g/4g/8g/16g respectively)
uint8_t ADXL345::getRate | ( | ) |
Get measurement data rate. These bits select the device bandwidth and output data rate (see Table 7 and Table 8 in the datasheet for details). The default value is 0x0A, which translates to a 100 Hz output data rate. An output data rate should be selected that is appropriate for the communication protocol and frequency selected. Selecting too high of an output data rate with a low communication speed results in samples being discarded.
uint8_t ADXL345::getSelfTestEnabled | ( | ) |
Get self-test force enabled. A setting of 1 in the SELF_TEST bit applies a self-test force to the sensor, causing a shift in the output data. A value of 0 disables the self-test force.
bool ADXL345::getSleepEnabled | ( | ) |
Get sleep mode enabled status. A setting of 0 in the sleep bit puts the part into the normal mode of operation, and a setting of 1 places the part into sleep mode. Sleep mode suppresses DATA_READY, stops transmission of data to FIFO, and switches the sampling rate to one specified by the wakeup bits. In sleep mode, only the activity function can be used. When the DATA_READY interrupt is suppressed, the output data registers (Register 0x32 to Register 0x37) are still updated at the sampling rate set by the wakeup bits (D1:D0).
When clearing the sleep bit, it is recommended that the part be placed into standby mode and then set back to measurement mode with a subsequent write. This is done to ensure that the device is properly biased if sleep mode is manually disabled; otherwise, the first few samples of data after the sleep bit is cleared may have additional noise, especially if the device was asleep when the bit was cleared.
uint8_t ADXL345::getSPIMode | ( | ) |
Get SPI mode setting. A value of 1 in the SPI bit sets the device to 3-wire SPI mode, and a value of 0 sets the device to 4-wire SPI mode.
bool ADXL345::getTapAxisSuppress | ( | ) |
Get double-tap fast-movement suppression. Setting the suppress bit suppresses double tap detection if acceleration greater than the value in THRESH_TAP is present between taps. See the Tap Detection section in the datasheet for more details.
bool ADXL345::getTapAxisXEnabled | ( | ) |
Get double-tap fast-movement suppression. A setting of 1 in the TAP_X enable bit enables x-axis participation in tap detection. A setting of 0 excludes the selected axis from participation in tap detection.
bool ADXL345::getTapAxisYEnabled | ( | ) |
Get tap detection Y axis inclusion. A setting of 1 in the TAP_Y enable bit enables y-axis participation in tap detection. A setting of 0 excludes the selected axis from participation in tap detection.
bool ADXL345::getTapAxisZEnabled | ( | ) |
Get tap detection Z axis inclusion. A setting of 1 in the TAP_Z enable bit enables z-axis participation in tap detection. A setting of 0 excludes the selected axis from participation in tap detection.
uint8_t ADXL345::getTapDuration | ( | ) |
Get tap duration. The DUR register is eight bits and contains an unsigned time value representing the maximum time that an event must be above the THRESH_TAP threshold to qualify as a tap event. The scale factor is 625 us/LSB. A value of 0 disables the single tap/ double tap functions.
bool ADXL345::getTapSourceX | ( | ) |
Get X axis tap source flag.
bool ADXL345::getTapSourceY | ( | ) |
Get Y axis tap source flag.
bool ADXL345::getTapSourceZ | ( | ) |
Get Z axis tap source flag.
uint8_t ADXL345::getTapThreshold | ( | ) |
Get tap threshold. The THRESH_TAP register is eight bits and holds the threshold value for tap interrupts. The data format is unsigned, therefore, the magnitude of the tap event is compared with the value in THRESH_TAP for normal tap detection. The scale factor is 62.5 mg/LSB (that is, 0xFF = 16 g). A value of 0 may result in undesirable behavior if single tap/double tap interrupts are enabled.
uint8_t ADXL345::getWakeupFrequency | ( | ) |
Get wakeup frequency. These bits control the frequency of readings in sleep mode as described in Table 20 in the datasheet. (That is, 0 = 8Hz, 1 = 4Hz, 2 = 2Hz, 3 = 1Hz)
void ADXL345::initialize | ( | ) |
Power on and prepare for general usage. This will activate the accelerometer, so be sure to adjust the power settings after you call this method if you want it to enter standby mode, or another less demanding mode of operation.
void ADXL345::setActivityAC | ( | bool | enabled | ) |
Set activity AC/DC coupling.
enabled | Activity AC/DC coupling (TRUE for AC, FALSE for DC) |
void ADXL345::setActivityThreshold | ( | uint8_t | threshold | ) |
Set activity threshold.
threshold | Activity threshold (scaled at 62.5 mg/LSB) |
void ADXL345::setActivityXEnabled | ( | bool | enabled | ) |
Set X axis activity monitoring inclusion.
enabled | X axis activity monitoring inclusion value |
void ADXL345::setActivityYEnabled | ( | bool | enabled | ) |
Set Y axis activity monitoring inclusion.
enabled | Y axis activity monitoring inclusion value |
void ADXL345::setActivityZEnabled | ( | bool | enabled | ) |
Set Z axis activity monitoring inclusion.
enabled | Z axis activity monitoring inclusion value |
void ADXL345::setAutoSleepEnabled | ( | bool | enabled | ) |
Set auto-sleep enabled status.
enabled | New auto-sleep status |
void ADXL345::setDataJustification | ( | uint8_t | justification | ) |
Set data justification mode setting.
justification | New data justification mode |
void ADXL345::setDoubleTapLatency | ( | uint8_t | latency | ) |
Set tap duration.
latency | Tap latency (scaled at 1.25 ms/LSB) |
void ADXL345::setDoubleTapWindow | ( | uint8_t | window | ) |
Set double tap window.
window | Double tap window (scaled at 1.25 ms/LSB) |
void ADXL345::setFIFOMode | ( | uint8_t | mode | ) |
Set FIFO mode.
mode | New FIFO mode |
void ADXL345::setFIFOSamples | ( | uint8_t | size | ) |
Set FIFO samples setting.
size | New FIFO samples setting (impact depends on FIFO mode setting) |
void ADXL345::setFIFOTriggerInterruptPin | ( | uint8_t | interrupt | ) |
Set FIFO trigger interrupt pin setting.
interrupt | New FIFO trigger interrupt pin setting |
void ADXL345::setFreefallThreshold | ( | uint8_t | threshold | ) |
Set freefall threshold value.
threshold | Freefall threshold value (scaled at 62.5 mg/LSB) |
void ADXL345::setFreefallTime | ( | uint8_t | time | ) |
Set freefall time value.
threshold | Freefall time value (scaled at 5 ms/LSB) |
void ADXL345::setFullResolution | ( | uint8_t | resolution | ) |
Set full resolution mode setting.
resolution | New full resolution enabled setting |
void ADXL345::setInactivityAC | ( | bool | enabled | ) |
Set inctivity AC/DC coupling.
enabled | Inactivity AC/DC coupling (TRUE for AC, FALSE for DC) |
void ADXL345::setInactivityThreshold | ( | uint8_t | threshold | ) |
Set inactivity threshold.
threshold | Inctivity threshold (scaled at 62.5 mg/LSB) |
void ADXL345::setInactivityTime | ( | uint8_t | time | ) |
Set inactivity time.
time | Inactivity time (scaled at 1 sec/LSB) |
void ADXL345::setInactivityXEnabled | ( | bool | enabled | ) |
Set X axis activity monitoring inclusion.
enabled | X axis inactivity monitoring inclusion value |
void ADXL345::setInactivityYEnabled | ( | bool | enabled | ) |
Set Y axis inactivity monitoring inclusion.
enabled | Y axis inactivity monitoring inclusion value |
void ADXL345::setInactivityZEnabled | ( | bool | enabled | ) |
Set Z axis inactivity monitoring inclusion.
enabled | Z axis activity monitoring inclusion value |
void ADXL345::setIntActivityEnabled | ( | bool | enabled | ) |
Set ACTIVITY interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntActivityPin | ( | uint8_t | pin | ) |
Set ACTIVITY interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setIntDataReadyEnabled | ( | bool | enabled | ) |
Set DATA_READY interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntDataReadyPin | ( | uint8_t | pin | ) |
Set DATA_READY interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setIntDoubleTapEnabled | ( | bool | enabled | ) |
Set DOUBLE_TAP interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntDoubleTapPin | ( | uint8_t | pin | ) |
Set DOUBLE_TAP interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setInterruptMode | ( | uint8_t | mode | ) |
Set interrupt mode setting.
mode | New interrupt mode setting |
void ADXL345::setIntFreefallEnabled | ( | bool | enabled | ) |
Set FREE_FALL interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntFreefallPin | ( | uint8_t | pin | ) |
Set FREE_FALL interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setIntInactivityEnabled | ( | bool | enabled | ) |
Set INACTIVITY interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntInactivityPin | ( | uint8_t | pin | ) |
Set INACTIVITY interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setIntOverrunEnabled | ( | bool | enabled | ) |
Set OVERRUN interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntOverrunPin | ( | uint8_t | pin | ) |
Set OVERRUN interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setIntSingleTapEnabled | ( | bool | enabled | ) |
Set SINGLE_TAP interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntSingleTapPin | ( | uint8_t | pin | ) |
Set SINGLE_TAP interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setIntWatermarkEnabled | ( | bool | enabled | ) |
Set WATERMARK interrupt enabled status.
enabled | New interrupt enabled status |
void ADXL345::setIntWatermarkPin | ( | uint8_t | pin | ) |
Set WATERMARK interrupt pin.
pin | Interrupt pin setting |
void ADXL345::setLinkEnabled | ( | bool | enabled | ) |
Set activity/inactivity serial linkage status.
enabled | New link status |
void ADXL345::setLowPowerEnabled | ( | bool | enabled | ) |
Set low power enabled status.
enabled | Low power enable setting |
void ADXL345::setMeasureEnabled | ( | bool | enabled | ) |
Set measurement enabled status.
enabled | Measurement enabled status |
void ADXL345::setOffset | ( | int8_t | x, |
int8_t | y, | ||
int8_t | z | ||
) |
Set axis offsets.
x | X axis offset value |
y | Y axis offset value |
z | Z axis offset value |
void ADXL345::setOffsetX | ( | int8_t | x | ) |
void ADXL345::setOffsetY | ( | int8_t | y | ) |
void ADXL345::setOffsetZ | ( | int8_t | z | ) |
void ADXL345::setRange | ( | uint8_t | range | ) |
Set data range setting.
range | Range value (0x0 - 0x3 for 2g/4g/8g/16g) |
void ADXL345::setRate | ( | uint8_t | rate | ) |
Set measurement data rate. 0x7 = 12.5Hz 0x8 = 25Hz, increasing or decreasing by factors of 2, so: 0x9 = 50Hz 0xA = 100Hz
rate | New data rate (0x0 - 0xF) |
void ADXL345::setSelfTestEnabled | ( | uint8_t | enabled | ) |
Set self-test force enabled.
enabled | New self-test force enabled setting |
void ADXL345::setSleepEnabled | ( | bool | enabled | ) |
Set sleep mode enabled status.
Sleep | mode enabled status |
void ADXL345::setSPIMode | ( | uint8_t | mode | ) |
Set SPI mode setting.
mode | New SPI mode setting |
void ADXL345::setTapAxisSuppress | ( | bool | enabled | ) |
Set double-tap fast-movement suppression.
enabled | Double-tap fast-movement suppression value |
void ADXL345::setTapAxisXEnabled | ( | bool | enabled | ) |
Set tap detection X axis inclusion.
enabled | X axis tap detection enabled value |
void ADXL345::setTapAxisYEnabled | ( | bool | enabled | ) |
Set tap detection Y axis inclusion.
enabled | Y axis tap detection enabled value |
void ADXL345::setTapAxisZEnabled | ( | bool | enabled | ) |
Set tap detection Z axis inclusion.
enabled | Z axis tap detection enabled value |
void ADXL345::setTapDuration | ( | uint8_t | duration | ) |
Set tap duration.
duration | Tap duration (scaled at 625 us/LSB) |
void ADXL345::setTapThreshold | ( | uint8_t | threshold | ) |
Set tap threshold.
threshold | Tap magnitude threshold (scaled at 62.5 mg/LSB) |
void ADXL345::setWakeupFrequency | ( | uint8_t | frequency | ) |
Set wakeup frequency.
frequency | Wakeup frequency (0x0 - 0x3, indicating 8/4/2/1Hz respectively) |
bool ADXL345::testConnection | ( | ) |
Verify the I2C connection. Make sure the device is connected and responds as expected.