Atmel Software Framework

bma_axis.inc.h File Reference

Bosch Digital, triaxial acceleration sensor axis format.

This module defines accelerometer axis data types and utility routines used in multiple Bosch sensor drivers, including BMA020, BMA150, BMA180, BMA220, BMA222, and BMA250 devices.

The module relies upon conditionally compiled types and functions to generate functions specialized for a particular driver module. Driver source modules include this module directly via the C-preprocessor with a #include directive.

Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.

#include <asf.h>

Data Structures

union  bma_axis10_t
 Bosch 10-bit Axis Data Format. More...
 
union  bma_axis14_t
 Bosch 14-bit Axis Data Format. More...
 
union  bma_axis8_t
 Bosch 8-bit Axis Data Format. More...
 

Functions

Bosch Accelerometer Driver Axis Value (type conversion)
static int16_t bma_axis8_val (const bma_axis8_t axis)
 Construct a signed value from a raw axis sample. More...
 
static int16_t bma_axis10_val (const bma_axis10_t axis)
 Construct a signed value from a raw axis sample. More...
 
static int16_t bma_axis14_val (const bma_axis14_t axis)
 Construct a signed value from a raw axis sample. More...
 

static int16_t bma_axis10_val ( const bma_axis10_t  axis)
inlinestatic

Construct a signed value from a raw axis sample.

The BMA020, BMA150, and BMA250 return little-endian 2's-complement 10-bit axis values stored within a 16-bit word.

Parameters
axisAn bma_axis10_t type storing a raw sensor axis sample.
Returns
The aligned and sign-extended axis data value.

References bma_axis10_t::acc_lsb, bma_axis10_t::acc_msb, bma_axis10_t::field, and bma_axis10_t::word.

static int16_t bma_axis14_val ( const bma_axis14_t  axis)
inlinestatic

Construct a signed value from a raw axis sample.

The BMA180 returns little-endian 2's-complement 14-bit axis values stored within a 16-bit word.

Parameters
axisAn bma_axis14_t type storing a raw sensor axis sample.
Returns
The aligned and sign-extended axis data value.

References bma_axis14_t::acc_lsb, bma_axis14_t::acc_msb, bma_axis14_t::field, and bma_axis14_t::word.

static int16_t bma_axis8_val ( const bma_axis8_t  axis)
inlinestatic

Construct a signed value from a raw axis sample.

The BMA222 returns little-endian 2's-complement 8-bit axis values stored within a 16-bit word.

Parameters
axisAn bma_axis8_t type storing a raw sensor axis sample.
Returns
The aligned and sign-extended axis data value.

References bma_axis8_t::acc_msb, bma_axis8_t::field, and bma_axis8_t::word.