mems_regs.h

Go to the documentation of this file.
00001 /** @file hal/micro/mems_regs.h
00002  *  @brief stm32w108 mems registers 
00003  *  
00004  * <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved.        -->
00005  */
00006 
00007 #ifndef _MEMS_REGS_H_
00008 #define _MEMS_REGS_H_
00009 
00010 //---Size of MEMs data---
00011 #define MEMS_DATA_SIZE 6
00012 
00013 //---address of slave I want to communicate with---
00014 #define kLIS3L02DQ_SLAVE_ADDR    0x38
00015 
00016 //-----------------------------------------------------------------------------
00017 //---accelerometer register addresses---
00018 #define OFFSET_X         0x16
00019 #define OFFSET_Y         0x17
00020 #define OFFSET_Z         0x18
00021 #define GAIN_X           0x19
00022 #define GAIN_Y           0x1A
00023 #define GAIN_Z           0x1B
00024 #define CTRL_REG1        0x20
00025 #define CTRL_REG2        0x21
00026 #define STATUS_REG       0x27
00027 #define OUTX_L           0x28
00028 #define OUTX_H           0x29
00029 #define OUTY_L           0x2A
00030 #define OUTY_H           0x2B
00031 #define OUTZ_L           0x2C
00032 #define OUTZ_H           0x2D
00033 #define FF_WU_CFG        0x30
00034 #define FF_WU_SRC        0x31
00035 #define FF_WU_ACK        0x32
00036 #define FF_WU_THS_L      0x34
00037 #define FF_WU_THS_H      0x35
00038 #define FF_WU_DURATION   0x36
00039 #define DD_CFG           0x38
00040 #define DD_SRC           0x39
00041 #define DD_ACK           0x3A
00042 #define DD_THSI_L        0x3C
00043 #define DD_THSI_H        0x3D
00044 #define DD_THSE_L        0x3E
00045 #define DD_THSE_H        0x3F
00046 
00047 // Communication control settings
00048 // I2C
00049 #define REPETIR          0x80
00050 // SPI
00051 #define MEMS_SPI_WRITE   0x00
00052 #define MEMS_SPI_READ    0x80
00053 #define MEMS_SPI_MULTIPLE_BYTES 0x40
00054 
00055 //-----------------------------------------------------------------------------
00056 //---Settings for CTRL_REG1---
00057 
00058 // Power Down Control (PD)
00059 #define LIS_PD_OFF 0x00
00060 #define LIS_PD_ON  0x40
00061 
00062 // Decimation Factor Control (DF)
00063 #define LIS_DF_BY128 0x00
00064 #define LIS_DF_BY64  0x10
00065 #define LIS_DF_BY32  0x20
00066 #define LIS_DF_BY8   0x30
00067 
00068 // Self Test
00069 #define LIS_ST_NORMAL 0x00
00070 #define LIS_ST_TEST   0x08
00071 
00072 // Enable Axis
00073 #define LIS_EA_ALL    0x07
00074 
00075 //-----------------------------------------------------------------------------
00076 //---Settings for CTRL_REG2---
00077 
00078 // Full Scale (FS)
00079 #define LIS_FS_2G 0x00
00080 #define LIS_FS_6G 0x80
00081 
00082 // Block Data Update (BDU)
00083 #define LIS_BDU_CONTINUOUS 0x00
00084 #define LIS_BDU_WAIT       0x40
00085 
00086 // Big/Little Endian Selection (BLE)
00087 #define LIS_BLE_LE 0x00
00088 #define LIS_BLE_BE 0x20
00089 
00090 // Data Alignment Selection DAS
00091 #define LIS_DAS_12BIT 0x00
00092 #define LIS_DAS_16BIT 0x01
00093 
00094 // Interrupt Enable
00095 #define LIS_INTR_DISABLE 0x00
00096 #define LIS_INTR_ENABLE  0x08
00097 
00098 // Data Ready Enable
00099 #define LIS_DRDY_DISABLE 0x00
00100 #define LIS_DRDY_ENABLE  0x04
00101 
00102 //-----------------------------------------------------------------------------
00103 
00104 #define LIS_BLE_XX LIS_BLE_BE
00105 
00106 
00107 /* Private Functions Prototypes ----------------------------------------------*/
00108 
00109 //*********************i2c_read_reg***********************//
00110 //----------Reads a register on the I2C target------------//
00111 //------slave addr is the is the I2C target device--------//
00112 //-reg_addr is the address of the register to be written--//
00113 //-pBuffer is the storage destination for the read data---//
00114 //-NoOfBytes is the amount of data to read----------------//
00115 int8u i2c_read_reg (int8u slave_addr, int8u reg_addr, int8u *pBuffer, int8u NoOfBytes);
00116 
00117 //*********************i2c_write_reg**********************//
00118 //----------Writes a register on the I2C target-----------//
00119 //------slave addr is the is the I2C target device--------//
00120 //-reg_addr is the address of the register to be written--//
00121 //-reg_value is the value of the register to be written---//
00122 int8u i2c_write_reg (int8u slave_addr, int8u reg_addr, int8u reg_value);
00123 
00124 #endif /* _MEMS_REGS_H_ */
00125 

Generated on Mon Apr 11 14:23:40 2011 for Contiki 2.5 by  doxygen 1.6.1