SCP1000-D01 MEMS pressure sensor library

Revision:
0:dfe5ae6ea375
Child:
1:a45810688644
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scp1000.h	Mon Sep 27 08:29:02 2010 +0000
@@ -0,0 +1,73 @@
+/**
+*
+*/
+
+
+
+
+//not sure whether to make this library and class specific to the spi but code compatible or to make it generic
+
+#ifndef SCP1000_D01_H_
+#define SCP1000_D01_H_
+
+#include "mbed.h"
+/**
+* Class to allow reading of the SCP1000-D01 mems pressure sensor (SPI mode). The class currently only supports High resolution mode.
+* This means that the snesor can be read at a maximum rate of 1.8Hz.
+*/
+class SCP1000{
+public:
+
+    typedef enum SCPModes{HIGHRES,
+                    HIGHSPEED,
+                    ULTRALOWPOWER,
+                    LOWPOWER,
+                    POWERDOWN}SCPMode;
+                    
+    
+    //Constructors - to be Overloaded for different read modes - ie different pins connected up
+    /**
+    *Constructor 
+    * 
+    * @param mosi The MOSI pin for the SPI interface
+    * @param miso The MISO pin for the SPI interface
+    * @param CSB The Chip select on the SCP1000
+    */
+    SCP1000(PinName mosi, PinName miso, PinName sck, PinName CSB);
+
+    //Methods
+    void SetMode(SCPMode mode);
+    
+    /**
+    *Read the current Pressure.
+    *This blocks until the sensor has compelted a reading
+    * 
+    * @returns The pressure in pascals
+    */
+    float read();
+    /**
+    * Reads the temperature as measured by the SCP1000.
+    * This blocks until the sensor has completed a reading
+    *
+    *returns The temperature in degrees celsius
+    */
+    float readTemperature();
+    
+    
+
+private:
+    SCPMode _mode;
+
+    int _isReady();
+
+
+    //Interfaces
+    SPI _spi;
+    DigitalOut _CSB;
+   // DigitalIn _DRDY;        //Interrupt data ready - also need to be able to attach a function to this class
+   // DigitalOut _TRIG;   //Trigger        
+   // DigitalOut _PD;      //Power Down
+
+
+};
+#endif
\ No newline at end of file