Fork for https://developer.mbed.org/users/jony1401/code/SenseAirLP8/
Dependencies: BLE_API mbed nRF51822
Fork of SenseAirLP8 by
Diff: LP8.h
- Revision:
- 5:2c80954571b6
- Parent:
- 4:320febe026ed
--- a/LP8.h Mon Aug 21 08:44:33 2017 +0000 +++ b/LP8.h Mon Aug 28 08:50:49 2017 +0000 @@ -67,17 +67,12 @@ bool lp8Init(){ Device.format(8, SerialBase::None, 2); - //Reset LP8 - RES.write( 0 ); //reset - timeIt( 1.0 ); - RES.write( 1 ); //enable - timeIt(0.2); //Enable Sensor VBB_EN.write( 1 ); //power on //wait for rdy signal - timeIt( 0.30 ); //wait for lp8 rdy signal + timeIt( 0.21 ); //wait for lp8 rdy signal // while(RDY.read() != 0 ) { /* wait for rdy to go low */} //transmit first packet @@ -86,9 +81,9 @@ //check response if ( responseCompare() != true){ - //VBB_EN.write( 0 ); + VBB_EN.write(0); return false; - } + } //compute crc CRC = modbusCrc(stateRead, 5); @@ -98,7 +93,7 @@ stateRead[6] = (uint8_t)(CRC >> 8); //crc_h //wait for rdy - timeIt( 0.20 ); // + timeIt( 0.25 ); // // while(RDY.read() != 1 ) { /*wait for rdy to go high */} transmitPacket(stateRead, 7); //transmit packet @@ -147,7 +142,7 @@ //compare to confirmation sequence if ( responseCompare() != true){ - //VBB_EN.write( 0 ); + VBB_EN.write( 0 ); return false; }