yashirou shimogamo / Mbed 2 deprecated BIRD2019

Dependencies:   mbed mbed-rtos SPI_MX25R

Committer:
shimogamo
Date:
Sat Dec 01 15:10:42 2018 +0000
Revision:
0:d6402bcd58f7
BIRD2018????????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimogamo 0:d6402bcd58f7 1 #ifndef BIRD_SENSOR_ATMPRESS_H_
shimogamo 0:d6402bcd58f7 2 #define BIRD_SENSOR_ATMPRESS_H_
shimogamo 0:d6402bcd58f7 3 #include "mbed.h"
shimogamo 0:d6402bcd58f7 4 #include "Global.h"
shimogamo 0:d6402bcd58f7 5
shimogamo 0:d6402bcd58f7 6 #define LPS331_ADDRESS 0xB8
shimogamo 0:d6402bcd58f7 7
shimogamo 0:d6402bcd58f7 8 #define LPS331_WHO_AM_I 0x0F
shimogamo 0:d6402bcd58f7 9
shimogamo 0:d6402bcd58f7 10 #define LPS331_PRESS_OUT_XL 0x28
shimogamo 0:d6402bcd58f7 11 #define LPS331_PRESS_OUT_L 0x29
shimogamo 0:d6402bcd58f7 12 #define LPS331_PRESS_OUT_H 0x2A
shimogamo 0:d6402bcd58f7 13
shimogamo 0:d6402bcd58f7 14 #define LPS331_TEMP_OUT_L 0x2B
shimogamo 0:d6402bcd58f7 15 #define LPS331_TEMP_OUT_H 0x2C
shimogamo 0:d6402bcd58f7 16
shimogamo 0:d6402bcd58f7 17 #define LPS331_CTRL_REG1 0x20
shimogamo 0:d6402bcd58f7 18 #define LPS331_CTRL_REG2 0x21
shimogamo 0:d6402bcd58f7 19 #define LPS331_CTRL_REG3 0x22
shimogamo 0:d6402bcd58f7 20
shimogamo 0:d6402bcd58f7 21
shimogamo 0:d6402bcd58f7 22 class Atmpress {
shimogamo 0:d6402bcd58f7 23 protected :
shimogamo 0:d6402bcd58f7 24 I2C i2c;
shimogamo 0:d6402bcd58f7 25 Timeout timeout;
shimogamo 0:d6402bcd58f7 26 char readbyte(char cmd);
shimogamo 0:d6402bcd58f7 27 int32_t addbyte(char xl, char l, char h);
shimogamo 0:d6402bcd58f7 28 uint16_t addbyte(char l, char h);
shimogamo 0:d6402bcd58f7 29 double calcpressure(int32_t raw);
shimogamo 0:d6402bcd58f7 30 double calctemperature(uint16_t raw);
shimogamo 0:d6402bcd58f7 31
shimogamo 0:d6402bcd58f7 32 public :
shimogamo 0:d6402bcd58f7 33 Atmpress(PinName sda, PinName scl);
shimogamo 0:d6402bcd58f7 34 void init();
shimogamo 0:d6402bcd58f7 35 double getpressure();
shimogamo 0:d6402bcd58f7 36 double gettemperature();
shimogamo 0:d6402bcd58f7 37 void update();
shimogamo 0:d6402bcd58f7 38
shimogamo 0:d6402bcd58f7 39 };
shimogamo 0:d6402bcd58f7 40
shimogamo 0:d6402bcd58f7 41 #endif