I2Cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs

Public Member Functions
ADXL345 Class Reference

Public Member Functions

 ADXL345 ()
 ADXL345 (uint8_t address)
void initialize ()
bool testConnection ()
uint8_t getDeviceID ()
uint8_t getTapThreshold ()
void setTapThreshold (uint8_t threshold)
void getOffset (int8_t *x, int8_t *y, int8_t *z)
void setOffset (int8_t x, int8_t y, int8_t z)
int8_t getOffsetX ()
void setOffsetX (int8_t x)
int8_t getOffsetY ()
void setOffsetY (int8_t y)
int8_t getOffsetZ ()
void setOffsetZ (int8_t z)
uint8_t getTapDuration ()
void setTapDuration (uint8_t duration)
uint8_t getDoubleTapLatency ()
void setDoubleTapLatency (uint8_t latency)
uint8_t getDoubleTapWindow ()
void setDoubleTapWindow (uint8_t window)
uint8_t getActivityThreshold ()
void setActivityThreshold (uint8_t threshold)
uint8_t getInactivityThreshold ()
void setInactivityThreshold (uint8_t threshold)
uint8_t getInactivityTime ()
void setInactivityTime (uint8_t time)
bool getActivityAC ()
void setActivityAC (bool enabled)
bool getActivityXEnabled ()
void setActivityXEnabled (bool enabled)
bool getActivityYEnabled ()
void setActivityYEnabled (bool enabled)
bool getActivityZEnabled ()
void setActivityZEnabled (bool enabled)
bool getInactivityAC ()
void setInactivityAC (bool enabled)
bool getInactivityXEnabled ()
void setInactivityXEnabled (bool enabled)
bool getInactivityYEnabled ()
void setInactivityYEnabled (bool enabled)
bool getInactivityZEnabled ()
void setInactivityZEnabled (bool enabled)
uint8_t getFreefallThreshold ()
void setFreefallThreshold (uint8_t threshold)
uint8_t getFreefallTime ()
void setFreefallTime (uint8_t time)
bool getTapAxisSuppress ()
void setTapAxisSuppress (bool enabled)
bool getTapAxisXEnabled ()
void setTapAxisXEnabled (bool enabled)
bool getTapAxisYEnabled ()
void setTapAxisYEnabled (bool enabled)
bool getTapAxisZEnabled ()
void setTapAxisZEnabled (bool enabled)
bool getActivitySourceX ()
bool getActivitySourceY ()
bool getActivitySourceZ ()
bool getAsleep ()
bool getTapSourceX ()
bool getTapSourceY ()
bool getTapSourceZ ()
bool getLowPowerEnabled ()
void setLowPowerEnabled (bool enabled)
uint8_t getRate ()
void setRate (uint8_t rate)
bool getLinkEnabled ()
void setLinkEnabled (bool enabled)
bool getAutoSleepEnabled ()
void setAutoSleepEnabled (bool enabled)
bool getMeasureEnabled ()
void setMeasureEnabled (bool enabled)
bool getSleepEnabled ()
void setSleepEnabled (bool enabled)
uint8_t getWakeupFrequency ()
void setWakeupFrequency (uint8_t frequency)
bool getIntDataReadyEnabled ()
void setIntDataReadyEnabled (bool enabled)
bool getIntSingleTapEnabled ()
void setIntSingleTapEnabled (bool enabled)
bool getIntDoubleTapEnabled ()
void setIntDoubleTapEnabled (bool enabled)
bool getIntActivityEnabled ()
void setIntActivityEnabled (bool enabled)
bool getIntInactivityEnabled ()
void setIntInactivityEnabled (bool enabled)
bool getIntFreefallEnabled ()
void setIntFreefallEnabled (bool enabled)
bool getIntWatermarkEnabled ()
void setIntWatermarkEnabled (bool enabled)
bool getIntOverrunEnabled ()
void setIntOverrunEnabled (bool enabled)
uint8_t getIntDataReadyPin ()
void setIntDataReadyPin (uint8_t pin)
uint8_t getIntSingleTapPin ()
void setIntSingleTapPin (uint8_t pin)
uint8_t getIntDoubleTapPin ()
void setIntDoubleTapPin (uint8_t pin)
uint8_t getIntActivityPin ()
void setIntActivityPin (uint8_t pin)
uint8_t getIntInactivityPin ()
void setIntInactivityPin (uint8_t pin)
uint8_t getIntFreefallPin ()
void setIntFreefallPin (uint8_t pin)
uint8_t getIntWatermarkPin ()
void setIntWatermarkPin (uint8_t pin)
uint8_t getIntOverrunPin ()
void setIntOverrunPin (uint8_t pin)
uint8_t getIntDataReadySource ()
uint8_t getIntSingleTapSource ()
uint8_t getIntDoubleTapSource ()
uint8_t getIntActivitySource ()
uint8_t getIntInactivitySource ()
uint8_t getIntFreefallSource ()
uint8_t getIntWatermarkSource ()
uint8_t getIntOverrunSource ()
uint8_t getSelfTestEnabled ()
void setSelfTestEnabled (uint8_t enabled)
uint8_t getSPIMode ()
void setSPIMode (uint8_t mode)
uint8_t getInterruptMode ()
void setInterruptMode (uint8_t mode)
uint8_t getFullResolution ()
void setFullResolution (uint8_t resolution)
uint8_t getDataJustification ()
void setDataJustification (uint8_t justification)
uint8_t getRange ()
void setRange (uint8_t range)
void getAcceleration (int16_t *x, int16_t *y, int16_t *z)
int16_t getAccelerationX ()
int16_t getAccelerationY ()
int16_t getAccelerationZ ()
uint8_t getFIFOMode ()
void setFIFOMode (uint8_t mode)
uint8_t getFIFOTriggerInterruptPin ()
void setFIFOTriggerInterruptPin (uint8_t interrupt)
uint8_t getFIFOSamples ()
void setFIFOSamples (uint8_t size)
bool getFIFOTriggerOccurred ()
uint8_t getFIFOLength ()

