Lin Team / Mbed OS ADXL355
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADXL355.h Source File

ADXL355.h

Go to the documentation of this file.
00001 /*!
00002  *****************************************************************************
00003  * @file:    ADXL355.h
00004  * @brief:   ADXL355 accelerometer IC
00005  * @version: $Revision$
00006  * @date:    $Date$
00007  *-----------------------------------------------------------------------------
00008  *
00009 Copyright (c) 2016-2017 Analog Devices, Inc.
00010 
00011 All rights reserved.
00012 
00013 Redistribution and use in source and binary forms, with or without modification,
00014 are permitted provided that the following conditions are met:
00015   - Redistributions of source code must retain the above copyright notice,
00016     this list of conditions and the following disclaimer.
00017   - Redistributions in binary form must reproduce the above copyright notice,
00018     this list of conditions and the following disclaimer in the documentation
00019     and/or other materials provided with the distribution.
00020   - Modified versions of the software must be conspicuously marked as such.
00021   - This software is licensed solely and exclusively for use with processors
00022     manufactured by or for Analog Devices, Inc.
00023   - This software may not be combined or merged with other code in any manner
00024     that would cause the software to become subject to terms and conditions
00025     which differ from those listed here.
00026   - Neither the name of Analog Devices, Inc. nor the names of its
00027     contributors may be used to endorse or promote products derived
00028     from this software without specific prior written permission.
00029   - The use of this software may or may not infringe the patent rights of one
00030     or more patent holders.  This license does not release you from the
00031     requirement that you obtain separate licenses from these patent holders
00032     to use this software.
00033 
00034 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND ANY
00035 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
00036 TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
00037 NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00038 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES
00039 (INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL
00040 PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00041 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00042 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00043 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00044 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00045  *
00046  *****************************************************************************/
00047 
00048 #ifndef ADXL355_H_
00049 #define ADXL355_H_
00050 
00051 /********************************* Definitions ********************************/
00052 
00053 /* ADXL355 registers addresses */
00054 #define DEVID_AD                 0x00
00055 #define DEVID_MST                0x01
00056 #define PARTID                   0x02
00057 #define REVID                    0x03
00058 #define STATUS                   0x04
00059 #define FIFO_ENTRIES             0x05
00060 #define TEMP2                    0x06
00061 #define TEMP1                    0x07
00062 #define XDATA3                   0x08
00063 #define XDATA2                   0x09
00064 #define XDATA1                   0x0A
00065 #define YDATA3                   0x0B
00066 #define YDATA2                   0x0C
00067 #define YDATA1                   0x0D
00068 #define ZDATA3                   0x0E
00069 #define ZDATA2                   0x0F
00070 #define ZDATA1                   0x10
00071 #define FIFO_DATA                0x11
00072 #define OFFSET_X_H               0x1E
00073 #define OFFSET_X_L               0x1F
00074 #define OFFSET_Y_H               0x20
00075 #define OFFSET_Y_L               0x21
00076 #define OFFSET_Z_H               0x22
00077 #define OFFSET_Z_L               0x23
00078 #define ACT_EN                   0x24
00079 #define ACT_THRESH_H             0x25
00080 #define ACT_THRESH_L             0x26
00081 #define ACT_COUNT                0x27
00082 #define FILTER                   0x28
00083 #define FIFO_SAMPLES             0x29
00084 #define INT_MAP                  0x2A
00085 #define SYNC                     0x2B
00086 #define RANGE                    0x2C
00087 #define POWER_CTL                0x2D
00088 #define SELF_TEST                0x2E
00089 #define RESET                    0x2F
00090 
00091 /**************************** Configuration parameters **********************/
00092 
00093 /* Temperature parameters */
00094 #define ADXL355_TEMP_BIAS       (float)1852.0      /* Accelerometer temperature bias(in ADC codes) at 25 Deg C */
00095 #define ADXL355_TEMP_SLOPE      (float)-9.05       /* Accelerometer temperature change from datasheet (LSB/degC) */
00096 
00097 /* Accelerometer parameters */
00098 #define ADXL_RANGE     2     /* ADXL362 sensitivity: 2, 4, 8 [g] */
00099 
00100 #define ACT_VALUE          50     /* Activity threshold value */
00101 
00102 #define INACT_VALUE        50     /* Inactivity threshold value */
00103 
00104 #define ACT_TIMER          100    /* Activity timer value in ms */
00105 
00106 #define INACT_TIMER        10     /* Inactivity timer value in seconds */
00107 
00108 /****************************** Global Data ***********************************/
00109 
00110 extern volatile int32_t i32SensorX;
00111 extern volatile int32_t i32SensorY;
00112 extern volatile int32_t i32SensorZ;
00113 
00114 extern volatile uint32_t ui32SensorX;
00115 extern volatile uint32_t ui32SensorY;
00116 extern volatile uint32_t ui32SensorZ;
00117 extern volatile uint32_t ui32SensorT;
00118 
00119 extern volatile uint32_t ui32timer_counter;
00120 
00121 
00122 /*************************** Functions prototypes *****************************/
00123 
00124 void ADXL355_Init(void);
00125 void ADXL355_Start_Sensor(void);
00126 void ADXL355_Stop_Sensor(void);
00127 void ADXL355_Data_Scan(void);
00128 int32_t ADXL355_Acceleration_Data_Conversion (uint32_t ui32SensorData);
00129 
00130 #endif /* ADXL355_H_ */