upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Data Structures | Functions | Typedefs
Include dependency graph for bma250e.h:

API Description

/*
* Author: Jon Trulson <jtrulson@ics.com>
* Copyright (c) 2017 Intel Corporation.
*
* The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include "upm_utilities.h"
#include "bma250e.h"
bool shouldRun = true;
void sig_handler(int signo)
{
if (signo == SIGINT)
shouldRun = false;
}
int main(int argc, char **argv)
{
signal(SIGINT, sig_handler);
#if defined(CONFIG_BOARD_ARDUINO_101_SSS)
// ARDUINO_101_SSS (ARC core) must use I2C
// Instantiate a BMA250E instance using default i2c bus and address
bma250e_context sensor = bma250e_init(BMA250E_DEFAULT_I2C_BUS,
BMA250E_DEFAULT_ADDR, -1);
#elif defined(CONFIG_BOARD_ARDUINO_101)
// ARDUINO_101 (Quark core) where you must use SPI
// Instantiate a BMA250E instance using default SPI bus and pin 10 as CS
bma250e_context sensor = bma250e_init(BMA250E_DEFAULT_SPI_BUS,
-1, 10);
#else
// everything else use I2C by default
// Instantiate a BMA250E instance using default i2c bus and address
bma250e_context sensor = bma250e_init(BMA250E_DEFAULT_I2C_BUS,
BMA250E_DEFAULT_ADDR, -1);
#endif
if (!sensor)
{
printf("bma250e_init() failed.\n");
return 1;
}
// now output data every 250 milliseconds
while (shouldRun)
{
float x, y, z;
if (bma250e_update(sensor))
{
printf("bma250e_update() failed\n");
return 1;
}
bma250e_get_accelerometer(sensor, &x, &y, &z);
printf("Acceleration x: %f y: %f z: %f g\n",
x, y, z);
printf("Compensation Temperature: %f C\n\n",
upm_delay_ms(250);
}
printf("Exiting...\n");
bma250e_close(sensor);
return 0;
}

Go to the source code of this file.

Data Structures

struct  _bma250e_context
 

Functions

bma250e_context bma250e_init (int bus, int addr, int cs)
 
void bma250e_close (bma250e_context dev)
 
upm_result_t bma250e_update (const bma250e_context dev)
 
uint8_t bma250e_get_chip_id (const bma250e_context dev)
 
void bma250e_get_accelerometer (const bma250e_context dev, float *x, float *y, float *z)
 
float bma250e_get_temperature (const bma250e_context dev)
 
upm_result_t bma250e_devinit (const bma250e_context dev, BMA250E_POWER_MODE_T pwr, BMA250E_RANGE_T range, BMA250E_BW_T bw)
 
upm_result_t bma250e_reset (const bma250e_context dev)
 
upm_result_t bma250e_set_range (const bma250e_context dev, BMA250E_RANGE_T range)
 
upm_result_t bma250e_set_bandwidth (const bma250e_context dev, BMA250E_BW_T bw)
 
upm_result_t bma250e_set_power_mode (const bma250e_context dev, BMA250E_POWER_MODE_T power)
 
void bma250e_enable_fifo (const bma250e_context dev, bool useFIFO)
 
upm_result_t bma250e_fifo_set_watermark (const bma250e_context dev, int wm)
 
upm_result_t bma250e_fifo_config (const bma250e_context dev, BMA250E_FIFO_MODE_T mode, BMA250E_FIFO_DATA_SEL_T axes)
 
upm_result_t bma250e_set_self_test (const bma250e_context dev, bool sign, bool amp, BMA250E_SELFTTEST_AXIS_T axis)
 
uint8_t bma250e_get_interrupt_enable0 (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_enable0 (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_enable1 (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_enable1 (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_enable2 (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_enable2 (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_map0 (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_map0 (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_map1 (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_map1 (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_map2 (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_map2 (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_src (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_src (const bma250e_context dev, uint8_t bits)
 
uint8_t bma250e_get_interrupt_output_control (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_output_control (const bma250e_context dev, uint8_t bits)
 
upm_result_t bma250e_clear_interrupt_latches (const bma250e_context dev)
 
BMA250E_RST_LATCH_T bma250e_get_interrupt_latch_behavior (const bma250e_context dev)
 
upm_result_t bma250e_set_interrupt_latch_behavior (const bma250e_context dev, BMA250E_RST_LATCH_T latch)
 
uint8_t bma250e_get_interrupt_status0 (const bma250e_context dev)
 
uint8_t bma250e_get_interrupt_status1 (const bma250e_context dev)
 
uint8_t bma250e_get_interrupt_status2 (const bma250e_context dev)
 
uint8_t bma250e_get_interrupt_status3_bits (const bma250e_context dev)
 
BMA250E_ORIENT_T bma250e_get_interrupt_status3_orientation (const bma250e_context dev)
 
upm_result_t bma250e_enable_register_shadowing (const bma250e_context dev, bool shadow)
 
upm_result_t bma250e_enable_output_filtering (const bma250e_context dev, bool filter)
 
upm_result_t bma250e_set_low_power_mode2 (const bma250e_context dev)
 
upm_result_t bma250e_install_isr (const bma250e_context dev, BMA250E_INTERRUPT_PINS_T intr, int gpio, mraa_gpio_edge_t level, void(*isr)(void *), void *arg)
 
void bma250e_uninstall_isr (const bma250e_context dev, BMA250E_INTERRUPT_PINS_T intr)
 
uint8_t bma250e_read_reg (const bma250e_context dev, uint8_t reg)
 
int bma250e_read_regs (const bma250e_context dev, uint8_t reg, uint8_t *buffer, int len)
 
upm_result_t bma250e_write_reg (const bma250e_context dev, uint8_t reg, uint8_t val)
 

Typedefs

typedef struct _bma250e_contextbma250e_context
 

Function Documentation

bma250e_context bma250e_init ( int  bus,
int  addr,
int  cs 
)

BMA250E initialization.

This device can support both I2C and SPI. For SPI, set the addr to -1, and specify a positive integer representing the Chip Select (CS) pin for the cs argument. If you are using a hardware CS pin (like edison with arduino breakout), then you can connect the proper pin to the hardware CS pin on your MCU and supply -1 for cs. The default operating mode is I2C.

Parameters
busI2C or SPI bus to use.
addrThe address for this device, or -1 for SPI.
csThe gpio pin to use for the SPI Chip Select. Use -1 for I2C or for SPI with a hardware controlled pin.
Returns
The device context, or NULL if an error occurred.

Here is the call graph for this function:

void bma250e_close ( bma250e_context  dev)

BMA250E Destructor.

Parameters
devThe device context.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_update ( const bma250e_context  dev)

Update the internal stored values from sensor data.

Parameters
devThe device context.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_chip_id ( const bma250e_context  dev)

Return the chip ID.

Parameters
devThe device context.
Returns
The chip ID.

Here is the call graph for this function:

Here is the caller graph for this function:

void bma250e_get_accelerometer ( const bma250e_context  dev,
float *  x,
float *  y,
float *  z 
)

Return accelerometer data in gravities. bma250e_update() must have been called prior to calling this method.

Parameters
devThe device context.
xPointer to a floating point value that will have the current x component placed into it.
yPointer to a floating point value that will have the current y component placed into it.
zPointer to a floating point value that will have the current z component placed into it.

Here is the caller graph for this function:

float bma250e_get_temperature ( const bma250e_context  dev)

Return the current measured temperature. Note, this is not ambient temperature. bma250e_update() must have been called prior to calling this method.

Parameters
devThe device context.
Returns
The temperature in degrees Celsius.

Here is the caller graph for this function:

upm_result_t bma250e_devinit ( const bma250e_context  dev,
BMA250E_POWER_MODE_T  pwr,
BMA250E_RANGE_T  range,
BMA250E_BW_T  bw 
)

Initialize the device and start operation. This function is called from bma250e_init(), so it will not need to be called by a user unless the device is reset.

Parameters
devThe device context.
pwrOne of the BMA250E_POWER_MODE_T values.
rangeOne of the BMA250E_RANGE_T values.
bwOne of the filtering BMA250E_BW_T values.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_reset ( const bma250e_context  dev)

Reset the device as if during a power on reset. All configured values are lost when this happens. You should call bma250e_devinit() afterwards, or at least perform the same initialization bma250e_devinit() does before continuing.

Parameters
devThe device context.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_range ( const bma250e_context  dev,
BMA250E_RANGE_T  range 
)

Set the acceleration scaling range. This device supports 2, 4, 8, and 16g ranges.

Parameters
devThe device context.
rangeOne of the BMA250E_RANGE_T values.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_bandwidth ( const bma250e_context  dev,
BMA250E_BW_T  bw 
)

Set the output filtering bandwidth of the device.

Parameters
devThe device context.
bwOne of the BMA250E_BW_T values.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_power_mode ( const bma250e_context  dev,
BMA250E_POWER_MODE_T  power 
)

Set the power mode of the device. Care must be taken when setting a low power or suspend mode. By default bma250e_devinit() calls bma250e_set_low_power_mode2() to ensure that if any of these modes are entered we can still talk to the device. The default low power mode is LPM1, which requires slowing down register writes, which we cannot support. bma250e_set_low_power_mode2() enables LPM2 which keeps the digital interface operational in low power or suspend modes. See the datasheet for details.

In short, if you reset your device and don't call bma250e_devinit() or bma250e_set_low_power_mode2(), you could lose control of the device by calling this function with anything other than BMA250E_POWER_MODE_NORMAL. You've been warned :)

Parameters
devThe device context.
powerOne of the BMA250E_POWER_MODE_T values.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

void bma250e_enable_fifo ( const bma250e_context  dev,
bool  useFIFO 
)

Enable bma250e_update() to read from the FIFO rather than the accelerometer axis registers directly, if the device supports a FIFO. bma250e_devinit() enables this mode by default. An advantage to this mode that all axis data is sampled from the same timeslice. When reading directly from the accelerometer output registers, it's possible for one axis to be updated while another is being read, causing a temporal inconsistency.

Using the FIFO removes this problem.

Parameters
devThe device context.
useFIFOtrue to enable bma250e_update() to read from the FIFO. When false, update will read from the accelerometer output registers directly.

Here is the caller graph for this function:

upm_result_t bma250e_fifo_set_watermark ( const bma250e_context  dev,
int  wm 
)

Set the FIFO watermark. When the watermark is reached an interrupt (if enabled) will be generated.

Parameters
devThe device context.
wmThe FIFO watermark to use. The maximum value is 63.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_fifo_config ( const bma250e_context  dev,
BMA250E_FIFO_MODE_T  mode,
BMA250E_FIFO_DATA_SEL_T  axes 
)

Set the FIFO configuration. bma250e_devinit() uses the BMA250E_FIFO_MODE_BYPASS mode with axes set to BMA250E_FIFO_DATA_SEL_XYZ by default.

Parameters
devThe device context.
modeOne of the BMA250E_FIFO_MODE_T values.
axesOne of the BMA250E_FIFO_DATA_SEL_T values.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_self_test ( const bma250e_context  dev,
bool  sign,
bool  amp,
BMA250E_SELFTTEST_AXIS_T  axis 
)

Enable, disable, and configure the built in self test on a per axis basis. See the datasheet for details.

Parameters
signTrue for a positive deflection, false for negative.
ampTrue for a high deflection, false for a low deflection.
axisOne of the BMA250E_SELFTTEST_AXIS_T values. Note, only one axis at a time can be tested. Accelerometer output for other axes should be ignored.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_enable0 ( const bma250e_context  dev)

Return the Interrupt Enables 0 register. These registers allow you to enable various interrupt conditions. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_EN_0_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_enable0 ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt Enables 0 register. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_EN_0_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_enable1 ( const bma250e_context  dev)

Return the Interrupt Enables 1 register. These registers allow you to enable various interrupt conditions. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_EN_1_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_enable1 ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt Enables 1 register. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_EN_1_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_enable2 ( const bma250e_context  dev)

Return the Interrupt Enables 2 register. These registers allow you to enable various interrupt conditions. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_EN_2_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_enable2 ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt Enables 2 register. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_EN_2_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_map0 ( const bma250e_context  dev)

Return the Interrupt Map 0 register. These registers allow you to map specific interrupts to the interrupt 1 or interrupt 2 pin. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_MAP_0_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_map0 ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt Map 0 register. These registers allow you to map specific interrupts to the interrupt 1 or interrupt 2 pin. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_MAP_0_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_map1 ( const bma250e_context  dev)

Return the Interrupt Map 1 register. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_MAP_1_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_map1 ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt Map 1 register. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_MAP_1_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_map2 ( const bma250e_context  dev)

Return the Interrupt Map 2 register. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_MAP_2_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_map2 ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt Map 2 register. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_MAP_2_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_src ( const bma250e_context  dev)

Return the Interrupt source register. This register allows determining where data comes from (filtered/unfiltered) for those interrupt sources where this is selectable. See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_SRC_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_src ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt source register. This register allows determining where data comes from (filtered/unfiltered) for those interrupt sources where this is selectable. See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_SRC_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_output_control ( const bma250e_context  dev)

Return the Interrupt output control register. This register allows determining the electrical characteristics of the 2 interrupt pins (open-drain/push-pull and level/edge triggering). See the datasheet for details.

Parameters
devThe device context.
Returns
A bitmask of BMA250E_INT_OUT_CTRL_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_output_control ( const bma250e_context  dev,
uint8_t  bits 
)

Set the Interrupt output control register. This register allows determining the electrical characteristics of the 2 interrupt pins (open-drain/push-pull and level/edge triggering). See the datasheet for details.

Parameters
devThe device context.
bitsA bitmask of BMA250E_INT_OUT_CTRL_BITS_T bits.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_clear_interrupt_latches ( const bma250e_context  dev)

Clear all latched interrupts. See the datasheet for details.

Parameters
devThe device context.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

BMA250E_RST_LATCH_T bma250e_get_interrupt_latch_behavior ( const bma250e_context  dev)

Return the current interrupt latching behavior. See the datasheet for details.

Parameters
devThe device context.
Returns
One of the BMA250E_RST_LATCH_T values.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_interrupt_latch_behavior ( const bma250e_context  dev,
BMA250E_RST_LATCH_T  latch 
)

Set the current interrupt latching behavior. See the datasheet for details.

Parameters
devThe device context.
latchOne of the BMA250E_RST_LATCH_T values.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_status0 ( const bma250e_context  dev)

Return the interrupt status 0 register. These registers indicate which interrupts have been triggered. See the datasheet for details.

Parameters
devThe device context.
Returns
a bitmask of BMA250E_INT_STATUS_0_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_status1 ( const bma250e_context  dev)

Return the interrupt status 1 register. See the datasheet for details.

Parameters
devThe device context.
Returns
a bitmask of BMA250E_INT_STATUS_1_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_status2 ( const bma250e_context  dev)

Return the interrupt status 2 register. See the datasheet for details.

Parameters
devThe device context.
Returns
a bitmask of BMA250E_INT_STATUS_2_BITS_T bits.

Here is the call graph for this function:

Here is the caller graph for this function:

uint8_t bma250e_get_interrupt_status3_bits ( const bma250e_context  dev)

Return the interrupt status 3 register bitfields. See the datasheet for details. The Orientation value is not returned by this function, see bma250e_get_interrupt_status3_orientation() for that information.

Parameters
devThe device context.
Returns
a bitmask of BMA250E_INT_STATUS_3_BITS_T bits only.

Here is the call graph for this function:

Here is the caller graph for this function:

BMA250E_ORIENT_T bma250e_get_interrupt_status3_orientation ( const bma250e_context  dev)

Return the interrupt status 3 register Orientation value. See the datasheet for details.

Parameters
devThe device context.
Returns
One of the BMA250E_ORIENT_T values.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_enable_register_shadowing ( const bma250e_context  dev,
bool  shadow 
)

Enable shadowing of the accelerometer output registers. When enabled, a read of an axis LSB register automatically locks the MSB register of that axis until it has been read. This is usually a good thing to have enabled. bma250e_devinit() enables this by default. If disabled, then it becomes possible for part of an axis value to change while another part is being read, causing inconsistent data.

Parameters
devThe device context.
shadowtrue to enable axis register shadowing, false otherwise.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_enable_output_filtering ( const bma250e_context  dev,
bool  filter 
)

Enable filtering of the accelerometer axis data. bma250e_devinit() enables this by default. If disabled, then accelerometer data that is read will be raw and unfiltered (rated NC-17, mature audiences only). See the datasheet for details.

Parameters
devThe device context.
filtertrue to enable filtering, false to disable.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_set_low_power_mode2 ( const bma250e_context  dev)

Make sure low power mode config (LPM2) is set in case we later go into the low power or suspend power modes. LPM1 mode (the default) requires drastically slowed register writes which we cannot handle.

Parameters
devThe device context.
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

upm_result_t bma250e_install_isr ( const bma250e_context  dev,
BMA250E_INTERRUPT_PINS_T  intr,
int  gpio,
mraa_gpio_edge_t  level,
void(*)(void *)  isr,
void *  arg 
)

install an interrupt handler.

Parameters
devThe device context.
intrOne of the BMA250E_INTERRUPT_PINS_T values specifying which interrupt pin you are installing.
gpioGPIO pin to use as interrupt pin
levelThe interrupt trigger level (one of the mraa_gpio_edge_t values). Make sure that you have configured the interrupt pin properly for whatever level you choose.
isrThe interrupt handler, accepting a void * argument
argThe argument to pass to the interrupt handler
Returns
UPM result.

Here is the call graph for this function:

Here is the caller graph for this function:

void bma250e_uninstall_isr ( const bma250e_context  dev,
BMA250E_INTERRUPT_PINS_T  intr 
)

uninstall a previously installed interrupt handler

Parameters
devThe device context.
intrOne of the BMA250E_INTERRUPT_PINS_T values specifying which interrupt pin you are removing.

Here is the caller graph for this function:

uint8_t bma250e_read_reg ( const bma250e_context  dev,
uint8_t  reg 
)

Read a register.

Parameters
devThe device context.
regThe register to read.
Returns
The value of the register.

Here is the caller graph for this function:

int bma250e_read_regs ( const bma250e_context  dev,
uint8_t  reg,
uint8_t *  buffer,
int  len 
)

Read contiguous registers into a buffer.

Parameters
devThe device context.
bufferThe buffer to store the results.
lenThe number of registers to read.
Returns
The number of bytes read, or -1 on error.

Here is the caller graph for this function:

upm_result_t bma250e_write_reg ( const bma250e_context  dev,
uint8_t  reg,
uint8_t  val 
)

Write to a register.

Parameters
devThe device context.
regThe register to write to.
valThe value to write.
Returns
UPM result.

Here is the caller graph for this function:

Typedef Documentation

Device context