Constructor & Destructor Documentation

ADXL345::ADXL345 ( )

Default constructor, uses default I2C address.

See also:
ADXL345_DEFAULT_ADDRESS
ADXL345::ADXL345 ( uint8_t  address)

Specific address constructor.

Parameters:
addressI2C address
See also:
ADXL345_DEFAULT_ADDRESS
ADXL345_ADDRESS_ALT_LOW
ADXL345_ADDRESS_ALT_HIGH

Member Function Documentation

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.

Parameters:
x16-bit signed integer container for X-axis acceleration
y16-bit signed integer container for Y-axis acceleration
z16-bit signed integer container for Z-axis acceleration
See also:
ADXL345_RA_DATAX0
int16_t ADXL345::getAccelerationX ( )

Get X-axis accleration measurement.

Returns:
16-bit signed X-axis acceleration value
See also:
ADXL345_RA_DATAX0
int16_t ADXL345::getAccelerationY ( )

Get Y-axis accleration measurement.

Returns:
16-bit signed Y-axis acceleration value
See also:
ADXL345_RA_DATAY0
int16_t ADXL345::getAccelerationZ ( )

Get Z-axis accleration measurement.

Returns:
16-bit signed Z-axis acceleration value
See also:
ADXL345_RA_DATAZ0
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.

Returns:
Activity coupling (0 = DC, 1 = AC)
See also:
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_AC_BIT
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.

Returns:
X axis activity source flag
See also:
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_ACTX_BIT
bool ADXL345::getActivitySourceY ( )

Get Y axis activity source flag.

Returns:
Y axis activity source flag
See also:
getActivitySourceX()
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_ACTY_BIT
bool ADXL345::getActivitySourceZ ( )

Get Z axis activity source flag.

Returns:
Z axis activity source flag
See also:
getActivitySourceX()
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_ACTZ_BIT
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.

