Library to interface the SCP1000 temperature and pressure sensor.

Dependents:   SCP1000_Example ku-make_sensor ku-make_sensor201302 SCP1000_Example ... more

SCP1000.h

Committer:
kadams6
Date:
2010-10-05
Revision:
4:295e118b6e85
Parent:
3:4d8b8ca54451
Child:
7:61d2e698d988

File content as of revision 4:295e118b6e85:

/** \file
 SCP1000 header file
*/

#ifndef _SCP1000_H
#define _SCP1000_H

#include "mbed.h"

class SCP1000 {
    public:
        SCP1000(PinName mosi, PinName miso, PinName sclk, PinName cs);
        
        ~SCP1000() { /* empty */ };
        
        ///Reads the pressure
        /**
            Reads the pressure from the sensor
            @return Pressure in pascals.
        */
        unsigned long readPressure();
        
        float readTemperature();
        
        
    private:
        static const char PRESSURE = 0x1F;   //Pressure 3 MSB
        static const char PRESSURE_LSB = 0x20; //Pressure 16 LSB
        static const char TEMP = 0x21;       //16 bit temp
        SPI m_spi;
        DigitalOut m_cs;
        
        char read_register(char register_name);
        void write_register(char register_name, char register_value);
        float read_register16(char register_name);

};

#endif // _SCP1000_H