Mbed Pololu LPS331 SPI library ouputs for Air Pessure & Temperature in unsigned values calculation to be done by user (though notes on calculations can be found within)
lps331.h@0:23c269d64af7, 2014-07-23 (annotated)
- Committer:
- jbeatch
- Date:
- Wed Jul 23 21:48:08 2014 +0000
- Revision:
- 0:23c269d64af7
- Child:
- 1:a1e0d54a6be3
Mbed library for LPS331 air pressure sensor; Functional as of: July 23, 2014; by Jason Beatch
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jbeatch | 0:23c269d64af7 | 1 | #ifndef LPS331AP_h |
jbeatch | 0:23c269d64af7 | 2 | #define LPS331AP_h |
jbeatch | 0:23c269d64af7 | 3 | |
jbeatch | 0:23c269d64af7 | 4 | #include "mbed.h" |
jbeatch | 0:23c269d64af7 | 5 | |
jbeatch | 0:23c269d64af7 | 6 | class lps331 |
jbeatch | 0:23c269d64af7 | 7 | { |
jbeatch | 0:23c269d64af7 | 8 | SPI& spi; |
jbeatch | 0:23c269d64af7 | 9 | DigitalOut ncs; |
jbeatch | 0:23c269d64af7 | 10 | public: |
jbeatch | 0:23c269d64af7 | 11 | |
jbeatch | 0:23c269d64af7 | 12 | lps331(SPI& _spi, PinName _ncs); |
jbeatch | 0:23c269d64af7 | 13 | void select(); |
jbeatch | 0:23c269d64af7 | 14 | void deselect(); |
jbeatch | 0:23c269d64af7 | 15 | bool initialize(int setType=0); |
jbeatch | 0:23c269d64af7 | 16 | |
jbeatch | 0:23c269d64af7 | 17 | int ready(); |
jbeatch | 0:23c269d64af7 | 18 | //float read_pressure(); |
jbeatch | 0:23c269d64af7 | 19 | uint32_t read_pressure(); |
jbeatch | 0:23c269d64af7 | 20 | private: |
jbeatch | 0:23c269d64af7 | 21 | PinName _CS_pin; |
jbeatch | 0:23c269d64af7 | 22 | PinName _SO_pin; |
jbeatch | 0:23c269d64af7 | 23 | PinName _SCK_pin; |
jbeatch | 0:23c269d64af7 | 24 | uint8_t readRegister(uint8_t address); |
jbeatch | 0:23c269d64af7 | 25 | void writeRegister(uint8_t address, uint8_t value); |
jbeatch | 0:23c269d64af7 | 26 | int _units; |
jbeatch | 0:23c269d64af7 | 27 | float _error; |
jbeatch | 0:23c269d64af7 | 28 | }; |
jbeatch | 0:23c269d64af7 | 29 | |
jbeatch | 0:23c269d64af7 | 30 | #endif |