Returns:
Activity threshold (scaled at 62.5 mg/LSB)
See also:
ADXL345_RA_THRESH_ACT
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.

Returns:
X axis activity monitoring enabled value
See also:
getActivityAC()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_X_BIT
bool ADXL345::getActivityYEnabled ( )

Get Y axis activity monitoring.

Returns:
Y axis activity monitoring enabled value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_Y_BIT
bool ADXL345::getActivityZEnabled ( )

Get Z axis activity monitoring.

Returns:
Z axis activity monitoring enabled value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_Z_BIT
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.

Returns:
Sleep mode enabled flag
See also:
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_ASLEEP_BIT
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.

Returns:
Auto-sleep enabled status
See also:
getActivityThreshold()
getInactivityThreshold()
getInactivityTime()
ADXL345_RA_POWER_CTL
ADXL345_PCTL_AUTOSLEEP_BIT
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.

Returns:
Data justification mode
See also:
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_JUSTIFY_BIT
uint8_t ADXL345::getDeviceID ( )

Get Device ID. The DEVID register holds a fixed device ID code of 0xE5 (345 octal).

Returns:
Device ID (should be 0xE5, 229 dec, 345 oct)
See also:
ADXL345_RA_DEVID
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.

Returns:
Tap latency (scaled at 1.25 ms/LSB)
See also:
ADXL345_RA_LATENT
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.

Returns:
Double tap window (scaled at 1.25 ms/LSB)
See also:
ADXL345_RA_WINDOW
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::

Returns:
Current FIFO length
See also:
ADXL345_RA_FIFO_CTL
ADXL345_FIFOSTAT_LENGTH_BIT
ADXL345_FIFOSTAT_LENGTH_LENGTH
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.)

Returns:
Curent FIFO mode
See also:
ADXL345_RA_FIFO_CTL
ADXL345_FIFO_MODE_BIT
ADXL345_FIFO_MODE_LENGTH
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.

Returns:
Current FIFO samples setting
See also:
ADXL345_RA_FIFO_CTL
ADXL345_FIFO_SAMPLES_BIT
ADXL345_FIFO_SAMPLES_LENGTH
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.

Returns:
Current FIFO trigger interrupt setting
See also:
ADXL345_RA_FIFO_CTL
ADXL345_FIFO_TRIGGER_BIT
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.

Returns:
FIFO trigger occurred status
See also:
ADXL345_RA_FIFO_CTL
ADXL345_FIFOSTAT_TRIGGER_BIT
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.

Returns:
Freefall threshold value (scaled at 62.5 mg/LSB)
See also:
ADXL345_RA_THRESH_FF
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.

Returns:
Freefall time value (scaled at 5 ms/LSB)
See also:
getFreefallThreshold()
ADXL345_RA_TIME_FF
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.

Returns:
Full resolution enabled setting
See also:
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_FULL_RES_BIT
bool ADXL345::getInactivityAC ( )

Get inactivity AC/DC coupling.

Returns:
Inctivity coupling (0 = DC, 1 = AC)
See also:
getActivityAC()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_AC_BIT
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.

Returns:
Inactivity threshold (scaled at 62.5 mg/LSB)
See also:
ADXL345_RA_THRESH_INACT
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.

Returns:
Inactivity time (scaled at 1 sec/LSB)
See also:
ADXL345_RA_TIME_INACT
bool ADXL345::getInactivityXEnabled ( )

Get X axis inactivity monitoring.

Returns:
Y axis inactivity monitoring enabled value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_X_BIT
bool ADXL345::getInactivityYEnabled ( )

Get Y axis inactivity monitoring.

Returns:
Y axis inactivity monitoring enabled value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_Y_BIT
bool ADXL345::getInactivityZEnabled ( )

Get Z axis inactivity monitoring.

Returns:
Z axis inactivity monitoring enabled value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_Z_BIT
bool ADXL345::getIntActivityEnabled ( )

Set ACTIVITY interrupt enabled status.

