# example_accelerometer_interrupt.c File Reference

Configures accelerometer to generate an interrupt when motion is detected. More...

`#include "../HAL/hal_cc2530znp_target_board.h"`
`#include "msp430x22x4.h"`
`#include <stdarg.h>`

void(* | accelerometerIsr )(void)
void | handleAccelerometer ()
int | main (void)

## Detailed Description

Configures accelerometer to generate an interrupt when motion is detected.

Configures accelerometer to be in motion detect mode with default threshold & time settings to interrupt the MSP430 upon detection of motion. Displays the cause of the motion interrupt (X-axis, Y-axis, or Z-axis). Uses the Hardware Abstraction Layer (hal) to access the accelerometer. Configures Accelerometer with the following settings:

- Range = 2g
- Disable I2C
- Motion Detection Mode
- Stay in motion detection mode after interrupt.

Note:
  to clear accelerometer interrupt, must read the Interrupt Status register.
  to change the motion detection threshold, modify register ACCEL_MDTHR.
  to change the motion time threshold, modify register ACCEL_MDFFTMR

See also:
  VTI Technologies document: CMA3000-D01 datasheet
  VTI Technologies document: Product Family Specification, CMA3000-D0X Series 3-axis accelerometer
  VTI Technologies document: Interfacing CMA3000-D01 to an MSP430 ultra low-power microcontroller
  http://processors.wiki.ti.com/index.php/Tutorial_on_the_Examples and http://e2e.ti.com/support/low_power_rf/default.aspx

Rev
  719

Author
  dsmith

Date
  2010-08-19 10:52:09 -0700 (Thu, 19 Aug 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

## Function Documentation

void handleAccelerometer | ( |  | ) |

Our Interrupt Service Routine (ISR) for Accelerometer Interrupt

Accelerometer interrupt service routine.

Note:
  application must ensure that other operations are not accessing the accelerometer when interrupt fires. (Disable accelerometer interrupt during other communications with accelerometer, or even better, set a flag in the ISR that gets polled by your main application)

Precondition:
  accelerometerIsr function pointer points here; e.g. `accelerometerIsr =`
  global interrupts enabled
  accelerometer interrupt enabled; e.g. `halEnableAccelerometerInterrupt(NO_WAKEUP);`

Postcondition:
  interrupt is cleared

Handles Accelerometer interrupt

## Variable Documentation

void(* accelerometerIsr)(void)

Function pointer points to the function that will be called upon Accelerator Interrupt

All Data Structures Files Functions Variables Defines