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@2:77cb7992a1a3, 2014-07-24 (annotated)
- Committer:
- jbeatch
- Date:
- Thu Jul 24 14:53:59 2014 +0000
- Revision:
- 2:77cb7992a1a3
- Parent:
- lps331.h@1:a1e0d54a6be3
added functions to output Temp [C], Temp [F], and Pressure [mbar]
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 | 2:77cb7992a1a3 | 21 | float get_Pressure_mbar(); |
jbeatch | 2:77cb7992a1a3 | 22 | float get_Temp_C(); |
jbeatch | 2:77cb7992a1a3 | 23 | float get_Temp_F(); |
jbeatch | 0:23c269d64af7 | 24 | private: |
jbeatch | 0:23c269d64af7 | 25 | PinName _CS_pin; |
jbeatch | 0:23c269d64af7 | 26 | PinName _SO_pin; |
jbeatch | 0:23c269d64af7 | 27 | PinName _SCK_pin; |
jbeatch | 0:23c269d64af7 | 28 | uint8_t readRegister(uint8_t address); |
jbeatch | 0:23c269d64af7 | 29 | void writeRegister(uint8_t address, uint8_t value); |
jbeatch | 0:23c269d64af7 | 30 | int _units; |
jbeatch | 0:23c269d64af7 | 31 | float _error; |
jbeatch | 0:23c269d64af7 | 32 | }; |
jbeatch | 0:23c269d64af7 | 33 | |
jbeatch | 0:23c269d64af7 | 34 | #endif |