XDK API  3.6.0
Documentation
Macros | Functions | Variables
Accelerometer.c File Reference

This module contains the implementation of Easy to use API's for accelerometer sensor. More...

#include "BCDS_SensorsInfo.h"
#include "Accelerometer.h"
#include "BCDS_Accelerometer.h"
#include "BCDS_Bmi160Utils.h"
#include "BCDS_Bma280Utils.h"
#include <bmi160.h>
#include <bma2x2.h>
#include "FreeRTOS.h"
#include "timers.h"
+ Include dependency graph for Accelerometer.c:

Macros

#define BCDS_MODULE_ID   BCDS_SENSORS_ID_ACCELEROMETER
 
#define BMA_INTERRUPT_CHANNEL_1   UINT8_C(1)
 
#define BMA_INTERRUPT_CHANNEL_2   UINT8_C(2)
 

Functions

Retcode_T Accelerometer_configInterrupt (Accelerometer_HandlePtr_T handle, Accelerometer_InterruptChannel_T channel, Accelerometer_InterruptType_T interruptType, void *InterruptTypeParameters)
 Configures the accelerometer Interrupt referenced by the passed handle. More...
 
Retcode_T Accelerometer_deInit (Accelerometer_HandlePtr_T handle)
 DeInitializes the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_disableInterrupt (Accelerometer_HandlePtr_T handle, Accelerometer_InterruptChannel_T channel, Accelerometer_InterruptType_T interruptType)
 Disable Interrupt type on the specified channel. More...
 
Retcode_T Accelerometer_getBandwidth (Accelerometer_HandlePtr_T handle, Accelerometer_BandwidthPtr_T bandwidth)
 Reads the bandwidth for the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_getMode (Accelerometer_HandlePtr_T handle, Accelerometer_PowermodePtr_T powermode)
 get the powermode for the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_getRange (Accelerometer_HandlePtr_T handle, Accelerometer_RangePtr_T range)
 Reads the Range for the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_getSleepDuration (Accelerometer_HandlePtr_T handle, Accelerometer_SleepDurationPtr_T lowPowerModeSleepDuration)
 Reads the last set sleep duration of accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_init (Accelerometer_HandlePtr_T handle)
 Initializes the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_readXyzGValue (Accelerometer_HandlePtr_T handle, Accelerometer_XyzDataPtr_T accelData)
 Reads an milli Gravity values from the accelerometer referenced by the passed handle for the UG correction. More...
 
Retcode_T Accelerometer_readXyzLsbValue (Accelerometer_HandlePtr_T handle, Accelerometer_XyzDataPtr_T accelData)
 Reads an LSB xyz value from the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_regDeferredCallback (Accelerometer_HandlePtr_T handle, Accelerometer_InterruptChannel_T intChannel, accelDeferredTimeCallback deferredCallback)
 Register deferred user callback function on the specified channel to indicate user that interrupt has occurred not immediately but at deferred context of RTOS. More...
 
Retcode_T Accelerometer_regRealTimeCallback (Accelerometer_HandlePtr_T handle, Accelerometer_InterruptChannel_T intChannel, accelRealTimeCallback realTimeCallback)
 Register real time user callback function on the specified channel to indicate user that interrupt has occurred. More...
 
Retcode_T Accelerometer_setBandwidth (Accelerometer_HandlePtr_T handle, Accelerometer_Bandwidth_T bandwidth)
 Sets the bandwidth for the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_setMode (Accelerometer_HandlePtr_T handle, Accelerometer_Powermode_T powermode)
 Sets the powermode for the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_setRange (Accelerometer_HandlePtr_T handle, Accelerometer_Range_T range)
 Sets the Range for the accelerometer referenced by the passed handle. More...
 
Retcode_T Accelerometer_setSleepDuration (Accelerometer_HandlePtr_T handle, Accelerometer_SleepDuration_T lowPowerModeSleepDuration)
 Sets the SleepDuration for the accelerometer referenced by the passed handle. More...
 
static Retcode_T bma2x2LibErrorMapping (BMA2x2_RETURN_FUNCTION_TYPE BMA2X2_libReturn)
 
static void bmaIsrCallback (uint32_t channel, uint32_t edge)
 BMA280 driver callback function for channel2 that will be called during ISR, when deferred application callback is registered. This is responsible to defer the context. More...
 
static Retcode_T bmi160LibErrorMapping (BMI160_RETURN_FUNCTION_TYPE BMI160_libReturn)
 
static int8_t mappingEnumForGetFunctions (uint8_t start, uint8_t end, uint8_t getValueToBeTransalated, const uint8_t *lookUpTablePtr)
 

Variables

