read pressure and temperature from LPS25h.

Dependencies:   mbed

Committer:
onaka
Date:
Sun May 10 07:00:39 2015 +0000
Revision:
3:844fb47ba7a2
Parent:
2:0c2bb6fe6885
revision 3

Who changed what in which revision?

UserRevisionLine numberNew contents of line
onaka 2:0c2bb6fe6885 1 //**********************
onaka 2:0c2bb6fe6885 2 // LPS25H.h for mbed
onaka 2:0c2bb6fe6885 3 //
onaka 2:0c2bb6fe6885 4 // (C)Copyright 2014 All rights reserved by Y.Onodera
onaka 2:0c2bb6fe6885 5 // http://einstlab.web.fc2.com
onaka 2:0c2bb6fe6885 6 //**********************
onaka 2:0c2bb6fe6885 7
onaka 2:0c2bb6fe6885 8 #ifndef LPS25H_H_
onaka 2:0c2bb6fe6885 9 #define LPS25H_H_
onaka 2:0c2bb6fe6885 10
onaka 2:0c2bb6fe6885 11 #define LPS25H_ADDR 0xB8
onaka 2:0c2bb6fe6885 12 #define LPS25H_REF_P_XL 0x08
onaka 2:0c2bb6fe6885 13 #define LPS25H_REF_P_L 0x09
onaka 2:0c2bb6fe6885 14 #define LPS25H_REF_P_H 0x0A
onaka 2:0c2bb6fe6885 15 #define LPS25H_WHO_AM_I 0x0F
onaka 2:0c2bb6fe6885 16 #define LPS25H_RES_CONF 0x10
onaka 2:0c2bb6fe6885 17 #define LPS25H_CTRL_REG1 0x20
onaka 2:0c2bb6fe6885 18 #define LPS25H_CTRL_REG2 0x21
onaka 2:0c2bb6fe6885 19 #define LPS25H_CTRL_REG3 0x22
onaka 2:0c2bb6fe6885 20 #define LPS25H_CTRL_REG4 0x23
onaka 2:0c2bb6fe6885 21 #define LPS25H_INT_CFG 0x24
onaka 2:0c2bb6fe6885 22 #define LPS25H_INT_SOURCE 0x25
onaka 2:0c2bb6fe6885 23 #define LPS25H_STATUS_REG 0x27
onaka 2:0c2bb6fe6885 24 #define LPS25H_PRESS_OUT_XL 0x28
onaka 2:0c2bb6fe6885 25 #define LPS25H_PRESS_OUT_L 0x29
onaka 2:0c2bb6fe6885 26 #define LPS25H_PRESS_OUT_H 0x2A
onaka 2:0c2bb6fe6885 27 #define LPS25H_TEMP_OUT_L 0x2B
onaka 2:0c2bb6fe6885 28 #define LPS25H_TEMP_OUT_H 0x2C
onaka 2:0c2bb6fe6885 29 #define LPS25H_FIFO_CTRL 0x2E
onaka 2:0c2bb6fe6885 30 #define LPS25H_FIFO_STATUS 0x2F
onaka 2:0c2bb6fe6885 31 #define LPS25H_THS_P_L 0x30
onaka 2:0c2bb6fe6885 32 #define LPS25H_THS_P_H 0x31
onaka 2:0c2bb6fe6885 33 #define LPS25H_RPDS_L 0x39
onaka 2:0c2bb6fe6885 34 #define LPS25H_RPDS_H 0x3A
onaka 2:0c2bb6fe6885 35
onaka 2:0c2bb6fe6885 36 #include "mbed.h"
onaka 2:0c2bb6fe6885 37 #include "typedef.h"
onaka 2:0c2bb6fe6885 38
onaka 2:0c2bb6fe6885 39 class LPS25H{
onaka 2:0c2bb6fe6885 40 public:
onaka 2:0c2bb6fe6885 41 LPS25H (PinName sda, PinName scl);
onaka 2:0c2bb6fe6885 42 LPS25H (I2C& p_i2c);
onaka 2:0c2bb6fe6885 43 void init();
onaka 2:0c2bb6fe6885 44
onaka 2:0c2bb6fe6885 45 void put(unsigned char a, unsigned char b);
onaka 2:0c2bb6fe6885 46 void get(unsigned char a);
onaka 2:0c2bb6fe6885 47 long pressure();
onaka 2:0c2bb6fe6885 48 short temperature();
onaka 2:0c2bb6fe6885 49
onaka 2:0c2bb6fe6885 50 protected:
onaka 2:0c2bb6fe6885 51
onaka 2:0c2bb6fe6885 52 I2C _i2c;
onaka 2:0c2bb6fe6885 53
onaka 2:0c2bb6fe6885 54 DWORD_VAL press;
onaka 2:0c2bb6fe6885 55 WORD_VAL temp;
onaka 2:0c2bb6fe6885 56 char buf[2];
onaka 2:0c2bb6fe6885 57
onaka 2:0c2bb6fe6885 58 };
onaka 2:0c2bb6fe6885 59
onaka 2:0c2bb6fe6885 60 #endif /* LPS25H_H_ */
onaka 2:0c2bb6fe6885 61
onaka 2:0c2bb6fe6885 62