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@1:a1e0d54a6be3, 2014-07-23 (annotated)
- Committer:
- jbeatch
- Date:
- Wed Jul 23 22:30:35 2014 +0000
- Revision:
- 1:a1e0d54a6be3
- Parent:
- 0:23c269d64af7
Included Temperature output
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 | 1:a1e0d54a6be3 | 17 | int ready(uint8_t sensor); |
jbeatch | 0:23c269d64af7 | 18 | //float read_pressure(); |
jbeatch | 0:23c269d64af7 | 19 | uint32_t read_pressure(); |
jbeatch | 1:a1e0d54a6be3 | 20 | uint16_t read_temperature(); |
jbeatch | 0:23c269d64af7 | 21 | private: |
jbeatch | 0:23c269d64af7 | 22 | PinName _CS_pin; |
jbeatch | 0:23c269d64af7 | 23 | PinName _SO_pin; |
jbeatch | 0:23c269d64af7 | 24 | PinName _SCK_pin; |
jbeatch | 0:23c269d64af7 | 25 | uint8_t readRegister(uint8_t address); |
jbeatch | 0:23c269d64af7 | 26 | void writeRegister(uint8_t address, uint8_t value); |
jbeatch | 0:23c269d64af7 | 27 | int _units; |
jbeatch | 0:23c269d64af7 | 28 | float _error; |
jbeatch | 0:23c269d64af7 | 29 | }; |
jbeatch | 0:23c269d64af7 | 30 | |
jbeatch | 0:23c269d64af7 | 31 | #endif |