SCP1000-D01 MEMS pressure sensor library
Diff: scp1000.cpp
- Revision:
- 3:29c98bdee20b
- Parent:
- 2:076ba33b1895
- Child:
- 4:d509ab38e2b5
diff -r 076ba33b1895 -r 29c98bdee20b scp1000.cpp --- a/scp1000.cpp Mon Sep 27 09:13:32 2010 +0000 +++ b/scp1000.cpp Mon Sep 27 11:43:27 2010 +0000 @@ -22,7 +22,8 @@ * * * @section DESCRIPTION -* Library for using the SCP1000-D01 MEMS Pressure sensor +* Library for using the SCP1000-D01 MEMS Pressure sensor, this is the SPI version. This library only supports high resolution mode. +* Communication with the sensor is via a 4 wire interface * */ @@ -31,9 +32,7 @@ SCP1000::SCP1000(PinName mosi, PinName miso, PinName sck, PinName CSB): _spi(mosi, miso, sck), _CSB(CSB) - /* _DRDY(NULL), - _TRIG(Null), - _PD(NULL)*/{ + { _CSB = 1; wait(0.1); _CSB = 0; @@ -87,12 +86,6 @@ } -void SCP1000::SetMode(SCPMode mode){ - _CSB = 0; - - _CSB = 1; - -} float SCP1000::read(){ _CSB = 0; @@ -156,8 +149,8 @@ if(status & 0x10){ //bit 4 high - real time error, interrupt has not been read in time - read DataRD16 _spi.write(0x20 << 2); - temp = _spi.write(0x00); - temp = _spi.write(0x00); + int data = _spi.write(0x00); + data = _spi.write(0x00); } }while(!(status & 0x20)); return(1);