Accelerometer_HandlePtr_T Bma280Handle = NULL
 
static uint8_t bmaRangeValue = BMA2X2_SUPPORT_2G_RANGE
 
static uint8_t bmiRangeValue = BMI160_SUPPORT_2G_RANGE
 
static const uint8_t bwLookUpTable [ACCELEROMETER_BANDWIDTH_OUT_OF_RANGE]
 
static const uint8_t getmodeLookUpTable [ACCELEROMETER_POWERMODE_OUT_OF_RANGE]
 
static const uint8_t modeLookUpTable [ACCELEROMETER_POWERMODE_OUT_OF_RANGE]
 
static const uint8_t rangeLookUpTable [ACCELEROMETER_RANGE_OUT_OF_BOUND]
 
static const uint8_t rangeValueLookUpTable [ACCELEROMETER_RANGE_OUT_OF_BOUND]
 
static const uint8_t sleepDurationLookUpTable [ACCELEROMETER_SLEEP_DURATION_OUT_OF_RANGE]
 

Macro Definition Documentation

#define BCDS_MODULE_ID   BCDS_SENSORS_ID_ACCELEROMETER
#define BMA_INTERRUPT_CHANNEL_1   UINT8_C(1)
#define BMA_INTERRUPT_CHANNEL_2   UINT8_C(2)

Function Documentation

static Retcode_T bma2x2LibErrorMapping ( BMA2x2_RETURN_FUNCTION_TYPE  BMA2X2_libReturn)
static

+ Here is the caller graph for this function:

static void bmaIsrCallback ( uint32_t  channel,
uint32_t  edge 
)
static
Parameters
[in]channelchannel at which interrupt has occurred
[in]edgeedge at which interrupt has occurred falling(0) or raising edge(1)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Retcode_T bmi160LibErrorMapping ( BMI160_RETURN_FUNCTION_TYPE  BMI160_libReturn)
static

+ Here is the caller graph for this function:

static int8_t mappingEnumForGetFunctions ( uint8_t  start,
uint8_t  end,
uint8_t  getValueToBeTransalated,
const uint8_t *  lookUpTablePtr 
)
static

+ Here is the caller graph for this function:

Variable Documentation

