API Reference¶
qwiic_adxl313¶
Python module for the [SparkFun Triple Axis Accelerometer Breakout - ADXL313 (QWIIC)](https://www.sparkfun.com/products/17241)
This python package is a port of the existing [SparkFun ADXL313 Arduino Library](https://github.com/sparkfun/SparkFun_ADXL313_Arduino_Library)
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
- class qwiic_adxl313.QwiicAdxl313(address=None, i2c_driver=None)[source]¶
- Parameters
address – The I2C address to use for the device. If not provided, the default address is used.
i2c_driver – An existing i2c driver object. If not provided a driver object is created.
- Returns
The ADXL313 device object.
- Return type
Object
- ActivityINT(state)[source]¶
Enables or disables the activity interrupt
- Parameters
state – 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- DataReadyINT(state)[source]¶
Enables or disables the dataready interrupt :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- InactivityINT(state)[source]¶
Enables or disables the inactivity interrupt :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- OverrunINT(state)[source]¶
Enables or disables the overrun interrupt :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- WatermarkINT(state)[source]¶
Enables or disables the watermark interrupt :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- autosleepOff()[source]¶
Turns Autosleep off.
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- autosleepOn()[source]¶
Turns Autosleep on.
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- begin()[source]¶
Initialize the operation of the module
- Returns
Returns true of the initializtion was successful, otherwise False.
- Return type
bool
- clearFifo()[source]¶
Clears all FIFO data by bypassing FIFO and re-entering previous mode
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- property connected¶
Determine if a device is conntected to the system..
- Returns
True if the device is connected, otherwise False.
- Return type
bool
- dataReady()[source]¶
Reads INT Source register, returns dataready bit status (0 or 1)
- Returns
Status of dataready bit within the int source register
- Return type
bool
- getActivityThreshold()[source]¶
Gets the Threshold Value for Detecting Activity.
- Returns
activity detection theshold
- Return type
byte
- getFifoEntriesAmount()[source]¶
Get FIFO entries amount (0-32)
- Returns
FIFO entries amount (0-32)
- Return type
byte
- getFifoMode()[source]¶
Get the current FIFO mode (0=bypass,1=fifo,2=stream,3=trigger)
- Returns
FIFO mode (0=bypass,1=fifo,2=stream,3=trigger)
- Return type
byte
- getFifoSamplesThreshhold()[source]¶
Get FIFO samples threshold (0-32)
- Returns
FIFO samples threshold (0-32)
- Return type
byte
- getInactivityThreshold()[source]¶
Gets the Threshold Value for Detecting Inactivity.
- Returns
inactivity detection theshold
- Return type
byte
- getRange()[source]¶
Reads the current range setting on the device
- Returns
range setting of the device (from in DATA_FORMAT register)
- Return type
float
- getRegisterBit(regAddress, bitPos)[source]¶
Gets the bit status of specified register
- Parameters
regAddress – The address of the register you’d like to read
bitPos –
The specific bit of the register you’d like to read
- return
Status of bit spcified within the register (0 or 1)
- rtype
bool
- getTimeInactivity()[source]¶
Gets time requirement below inactivity threshold to detect inactivity
- Returns
inactivity detection time requirement
- Return type
byte
- isConnected()[source]¶
Determine if a device is conntected to the system..
- Returns
True if the device is connected, otherwise False.
- Return type
bool
- isInterruptEnabled(interruptBit)[source]¶
Get status of whether an interrupt is enabled or disabled. :param interrruptBit: the desired int bit you’d like to read
- Returns
Returns true if the interrupt bit is enabled, otherwise false
- Return type
bool
- limit(num, minimum=1, maximum=255)[source]¶
Limits input ‘num’ between minimum and maximum values. Default minimum value is 1 and maximum value is 255.
- Parameters
num – the number you’l like to limit
minimum – the min (default 1)
maximum – the max (default 255)
- Returns
your new limited number within min and max
- Return type
int
- measureModeOn()[source]¶
sets the measure bit, putting decive in measure mode, ready for reading data
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- readAccel()[source]¶
Reads Acceleration into Three Class Variables: x, y and z
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setActivityThreshold(activityThreshold)[source]¶
Sets the Threshold Value for Detecting Activity. :param activityThreshold: 0-255
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setActivityX(state)[source]¶
Enalbes or disables X axis participattion in activity detection :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setActivityY(state)[source]¶
Enalbes or disables Y axis participattion in activity detection :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setActivityZ(state)[source]¶
Enalbes or disables Z axis participattion in activity detection :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setFifoMode(mode)[source]¶
Set FIFO mode
- Parameters
mode – FIFO mode (ADXL313_FIFO_MODE_BYPASS, ADXL313_FIFO_MODE_FIFO, ADXL313_FIFO_MODE_STREAM, ADXL313_FIFO_MODE_TRIGGER)
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setFifoSamplesThreshhold(samples)[source]¶
Set FIFO samples threshold (0-32)
- Parameters
mode – FIFO samples threshold (0-32)
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setInactivityThreshold(inactivityThreshold)[source]¶
Sets the Threshold Value for Detecting Inactivity. :param inactivityThreshold: 0-255
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setInactivityX(state)[source]¶
Enalbes or disables X axis participattion in inactivity detection :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setInactivityY(state)[source]¶
Enalbes or disables Y axis participattion in inactivity detection :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setInactivityZ(state)[source]¶
Enalbes or disables Z axis participattion in inactivity detection :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setInterrupt(interruptBit, state)[source]¶
Sets the enable bit (0 or 1) for one desired int inside the ADXL313_INT_ENABLE register :param interrruptBit: the desired int bit you’d like to change :param state: 1 = enabled, 0 = disabled
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setInterruptMapping(interruptBit, interruptPin)[source]¶
Maps the desired interrupt bit (from intsource) to the desired hardware interrupt pin :param interrruptBit: the desired int bit you’d like to map :param interruptPin: ADXL313_INT1_PIN or ADXL313_INT2_PIN
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setRange(new_range)[source]¶
Sets the range setting on the device
- Parameters
range – range value desired (ADXL313_RANGE_05_G, ADXL313_RANGE_1_G, etc)
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool
- setRegisterBit(regAddress, bitPos, state)[source]¶
Sets or clears bit of specified register
- Parameters
regAddress – The address of the register you’d like to affect.
bitPos – The specific bit of the register you’d like to affect.
state –
The condition of the bit you’d like to set/clear (0 or 1).
- return
Returns true of the function was completed, otherwise False.
- rtype
bool
- setTimeInactivity(timeInactivity)[source]¶
Sets time requirement below inactivity threshold to detect inactivity :param timeInactivity: 0-255
- Returns
Returns true of the function was completed, otherwise False.
- Return type
bool