Fork of original LPS331 library Changed the I2C address to 0xBA

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LPS331.h Source File

LPS331.h

00001 //**********************
00002 // LPS331.h for mbed
00003 //
00004 // (C)Copyright 2014 All rights reserved by Y.Onodera
00005 // http://einstlab.web.fc2.com
00006 //**********************
00007 
00008 #ifndef LPS331_H_
00009 #define LPS331_H_
00010 
00011 #define LPS331_ADDR 0xBA
00012 #define LPS331_REF_P_XL 0x08
00013 #define LPS331_REF_P_L  0x09
00014 #define LPS331_REF_P_H  0x0A
00015 #define LPS331_WHO_AM_I 0x0F
00016 #define LPS331_RES_CONF 0x10
00017 #define LPS331_CTRL_REG1    0x20
00018 #define LPS331_CTRL_REG2    0x21
00019 #define LPS331_CTRL_REG3    0x22
00020 #define LPS331_INT_CFG_REG  0x23
00021 #define LPS331_INT_SOURCE_REG   0x24
00022 #define LPS331_THS_P_LOW_REG    0x25
00023 #define LPS331_THS_P_HIGH_REG   0x26
00024 #define LPS331_STATUS_REG   0x27
00025 #define LPS331_PRESS_POUT_XL_REH    0x28
00026 #define LPS331_PRESS_OUT_L  0x29
00027 #define LPS331_PRESS_OUT_H  0x2A
00028 #define LPS331_TEMP_OUT_L   0x2B
00029 #define LPS331_TEMP_OUT_H   0x2C
00030 #define LPS331_AMP_CTRL 0x2D
00031 #define LPS331_DELTA_PRESS_XL   0x3C
00032 #define LPS331_DELTA_PRESS_H    0x3D
00033 #define LPS331_DELTA_PRESS_L    0x3E
00034 
00035 #include "mbed.h"
00036 #include "typedef.h"
00037 
00038 class LPS331{
00039 public:
00040     LPS331 (PinName sda, PinName scl);
00041     LPS331 (I2C& p_i2c);
00042     void init();
00043 
00044     void put(unsigned char a, unsigned char b);
00045     void get(unsigned char a);
00046     long value();
00047     short temperature();
00048 
00049 protected:
00050     
00051     I2C _i2c;
00052 
00053     DWORD_VAL press;
00054     WORD_VAL temp;
00055     char buf[2];
00056 
00057 };
00058 
00059 #endif /* LPS331_H_ */
00060 
00061 
00062