Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Sensor/Atmpress.h@21:b1419813f2d4, 2016-06-19 (annotated)
- Committer:
- shimogamo
- Date:
- Sun Jun 19 12:53:16 2016 +0000
- Revision:
- 21:b1419813f2d4
- Parent:
- 15:e73408fc6008
init????,BatteryChecker?update????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimogamo | 15:e73408fc6008 | 1 | #ifndef BIRD_SENSOR_ATMPRESS_H_ |
shimogamo | 15:e73408fc6008 | 2 | #define BIRD_SENSOR_ATMPRESS_H_ |
shimogamo | 15:e73408fc6008 | 3 | #include "mbed.h" |
shimogamo | 15:e73408fc6008 | 4 | #include "Global.h" |
shimogamo | 15:e73408fc6008 | 5 | |
shimogamo | 15:e73408fc6008 | 6 | #define LPS331_ADDRESS 0xB8 |
shimogamo | 15:e73408fc6008 | 7 | |
shimogamo | 15:e73408fc6008 | 8 | #define LPS331_WHO_AM_I 0x0F |
shimogamo | 15:e73408fc6008 | 9 | |
shimogamo | 15:e73408fc6008 | 10 | #define LPS331_PRESS_OUT_XL 0x28 |
shimogamo | 15:e73408fc6008 | 11 | #define LPS331_PRESS_OUT_L 0x29 |
shimogamo | 15:e73408fc6008 | 12 | #define LPS331_PRESS_OUT_H 0x2A |
shimogamo | 15:e73408fc6008 | 13 | |
shimogamo | 15:e73408fc6008 | 14 | #define LPS331_TEMP_OUT_L 0x2B |
shimogamo | 15:e73408fc6008 | 15 | #define LPS331_TEMP_OUT_H 0x2C |
shimogamo | 15:e73408fc6008 | 16 | |
shimogamo | 15:e73408fc6008 | 17 | #define LPS331_CTRL_REG1 0x20 |
shimogamo | 15:e73408fc6008 | 18 | #define LPS331_CTRL_REG2 0x21 |
shimogamo | 15:e73408fc6008 | 19 | #define LPS331_CTRL_REG3 0x22 |
shimogamo | 15:e73408fc6008 | 20 | |
shimogamo | 15:e73408fc6008 | 21 | |
shimogamo | 15:e73408fc6008 | 22 | class Atmpress { |
shimogamo | 15:e73408fc6008 | 23 | protected : |
shimogamo | 15:e73408fc6008 | 24 | I2C i2c; |
shimogamo | 21:b1419813f2d4 | 25 | Timeout timeout; |
shimogamo | 15:e73408fc6008 | 26 | char readbyte(char cmd); |
shimogamo | 15:e73408fc6008 | 27 | int32_t addbyte(char xl, char l, char h); |
shimogamo | 15:e73408fc6008 | 28 | uint16_t addbyte(char l, char h); |
shimogamo | 15:e73408fc6008 | 29 | double calcpressure(int32_t raw); |
shimogamo | 15:e73408fc6008 | 30 | double calctemperature(uint16_t raw); |
shimogamo | 15:e73408fc6008 | 31 | |
shimogamo | 15:e73408fc6008 | 32 | public : |
shimogamo | 15:e73408fc6008 | 33 | Atmpress(PinName sda, PinName scl); |
shimogamo | 15:e73408fc6008 | 34 | void init(); |
shimogamo | 15:e73408fc6008 | 35 | double getpressure(); |
shimogamo | 15:e73408fc6008 | 36 | double gettemperature(); |
shimogamo | 15:e73408fc6008 | 37 | void update(); |
shimogamo | 15:e73408fc6008 | 38 | |
shimogamo | 15:e73408fc6008 | 39 | }; |
shimogamo | 15:e73408fc6008 | 40 | |
shimogamo | 15:e73408fc6008 | 41 | #endif |