Returns:
Interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_ACTIVITY_BIT
uint8_t ADXL345::getIntActivityPin ( )

Get ACTIVITY interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_ACTIVITY_BIT
uint8_t ADXL345::getIntActivitySource ( )

Get ACTIVITY interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_ACTIVITY_BIT
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.

Returns:
DATA_READY interrupt enabled status.
See also:
ADXL345_RA_INT_ENABLE
ADXL345_INT_DATA_READY_BIT
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.

Returns:
Interrupt pin setting
See also:
ADXL345_RA_INT_MAP
ADXL345_INT_DATA_READY_BIT
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.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_DATA_READY_BIT
bool ADXL345::getIntDoubleTapEnabled ( )

Get DOUBLE_TAP interrupt enabled status.

Returns:
Interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_DOUBLE_TAP_BIT
uint8_t ADXL345::getIntDoubleTapPin ( )

Get DOUBLE_TAP interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_DOUBLE_TAP_BIT
uint8_t ADXL345::getIntDoubleTapSource ( )

Get DOUBLE_TAP interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_DOUBLE_TAP_BIT
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.

Returns:
Interrupt mode setting
See also:
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_INTMODE_BIT
bool ADXL345::getIntFreefallEnabled ( )

Get FREE_FALL interrupt enabled status.

Returns:
Interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_FREE_FALL_BIT
uint8_t ADXL345::getIntFreefallPin ( )

Get FREE_FALL interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_FREE_FALL_BIT
uint8_t ADXL345::getIntFreefallSource ( )

Get FREE_FALL interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_FREE_FALL_BIT
bool ADXL345::getIntInactivityEnabled ( )

Get INACTIVITY interrupt enabled status.

Returns:
Interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_INACTIVITY_BIT
uint8_t ADXL345::getIntInactivityPin ( )

Get INACTIVITY interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_INACTIVITY_BIT
uint8_t ADXL345::getIntInactivitySource ( )

Get INACTIVITY interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_INACTIVITY_BIT
bool ADXL345::getIntOverrunEnabled ( )

Get OVERRUN interrupt enabled status.

Returns:
Interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_OVERRUN_BIT
uint8_t ADXL345::getIntOverrunPin ( )

Get OVERRUN interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_OVERRUN_BIT
uint8_t ADXL345::getIntOverrunSource ( )

Get OVERRUN interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_OVERRUN_BIT
bool ADXL345::getIntSingleTapEnabled ( )

Set SINGLE_TAP interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_SINGLE_TAP_BIT
uint8_t ADXL345::getIntSingleTapPin ( )

Get SINGLE_TAP interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_SINGLE_TAP_BIT
uint8_t ADXL345::getIntSingleTapSource ( )

Get SINGLE_TAP interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_SINGLE_TAP_BIT
bool ADXL345::getIntWatermarkEnabled ( )

Get WATERMARK interrupt enabled status.

Returns:
Interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_WATERMARK_BIT
uint8_t ADXL345::getIntWatermarkPin ( )

Get WATERMARK interrupt pin.

Returns:
Interrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_WATERMARK_BIT
uint8_t ADXL345::getIntWatermarkSource ( )

Get WATERMARK interrupt source flag.

Returns:
Interrupt source flag
See also:
ADXL345_RA_INT_SOURCE
ADXL345_INT_WATERMARK_BIT
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.

Returns:
Link status
See also:
ADXL345_RA_POWER_CTL
ADXL345_PCTL_LINK_BIT
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).

Returns:
Low power enabled status
See also:
ADXL345_RA_BW_RATE
ADXL345_BW_LOWPOWER_BIT
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.

Returns:
Measurement enabled status
See also:
ADXL345_RA_POWER_CTL
ADXL345_PCTL_MEASURE_BIT
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.

Parameters:
xX axis offset container
yY axis offset container
zZ axis offset container
See also:
ADXL345_RA_OFSX
ADXL345_RA_OFSY
ADXL345_RA_OFSZ
int8_t ADXL345::getOffsetX ( )

