acc: 3D Accelerometer

Top  Previous  Next

The 3D accelerometer API supports applications for such things as collision detection, monitoring driving experience (vibration and harshness), inertial navigation, etc.

 

It is possible to start a logging feature which will automatically collect current acceleration with a minimum of resource requirement - thus allowing for a continuous collection of data while the device is performing other tasks. This functionality will allow implementation of a "black box" that collects various information such as G-forces, GPS positions, and CAN bus information at the time of a given incident or event.

 

The acceleration values are returned as mg units (SI standard: 0.001 m/s2 [meters per second squared]).

The maximum acceleration that can be detected is 16000 mg.

The axis of the acceleration is represented relative to the device (please see the technical manual for details).

 

 

Architecture of the Accelerometer API

The Accelerometer API is based on an asynchronous event-based model where solicited as well as unsolicited events from the accelerometer are automatically queued and delivered to the user application. The function accWaitEvent is used to return information about the various events arriving from the accelerometer. This model eliminates the requirement for the application to continuously poll for messages, and it also encourage use of multithreading with the added benefits that comes with this.

Events that are triggered by the application requesting various information from the accelerometer are therefore called solicited events, or, alternatively, they can be triggered by the accelerometer itself and are therefore instead called unsolicited events. A solicited event is, for example, when the application calls accLoggerStop and then accWaitEvent returns with event# 4. An unsolicited event works exactly the same way as a solicited event, except for the fact that accLoggerStop is no longer called by the application.

Please consult accWaitEvent for detailed information about the various events and how they are handled.

 

 

The following functions/function blocks are available:

 

accOpen

Opens the interface.

accClose

Closes the interface.

accVector

Reads an acceleration vector.

accVectorToForce

Calculates the total force of acceleration.

accVectorToAngles

Calculates axis angles relative to acceleration.

accWaitEvent

Waits for an event from the acceleration interface.

accSetAccelerationEvent

Control monitoring of acceleration.

accAccelerationEvent

Reads acceleration event.

accSetShockEvent

Controls monitoring of shocks.

accShockEvent

Reads shock event.

accLoggerSetConfig

Configures logging feature.

accLoggerGetConfig

Reads logging configuration and status.

accLoggerStart

Starts logging.

accLoggerStop

Stops logging.

accLoggerLevel

Returns the amount of buffer used by the logger.

accLoggerRead

Reads value from logger

accLoggerToMem

Moves the contents of the logger to memory.

accVibrationSetWakeup

Enable or disable the ability to wake from low power modes with device vibration. See pmSuspend.