NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.
Diff: Sensors/I2C_Sensor.cpp
- Revision:
- 19:40c252b4a792
- Parent:
- 17:e096e85f6c36
- Child:
- 20:e116e596e540
--- a/Sensors/I2C_Sensor.cpp Sat Nov 03 07:44:07 2012 +0000 +++ b/Sensors/I2C_Sensor.cpp Sat Nov 03 10:48:18 2012 +0000 @@ -35,8 +35,8 @@ { char value = 0; - i2c.write(GET_I2C_WRITE_ADDRESS(i2c_address), ®, 1, true); - i2c.read(GET_I2C_READ_ADDRESS(i2c_address), &value, 1, true); + i2c.write(i2c_address, ®, 1, true); + i2c.read(i2c_address, &value, 1, true); return value; } @@ -44,11 +44,11 @@ void I2C_Sensor::writeRegister(char reg, char data) { char buffer[2] = {reg, data}; - i2c.write(GET_I2C_WRITE_ADDRESS(i2c_address), buffer, 2, true); + i2c.write(i2c_address, buffer, 2, true); } void I2C_Sensor::readMultiRegister(char reg, char* output, int size) { - i2c.write (GET_I2C_WRITE_ADDRESS(i2c_address), ®, 1, true); // tell register address of the MSB get the sensor to do slave-transmit subaddress updating. - i2c.read (GET_I2C_READ_ADDRESS(i2c_address), output, size, true); // tell it where to store the data read + i2c.write (i2c_address, ®, 1, true); // tell register address of the MSB get the sensor to do slave-transmit subaddress updating. + i2c.read (i2c_address, output, size, true); // tell it where to store the data read } \ No newline at end of file