Get X axis offset.

Returns:
X axis offset value
See also:
getOffset()
ADXL345_RA_OFSX
int8_t ADXL345::getOffsetY ( )

Get Y axis offset.

Returns:
Y axis offset value
See also:
getOffset()
ADXL345_RA_OFSY
int8_t ADXL345::getOffsetZ ( )

Get Z axis offset.

Returns:
Z axis offset value
See also:
getOffset()
ADXL345_RA_OFSZ
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)

Returns:
Range value (0x0 - 0x3 for 2g/4g/8g/16g)
See also:
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_RANGE_BIT
ADXL345_FORMAT_RANGE_LENGTH
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.

Returns:
Data rate (0x0 - 0xF)
See also:
ADXL345_RA_BW_RATE
ADXL345_BW_RATE_BIT
ADXL345_BW_RATE_LENGTH
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.

Returns:
Self-test force enabled setting
See also:
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_SELFTEST_BIT
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.

Returns:
Sleep enabled status
See also:
ADXL345_RA_POWER_CTL
ADXL345_PCTL_SLEEP_BIT
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.

Returns:
SPI mode setting
See also:
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_SELFTEST_BIT
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.

Returns:
Double-tap fast-movement suppression value
See also:
getTapThreshold()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_SUP_BIT
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.

Returns:
Double-tap fast-movement suppression value
See also:
getTapThreshold()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_X_BIT
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.

Returns:
Double-tap fast-movement suppression value
See also:
getTapThreshold()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_Y_BIT
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.

Returns:
Double-tap fast-movement suppression value
See also:
getTapThreshold()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_Z_BIT
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.

Returns:
Tap duration (scaled at 625 us/LSB)
See also:
ADXL345_RA_DUR
bool ADXL345::getTapSourceX ( )

Get X axis tap source flag.

Returns:
X axis tap source flag
See also:
getActivitySourceX()
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_TAPX_BIT
bool ADXL345::getTapSourceY ( )

Get Y axis tap source flag.

Returns:
Y axis tap source flag
See also:
getActivitySourceX()
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_TAPY_BIT
bool ADXL345::getTapSourceZ ( )

Get Z axis tap source flag.

Returns:
Z axis tap source flag
See also:
getActivitySourceX()
ADXL345_RA_ACT_TAP_STATUS
ADXL345_TAPSTAT_TAPZ_BIT
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.

Returns:
Tap threshold (scaled at 62.5 mg/LSB)
See also:
ADXL345_RA_THRESH_TAP
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)

Returns:
Wakeup frequency (0x0 - 0x3, indicating 8/4/2/1Hz respectively)
See also:
ADXL345_RA_POWER_CTL
ADXL345_PCTL_SLEEP_BIT
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.

Parameters:
enabledActivity AC/DC coupling (TRUE for AC, FALSE for DC)
See also:
getActivityAC()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_AC_BIT
void ADXL345::setActivityThreshold ( uint8_t  threshold)

Set activity threshold.

Parameters:
thresholdActivity threshold (scaled at 62.5 mg/LSB)
See also:
getActivityThreshold()
ADXL345_RA_THRESH_ACT
void ADXL345::setActivityXEnabled ( bool  enabled)

Set X axis activity monitoring inclusion.

Parameters:
enabledX axis activity monitoring inclusion value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_X_BIT
void ADXL345::setActivityYEnabled ( bool  enabled)

Set Y axis activity monitoring inclusion.

Parameters:
enabledY axis activity monitoring inclusion value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_Y_BIT
void ADXL345::setActivityZEnabled ( bool  enabled)

Set Z axis activity monitoring inclusion.

Parameters:
enabledZ axis activity monitoring inclusion value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_ACT_Z_BIT
void ADXL345::setAutoSleepEnabled ( bool  enabled)

Set auto-sleep enabled status.

