SCP1000-D01 MEMS pressure sensor library
Diff: scp1000.cpp
- Revision:
- 2:076ba33b1895
- Parent:
- 1:a45810688644
- Child:
- 3:29c98bdee20b
--- a/scp1000.cpp Mon Sep 27 08:30:39 2010 +0000 +++ b/scp1000.cpp Mon Sep 27 09:13:32 2010 +0000 @@ -22,7 +22,7 @@ * * * @section DESCRIPTION -* +* Library for using the SCP1000-D01 MEMS Pressure sensor * */ @@ -90,8 +90,6 @@ void SCP1000::SetMode(SCPMode mode){ _CSB = 0; - - _CSB = 1; } @@ -99,7 +97,7 @@ float SCP1000::read(){ _CSB = 0; - if(_isReady() == 1){ + if(_waitReady() == 1){ _spi.write(0x1F <<2); int PressureHighest = _spi.write(0x00); _spi.write(0x20 <<2); @@ -123,7 +121,7 @@ _CSB = 0; - if(_isReady() == 1){ + if(_waitReady() == 1){ //ready so now read _spi.write(0x21 << 2); int TempHigh = _spi.write(0x00); @@ -146,7 +144,7 @@ } } - int SCP1000::_isReady(){ + int SCP1000::_waitReady(){ //Depending on mode wait for it to be ready int status; _CSB = 0; @@ -157,11 +155,10 @@ wait(0.2); if(status & 0x10){ //bit 4 high - real time error, interrupt has not been read in time - read DataRD16 - int temp; _spi.write(0x20 << 2); temp = _spi.write(0x00); temp = _spi.write(0x00); } }while(!(status & 0x20)); - return(1); + return(1); } \ No newline at end of file