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)
Diff: lps331.h
- Revision:
- 0:23c269d64af7
- Child:
- 1:a1e0d54a6be3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lps331.h Wed Jul 23 21:48:08 2014 +0000 @@ -0,0 +1,30 @@ +#ifndef LPS331AP_h +#define LPS331AP_h + +#include "mbed.h" + +class lps331 +{ + SPI& spi; + DigitalOut ncs; + public: + + lps331(SPI& _spi, PinName _ncs); + void select(); + void deselect(); + bool initialize(int setType=0); + + int ready(); + //float read_pressure(); + uint32_t read_pressure(); + private: + PinName _CS_pin; + PinName _SO_pin; + PinName _SCK_pin; + uint8_t readRegister(uint8_t address); + void writeRegister(uint8_t address, uint8_t value); + int _units; + float _error; +}; + +#endif