Parameters:
enabledNew auto-sleep status
See also:
getAutoSleepEnabled()
ADXL345_RA_POWER_CTL
ADXL345_PCTL_AUTOSLEEP_BIT
void ADXL345::setDataJustification ( uint8_t  justification)

Set data justification mode setting.

Parameters:
justificationNew data justification mode
See also:
getDataJustification()
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_JUSTIFY_BIT
void ADXL345::setDoubleTapLatency ( uint8_t  latency)

Set tap duration.

Parameters:
latencyTap latency (scaled at 1.25 ms/LSB)
See also:
getDoubleTapLatency()
ADXL345_RA_LATENT
void ADXL345::setDoubleTapWindow ( uint8_t  window)

Set double tap window.

Parameters:
windowDouble tap window (scaled at 1.25 ms/LSB)
See also:
getDoubleTapWindow()
ADXL345_RA_WINDOW
void ADXL345::setFIFOMode ( uint8_t  mode)

Set FIFO mode.

Parameters:
modeNew FIFO mode
See also:
getFIFOMode()
ADXL345_RA_FIFO_CTL
ADXL345_FIFO_MODE_BIT
ADXL345_FIFO_MODE_LENGTH
void ADXL345::setFIFOSamples ( uint8_t  size)

Set FIFO samples setting.

Parameters:
sizeNew FIFO samples setting (impact depends on FIFO mode setting)
See also:
getFIFOSamples()
getFIFOMode()
ADXL345_RA_FIFO_CTL
ADXL345_FIFO_SAMPLES_BIT
ADXL345_FIFO_SAMPLES_LENGTH
void ADXL345::setFIFOTriggerInterruptPin ( uint8_t  interrupt)

Set FIFO trigger interrupt pin setting.

Parameters:
interruptNew FIFO trigger interrupt pin setting
See also:
ADXL345_RA_FIFO_CTL
ADXL345_FIFO_TRIGGER_BIT
void ADXL345::setFreefallThreshold ( uint8_t  threshold)

Set freefall threshold value.

Parameters:
thresholdFreefall threshold value (scaled at 62.5 mg/LSB)
See also:
getFreefallThreshold()
ADXL345_RA_THRESH_FF
void ADXL345::setFreefallTime ( uint8_t  time)

Set freefall time value.

Parameters:
thresholdFreefall time value (scaled at 5 ms/LSB)
See also:
getFreefallTime()
ADXL345_RA_TIME_FF
void ADXL345::setFullResolution ( uint8_t  resolution)

Set full resolution mode setting.

Parameters:
resolutionNew full resolution enabled setting
See also:
getFullResolution()
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_FULL_RES_BIT
void ADXL345::setInactivityAC ( bool  enabled)

Set inctivity AC/DC coupling.

Parameters:
enabledInactivity AC/DC coupling (TRUE for AC, FALSE for DC)
See also:
getActivityAC()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_AC_BIT
void ADXL345::setInactivityThreshold ( uint8_t  threshold)

Set inactivity threshold.

Parameters:
thresholdInctivity threshold (scaled at 62.5 mg/LSB)
See also:
getInctivityThreshold()
ADXL345_RA_THRESH_INACT
void ADXL345::setInactivityTime ( uint8_t  time)

Set inactivity time.

Parameters:
timeInactivity time (scaled at 1 sec/LSB)
See also:
getInctivityTime()
ADXL345_RA_TIME_INACT
void ADXL345::setInactivityXEnabled ( bool  enabled)

Set X axis activity monitoring inclusion.

Parameters:
enabledX axis inactivity monitoring inclusion value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_X_BIT
void ADXL345::setInactivityYEnabled ( bool  enabled)

Set Y axis inactivity monitoring inclusion.

Parameters:
enabledY axis inactivity monitoring inclusion value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_Y_BIT
void ADXL345::setInactivityZEnabled ( bool  enabled)

Set Z axis inactivity monitoring inclusion.