uint8_t bmaRangeValue = BMA2X2_SUPPORT_2G_RANGE
static
uint8_t bmiRangeValue = BMI160_SUPPORT_2G_RANGE
static
const uint8_t bwLookUpTable[ACCELEROMETER_BANDWIDTH_OUT_OF_RANGE]
static
Initial value:
=
{
UINT8_C(BMA2x2_BW_7_81HZ),
UINT8_C(BMA2x2_BW_125HZ),
UINT8_C(BMA2x2_BW_250HZ),
UINT8_C(BMA2x2_BW_500HZ),
}
#define BMI160_ACCEL_OUTPUT_DATA_RATE_100HZ
Definition: bmi160.h:3168
#define BMI160_ACCEL_OUTPUT_DATA_RATE_6_25HZ
Definition: bmi160.h:3164
#define BMA2x2_BW_31_25HZ
Definition: bma2x2.h:1692
#define BMI160_ACCEL_OUTPUT_DATA_RATE_1_56HZ
Definition: bmi160.h:3162
#define BMI160_ACCEL_OUTPUT_DATA_RATE_0_78HZ
Definition: bmi160.h:3161
#define BMA2x2_BW_125HZ
Definition: bma2x2.h:1696
#define BMI160_ACCEL_OUTPUT_DATA_RATE_3_12HZ
Definition: bmi160.h:3163
#define BMI160_ACCEL_OUTPUT_DATA_RATE_25HZ
Definition: bmi160.h:3166
#define BMA2x2_BW_250HZ
Definition: bma2x2.h:1698
#define BMA2x2_BW_62_50HZ
Definition: bma2x2.h:1694
#define BMA2x2_BW_15_63HZ
Definition: bma2x2.h:1690
#define BMI160_ACCEL_OUTPUT_DATA_RATE_12_5HZ
Definition: bmi160.h:3165
#define BMI160_ACCEL_OUTPUT_DATA_RATE_50HZ
Definition: bmi160.h:3167
#define BMA2x2_BW_7_81HZ
Definition: bma2x2.h:1688
#define BMA2x2_BW_500HZ
Definition: bma2x2.h:1700
const uint8_t getmodeLookUpTable[ACCELEROMETER_POWERMODE_OUT_OF_RANGE]
static
Initial value:
=
{
}
#define BMA2x2_MODE_SUSPEND
Definition: bma2x2.h:1772
#define BMI160_ACCEL_SUSPEND
Definition: bmi160.h:3500
#define BMA2x2_MODE_LOWPOWER1
Definition: bma2x2.h:1771
#define BMA2x2_MODE_NORMAL
Definition: bma2x2.h:1770
#define BMI160_ACCEL_LOW_POWER
Definition: bmi160.h:3502
#define BMA2x2_MODE_STANDBY
Definition: bma2x2.h:1775
#define BMI160_ACCEL_NORMAL_MODE
Definition: bmi160.h:3501
#define BMA2x2_MODE_LOWPOWER2
Definition: bma2x2.h:1774
#define BMA2x2_MODE_DEEP_SUSPEND
Definition: bma2x2.h:1773
const uint8_t modeLookUpTable[ACCELEROMETER_POWERMODE_OUT_OF_RANGE]
static
Initial value:
=
{
UINT8_C(ACCEL_LOWPOWER),
UINT8_C(ACCEL_SUSPEND),
}
#define ACCEL_MODE_NORMAL
Definition: bmi160.h:3496
#define BMA2x2_MODE_SUSPEND
Definition: bma2x2.h:1772
#define BMA2x2_MODE_LOWPOWER1
Definition: bma2x2.h:1771
#define BMA2x2_MODE_NORMAL
Definition: bma2x2.h:1770
#define ACCEL_SUSPEND
Definition: bmi160.h:3498
#define BMA2x2_MODE_STANDBY
Definition: bma2x2.h:1775
#define ACCEL_LOWPOWER
Definition: bmi160.h:3497
#define BMA2x2_MODE_LOWPOWER2
Definition: bma2x2.h:1774
#define BMA2x2_MODE_DEEP_SUSPEND
Definition: bma2x2.h:1773
const uint8_t rangeLookUpTable[ACCELEROMETER_RANGE_OUT_OF_BOUND]
static
Initial value:
=
{
UINT8_C(BMA2x2_RANGE_2G),
UINT8_C(BMA2x2_RANGE_4G),
UINT8_C(BMA2x2_RANGE_8G),
UINT8_C(BMA2x2_RANGE_16G),
}
#define BMA2x2_RANGE_16G
Definition: bma2x2.h:1684
#define BMA2x2_RANGE_8G
Definition: bma2x2.h:1682
#define BMI160_ACCEL_RANGE_2G
Definition: bmi160.h:3153
#define BMI160_ACCEL_RANGE_8G
Definition: bmi160.h:3155
#define BMA2x2_RANGE_4G
Definition: bma2x2.h:1680
#define BMA2x2_RANGE_2G
Definition: bma2x2.h:1678
#define BMI160_ACCEL_RANGE_4G
Definition: bmi160.h:3154
const uint8_t rangeValueLookUpTable[ACCELEROMETER_RANGE_OUT_OF_BOUND]
static
Initial value:
= {
}
#define BMI160_SUPPORT_4G_RANGE
Definition: Accelerometer.h:66
#define BMI160_SUPPORT_8G_RANGE
Definition: Accelerometer.h:67
#define BMI160_SUPPORT_2G_RANGE
Definition: Accelerometer.h:65
#define BMA2X2_SUPPORT_4G_RANGE
Definition: Accelerometer.h:62
#define BMA2X2_SUPPORT_16G_RANGE
Definition: Accelerometer.h:64
#define BMA2X2_SUPPORT_2G_RANGE
Definition: Accelerometer.h:61
#define BMA2X2_SUPPORT_8G_RANGE
Definition: Accelerometer.h:63
const uint8_t sleepDurationLookUpTable[ACCELEROMETER_SLEEP_DURATION_OUT_OF_RANGE]
static
Initial value:
=
{
}
#define BMA2x2_SLEEP_DURN_50MS
Definition: bma2x2.h:1722
#define BMA2x2_SLEEP_DURN_4MS
Definition: bma2x2.h:1714
#define BMA2x2_SLEEP_DURN_10MS
Definition: bma2x2.h:1718
#define BMA2x2_SLEEP_DURN_0_5MS
Definition: bma2x2.h:1708
#define BMA2x2_SLEEP_DURN_2MS
Definition: bma2x2.h:1712
#define BMA2x2_SLEEP_DURN_500MS
Definition: bma2x2.h:1726
#define BMA2x2_SLEEP_DURN_25MS
Definition: bma2x2.h:1720
#define BMA2x2_SLEEP_DURN_100MS
Definition: bma2x2.h:1724
#define BMA2x2_SLEEP_DURN_6MS
Definition: bma2x2.h:1716
#define BMA2x2_SLEEP_DURN_1MS
Definition: bma2x2.h:1710

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:48 by doxygen 1.8.8