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

Committer:
jbeatch
Date:
2014-07-23
Revision:
1:a1e0d54a6be3
Parent:
0:23c269d64af7

File content as of revision 1:a1e0d54a6be3:

#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(uint8_t sensor);
    //float read_pressure();
    uint32_t read_pressure();
    uint16_t read_temperature();
  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