Parameters:
enabledZ axis activity monitoring inclusion value
See also:
getActivityAC()
getActivityXEnabled()
ADXL345_RA_ACT_INACT_CTL
ADXL345_AIC_INACT_Z_BIT
void ADXL345::setIntActivityEnabled ( bool  enabled)

Set ACTIVITY interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_ACTIVITY_BIT
void ADXL345::setIntActivityPin ( uint8_t  pin)

Set ACTIVITY interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_ACTIVITY_BIT
void ADXL345::setIntDataReadyEnabled ( bool  enabled)

Set DATA_READY interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_DATA_READY_BIT
void ADXL345::setIntDataReadyPin ( uint8_t  pin)

Set DATA_READY interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_DATA_READY_BIT
void ADXL345::setIntDoubleTapEnabled ( bool  enabled)

Set DOUBLE_TAP interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_DOUBLE_TAP_BIT
void ADXL345::setIntDoubleTapPin ( uint8_t  pin)

Set DOUBLE_TAP interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_DOUBLE_TAP_BIT
void ADXL345::setInterruptMode ( uint8_t  mode)

Set interrupt mode setting.

Parameters:
modeNew interrupt mode setting
See also:
getInterruptMode()
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_INTMODE_BIT
void ADXL345::setIntFreefallEnabled ( bool  enabled)

Set FREE_FALL interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_FREE_FALL_BIT
void ADXL345::setIntFreefallPin ( uint8_t  pin)

Set FREE_FALL interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_FREE_FALL_BIT
void ADXL345::setIntInactivityEnabled ( bool  enabled)

Set INACTIVITY interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_INACTIVITY_BIT
void ADXL345::setIntInactivityPin ( uint8_t  pin)

Set INACTIVITY interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_INACTIVITY_BIT
void ADXL345::setIntOverrunEnabled ( bool  enabled)

Set OVERRUN interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_OVERRUN_BIT
void ADXL345::setIntOverrunPin ( uint8_t  pin)

Set OVERRUN interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_OVERRUN_BIT
void ADXL345::setIntSingleTapEnabled ( bool  enabled)

Set SINGLE_TAP interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_SINGLE_TAP_BIT
void ADXL345::setIntSingleTapPin ( uint8_t  pin)

Set SINGLE_TAP interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_SINGLE_TAP_BIT
void ADXL345::setIntWatermarkEnabled ( bool  enabled)

Set WATERMARK interrupt enabled status.

Parameters:
enabledNew interrupt enabled status
See also:
getIntDataReadyEnabled()
ADXL345_RA_INT_ENABLE
ADXL345_INT_WATERMARK_BIT
void ADXL345::setIntWatermarkPin ( uint8_t  pin)

Set WATERMARK interrupt pin.

Parameters:
pinInterrupt pin setting
See also:
getIntDataReadyPin()
ADXL345_RA_INT_MAP
ADXL345_INT_WATERMARK_BIT
void ADXL345::setLinkEnabled ( bool  enabled)

Set activity/inactivity serial linkage status.

Parameters:
enabledNew link status
See also:
ADXL345_RA_POWER_CTL
ADXL345_PCTL_LINK_BIT
void ADXL345::setLowPowerEnabled ( bool  enabled)

Set low power enabled status.

See also:
getLowPowerEnabled()
Parameters:
enabledLow power enable setting
See also:
ADXL345_RA_BW_RATE
ADXL345_BW_LOWPOWER_BIT
void ADXL345::setMeasureEnabled ( bool  enabled)

Set measurement enabled status.

Parameters:
enabledMeasurement enabled status
See also:
getMeasureEnabled()
ADXL345_RA_POWER_CTL
ADXL345_PCTL_MEASURE_BIT
void ADXL345::setOffset ( int8_t  x,
int8_t  y,
int8_t  z 
)

Set axis offsets.

