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
00001 #ifndef LPS331AP_h 00002 #define LPS331AP_h 00003 00004 #include "mbed.h" 00005 00006 class lps331 00007 { 00008 SPI& spi; 00009 DigitalOut ncs; 00010 public: 00011 00012 lps331(SPI& _spi, PinName _ncs); 00013 void select(); 00014 void deselect(); 00015 bool initialize(int setType=0); 00016 00017 int ready(uint8_t sensor); 00018 //float read_pressure(); 00019 uint32_t read_pressure(); 00020 uint16_t read_temperature(); 00021 float get_Pressure_mbar(); 00022 float get_Temp_C(); 00023 float get_Temp_F(); 00024 private: 00025 PinName _CS_pin; 00026 PinName _SO_pin; 00027 PinName _SCK_pin; 00028 uint8_t readRegister(uint8_t address); 00029 void writeRegister(uint8_t address, uint8_t value); 00030 int _units; 00031 float _error; 00032 }; 00033 00034 #endif
Generated on Thu Jul 14 2022 09:48:01 by 1.7.2