LCD implementation of our project.
Dependencies: mbed mbed-rtos MLX90614
MKI124V1.h@10:97389d774ae1, 2015-06-03 (annotated)
- Committer:
- ovidiup13
- Date:
- Wed Jun 03 17:42:47 2015 +0000
- Revision:
- 10:97389d774ae1
- Parent:
- 6:49a007861c76
working version, comment out thermo in main;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ovidiup13 | 6:49a007861c76 | 1 | // Defines for the MEMS sensors on the STEVAL-MKI124V1 board |
ovidiup13 | 6:49a007861c76 | 2 | // Liam Goudge. March 2014 |
ovidiup13 | 6:49a007861c76 | 3 | |
ovidiup13 | 6:49a007861c76 | 4 | // LPS331AP MEMS pressure and temperature sensor |
ovidiup13 | 6:49a007861c76 | 5 | #define LPS331addr 0xBA // I2C address of the sensor for writes (line SAO is tied high on this board so bit 1=1. Note this may not work on other boards). |
ovidiup13 | 6:49a007861c76 | 6 | |
ovidiup13 | 6:49a007861c76 | 7 | #define pWHO_AM_I 0x0F // "ping" register. Device will respond even when in sleep mode |
ovidiup13 | 6:49a007861c76 | 8 | #define pRES_CONF 0x10 // Reset value is 0x7A (512 pressure samples and 128 temperature samples) |
ovidiup13 | 6:49a007861c76 | 9 | #define pCTRL_REG1 0x20 |
ovidiup13 | 6:49a007861c76 | 10 | #define pCTRL_REG2 0x21 |
ovidiup13 | 6:49a007861c76 | 11 | #define pCTRL_REG3 0x22 |
ovidiup13 | 6:49a007861c76 | 12 | #define pPRESS_OUT_XL 0x28 |
ovidiup13 | 6:49a007861c76 | 13 | #define pPRESS_OUT_L 0x29 |
ovidiup13 | 6:49a007861c76 | 14 | #define pPRESS_OUT_H 0x2A |
ovidiup13 | 6:49a007861c76 | 15 | #define pTEMP_OUT_L 0x2B // Temperature data. 2's complement. Device will respond when in sleep mode |
ovidiup13 | 6:49a007861c76 | 16 | #define pTEMP_OUT_H 0x2C |
ovidiup13 | 6:49a007861c76 | 17 | |
ovidiup13 | 6:49a007861c76 | 18 | // LSM303DLHC MEMS ascceleratometer, magnetometer and temperature sensor |
ovidiup13 | 6:49a007861c76 | 19 | #define LSM303_m 0x3C // I2C base address of the magnetometer sensor |
ovidiup13 | 6:49a007861c76 | 20 | #define LSM303_a 0x32 // I2C base address of the accelerometer sensor |
ovidiup13 | 6:49a007861c76 | 21 | |
ovidiup13 | 6:49a007861c76 | 22 | // Magnetometer registers |
ovidiup13 | 6:49a007861c76 | 23 | #define mCRA_REG_M 0x00 // Magnetic sensor configuration register A |
ovidiup13 | 6:49a007861c76 | 24 | #define mCRB_REG_M 0x01 // Magnetic sensor configuration register B |
ovidiup13 | 6:49a007861c76 | 25 | #define mMR_REG_M 0x02 // Magnetometer mode register |
ovidiup13 | 6:49a007861c76 | 26 | #define mOUT_X_H_M 0x03 // X-axis magnetic field data High byte |
ovidiup13 | 6:49a007861c76 | 27 | #define mOUT_X_L_M 0x04 // X-axis magnetic field data Low byte |
ovidiup13 | 6:49a007861c76 | 28 | #define mOUT_Z_H_M 0x05 // Z-axis magnetic field data High byte |
ovidiup13 | 6:49a007861c76 | 29 | #define mOUT_Z_L_M 0x06 // Z-axis magnetic field data Low byte |
ovidiup13 | 6:49a007861c76 | 30 | #define mOUT_Y_H_M 0x07 // Y-axis magnetic field data High byte |
ovidiup13 | 6:49a007861c76 | 31 | #define mOUT_Y_L_M 0x08 // Y-axis magnetic field data Low byte |
ovidiup13 | 6:49a007861c76 | 32 | #define mSR_REG_M 0x09 // Magnetometer status register |
ovidiup13 | 6:49a007861c76 | 33 | #define mIRA_REG_M 0x0A // ID register A. Should read 0x48 |
ovidiup13 | 6:49a007861c76 | 34 | #define mCTRL_REG1_A 0x20 |
ovidiup13 | 6:49a007861c76 | 35 | #define mTEMP_OUT_H_M 0x31 // Magnetometer temperature register High byte |
ovidiup13 | 6:49a007861c76 | 36 | #define mTEMP_OUT_L_M 0x32 // Magnetometer temperature register Low byte |
ovidiup13 | 6:49a007861c76 | 37 | |
ovidiup13 | 6:49a007861c76 | 38 | // Accelerometer registers |
ovidiup13 | 6:49a007861c76 | 39 | #define aCTRL_REG1_A 0x20 // Accelerometer output data rate ODR, low power modes etc |
ovidiup13 | 6:49a007861c76 | 40 | #define aCTRL_REG4_A 0x23 // Accelerometer full scale selection etc |
ovidiup13 | 6:49a007861c76 | 41 | #define aOUT_X_L_A 0x28 // Accelerometer X axis low byte |
ovidiup13 | 6:49a007861c76 | 42 | #define aOUT_X_H_A 0x29 // Accelerometer X axis high byte |
ovidiup13 | 6:49a007861c76 | 43 | #define aOUT_Y_L_A 0x2A // Accelerometer Y axis low byte |
ovidiup13 | 6:49a007861c76 | 44 | #define aOUT_Y_H_A 0x2B // Accelerometer Y axis high byte |
ovidiup13 | 6:49a007861c76 | 45 | #define aOUT_Z_L_A 0x2C // Accelerometer Z axis low byte |
ovidiup13 | 6:49a007861c76 | 46 | #define aOUT_Z_H_A 0x2D // Accelerometer Z axis high byte |
ovidiup13 | 6:49a007861c76 | 47 | |
ovidiup13 | 6:49a007861c76 | 48 | // L3GD20 MEMS gyro. 3 axis angular rate sensor |
ovidiup13 | 6:49a007861c76 | 49 | #define L3GD20_ADDR 0xD6 // I2C base address of the gyro |
ovidiup13 | 6:49a007861c76 | 50 | |
ovidiup13 | 6:49a007861c76 | 51 | #define gWHO_AM_I 0x0F // Ping register. Response is 0xD4. Responds even when device is off |
ovidiup13 | 6:49a007861c76 | 52 | #define gCTRL_REG1 0x20 // Sets Output Data Rate, Bandwidth and Power mode |
ovidiup13 | 6:49a007861c76 | 53 | #define gCTRL_REG4 0x23 // |
ovidiup13 | 6:49a007861c76 | 54 | #define gOUT_TEMP 0x26 // Temperature data. 8 bit resolution |
ovidiup13 | 6:49a007861c76 | 55 | #define gOUT_X_L 0x28 // X-axis angular rate low byte expressed as 2's complement |
ovidiup13 | 6:49a007861c76 | 56 | #define gOUT_X_H 0x29 // X-axis angular rate high byte |
ovidiup13 | 6:49a007861c76 | 57 | #define gOUT_Y_L 0x2A |
ovidiup13 | 6:49a007861c76 | 58 | #define gOUT_Y_H 0x2B |
ovidiup13 | 6:49a007861c76 | 59 | #define gOUT_Z_L 0x2C |
ovidiup13 | 6:49a007861c76 | 60 | #define gOUT_Z_H 0x2D |
ovidiup13 | 6:49a007861c76 | 61 | |
ovidiup13 | 6:49a007861c76 | 62 | |
ovidiup13 | 6:49a007861c76 | 63 | // Structs |
ovidiup13 | 6:49a007861c76 | 64 | typedef struct{ |
ovidiup13 | 6:49a007861c76 | 65 | float pitch; |
ovidiup13 | 6:49a007861c76 | 66 | float roll; |
ovidiup13 | 6:49a007861c76 | 67 | int16_t aX; |
ovidiup13 | 6:49a007861c76 | 68 | int16_t aY; |
ovidiup13 | 6:49a007861c76 | 69 | int16_t aZ; |
ovidiup13 | 6:49a007861c76 | 70 | float heading; |
ovidiup13 | 6:49a007861c76 | 71 | float tempC; |
ovidiup13 | 6:49a007861c76 | 72 | float pressuremB; |
ovidiup13 | 6:49a007861c76 | 73 | } SensorState_t; |
ovidiup13 | 6:49a007861c76 | 74 | |
ovidiup13 | 6:49a007861c76 | 75 | |
ovidiup13 | 6:49a007861c76 | 76 | |
ovidiup13 | 6:49a007861c76 | 77 | typedef struct{ |
ovidiup13 | 6:49a007861c76 | 78 | float x; |
ovidiup13 | 6:49a007861c76 | 79 | float y; |
ovidiup13 | 6:49a007861c76 | 80 | float z; |
ovidiup13 | 6:49a007861c76 | 81 | int16_t aX; |
ovidiup13 | 6:49a007861c76 | 82 | int16_t aY; |
ovidiup13 | 6:49a007861c76 | 83 | int16_t aZ; |
ovidiup13 | 6:49a007861c76 | 84 | }Result_avrg; |