Parameters:
xX axis offset value
yY axis offset value
zZ axis offset value
See also:
getOffset()
ADXL345_RA_OFSX
ADXL345_RA_OFSY
ADXL345_RA_OFSZ
void ADXL345::setOffsetX ( int8_t  x)

Set X axis offset.

Parameters:
xX axis offset value
See also:
getOffset()
ADXL345_RA_OFSX
void ADXL345::setOffsetY ( int8_t  y)

Set Y axis offset.

Parameters:
yY axis offset value
See also:
getOffset()
ADXL345_RA_OFSY
void ADXL345::setOffsetZ ( int8_t  z)

Set Z axis offset.

Parameters:
zZ axis offset value
See also:
getOffset()
ADXL345_RA_OFSZ
void ADXL345::setRange ( uint8_t  range)

Set data range setting.

Parameters:
rangeRange value (0x0 - 0x3 for 2g/4g/8g/16g)
See also:
getRange()
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_RANGE_BIT
ADXL345_FORMAT_RANGE_LENGTH
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

Parameters:
rateNew data rate (0x0 - 0xF)
See also:
ADXL345_RATE_100
ADXL345_RA_BW_RATE
ADXL345_BW_RATE_BIT
ADXL345_BW_RATE_LENGTH
void ADXL345::setSelfTestEnabled ( uint8_t  enabled)

Set self-test force enabled.

Parameters:
enabledNew self-test force enabled setting
See also:
getSelfTestEnabled()
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_SELFTEST_BIT
void ADXL345::setSleepEnabled ( bool  enabled)

Set sleep mode enabled status.

Parameters:
Sleepmode enabled status
See also:
getSleepEnabled()
ADXL345_RA_POWER_CTL
ADXL345_PCTL_SLEEP_BIT
void ADXL345::setSPIMode ( uint8_t  mode)

Set SPI mode setting.

Parameters:
modeNew SPI mode setting
See also:
getSPIMode()
ADXL345_RA_DATA_FORMAT
ADXL345_FORMAT_SELFTEST_BIT
void ADXL345::setTapAxisSuppress ( bool  enabled)

Set double-tap fast-movement suppression.

Parameters:
enabledDouble-tap fast-movement suppression value
See also:
getTapAxisSuppress()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_SUP_BIT
void ADXL345::setTapAxisXEnabled ( bool  enabled)

Set tap detection X axis inclusion.

Parameters:
enabledX axis tap detection enabled value
See also:
getTapAxisXEnabled()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_X_BIT
void ADXL345::setTapAxisYEnabled ( bool  enabled)

Set tap detection Y axis inclusion.

Parameters:
enabledY axis tap detection enabled value
See also:
getTapAxisYEnabled()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_Y_BIT
void ADXL345::setTapAxisZEnabled ( bool  enabled)

Set tap detection Z axis inclusion.

Parameters:
enabledZ axis tap detection enabled value
See also:
getTapAxisZEnabled()
ADXL345_RA_TAP_AXES
ADXL345_TAPAXIS_Z_BIT
void ADXL345::setTapDuration ( uint8_t  duration)

Set tap duration.

Parameters:
durationTap duration (scaled at 625 us/LSB)
See also:
getTapDuration()
ADXL345_RA_DUR
void ADXL345::setTapThreshold ( uint8_t  threshold)

Set tap threshold.

Parameters:
thresholdTap magnitude threshold (scaled at 62.5 mg/LSB)
See also:
ADXL345_RA_THRESH_TAP
getTapThreshold()
void ADXL345::setWakeupFrequency ( uint8_t  frequency)

Set wakeup frequency.

Parameters:
frequencyWakeup frequency (0x0 - 0x3, indicating 8/4/2/1Hz respectively)
See also:
getWakeupFrequency()
ADXL345_RA_POWER_CTL
ADXL345_PCTL_SLEEP_BIT
bool ADXL345::testConnection ( )

Verify the I2C connection. Make sure the device is connected and responds as expected.

Returns:
True if connection is valid, false otherwise

The documentation for this class was generated from the following files:
 All Data Structures Functions Variables