Accelerometer interrupts
Last updated
Last updated
The Waspmote's accelerometer can provide an interrupt signal and offers several possibilities for personalizing this signal. The registers involved in the interrupt generation behavior are:
CTRL_REG3
INT1_CFG:
INT1_SRC
INT1_THS
INT1_DURATION
Free-fall detection refers to a specific configuration of the interrupt registers that allows the recognition of device free-fall. In real cases, a "free fall zone" is defined around the zero-g level, where all accelerations are small enough to generate the interrupt.
The setFF()
function sets the Free Fall interrupt.
First of all, it clears previous interruptions and writes into the below explained registers the selected values. After writing the registers, the hardware interruption is attached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The default free-fall zone margin is set to 448 mG. It can be changed when calling the setFF()
function. For this purpose, the new margin has to be defined as input in mG units.
Example of use:
The unsetFF()
function clears and unsets the Free Fall interrupt.
First of all, it clears CTRL_REG3
and INT1_SRC
registers and the hardware interruption is detached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The wake-up interrupt will generate an event when the acceleration on axis X, Y or Z exceeds a threshold.
The setIWU()
function sets the Inertial Wake-Up interruption.
First of all, it clears previous interruptions and writes into the below explained registers the selected values. After writing the registers, the hardware interruption is attached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The default inertial wake-up threshold is set to 448 mG. It can be changed when calling the setFF()
function. For this purpose, the new margin has to be defined as input in mG units.
Example of use:
The unsetIWU()
function clears and unsets the Inertial Wake-Up interruption.
First of all, it clears CTRL_REG3
and INT1_SRC
registers and the hardware interruption is detached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The 6D movement interrupt is generated when the device moves from one direction to a different direction.
The set6DMovement()
function sets the Inertial 6D movement interruption.
First of all, it clears previous interruptions and writes into the below explained registers the selected values. After writing the registers, the hardware interruption is attached to the pin.
It returns 'flag
' to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The unset6DMovement()
function clears and unsets the Inertial Wake-Up interruption.
First of all, it clears CTRL_REG3
and INT1_SRC
registers and the hardware interruption is detached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The 6D position interrupt is generated when the device is stable in a direction. The interrupt is active as long as the position is maintained.
The set6DPosition()
function sets the 6D position interrupt.
First of all, it clears previous interruptions and writes into the below explained registers the selected values. After writing the registers, the hardware interruption is attached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use:
The unset6DPosition()
function clears and unsets the 6D position interrupt.
First of all, it clears CTRL_REG3
and INT1_SRC
register and the hardware interruption is detached to the pin.
It returns flag
to check if there was any error while writing to registers or attaching the interruption.
Example of use: