Remove Chip Select transitions. It affects other devices in the same bus.
Diff: ADXL345_I2C.cpp
- Revision:
- 1:a948fcfd705e
- Parent:
- 0:efba8208b490
--- a/ADXL345_I2C.cpp Sat Nov 27 21:15:07 2010 +0000 +++ b/ADXL345_I2C.cpp Sun Nov 28 01:01:52 2010 +0000 @@ -377,20 +377,20 @@ char rx[1]; char tx[1]; - nCS_ = 1; + // nCS_ = 1; tx[0]=address; i2c_.write(ADXL345_I2C_WRITE, tx,1); i2c_.read(ADXL345_I2C_READ,rx,1); - nCS_ = 0; + //nCS_ = 0; return rx[0]; } void ADXL345_I2C::oneByteWrite(char address, char data) { - nCS_ = 1; + // nCS_ = 1; char tx[2]; tx[0]=address; @@ -398,25 +398,25 @@ i2c_.write(ADXL345_I2C_WRITE,tx,2); - nCS_ = 0; + //nCS_ = 0; } void ADXL345_I2C::TwoByteRead(char startAddress, char* buffer) { - nCS_ = 1; + // nCS_ = 1; //Send address to start reading from. char tx[1]; tx[0]=startAddress; i2c_.write(ADXL345_I2C_WRITE,tx,1); i2c_.read(ADXL345_I2C_READ,buffer,2); - nCS_ = 0; + //nCS_ = 0; } void ADXL345_I2C::TwoByteWrite(char startAddress, char* buffer) { -nCS_ = 1; +//nCS_ = 1; //Send address to start reading from. char tx[1]; tx[0]=startAddress; @@ -424,6 +424,6 @@ i2c_.write(ADXL345_I2C_WRITE,buffer,2); - nCS_ = 0; + //nCS_ = 0; }