code with new accelerometers
Dependencies: BLE_API i2c-serial-conflict nRF51822
Fork of accel_to_blenano_i2c by
Diff: main.cpp
- Revision:
- 3:3d08e2045bde
- Parent:
- 2:2082f0f50590
- Child:
- 5:a52a03b6d13b
--- a/main.cpp Mon Apr 10 22:10:08 2017 +0000 +++ b/main.cpp Tue Apr 11 00:50:01 2017 +0000 @@ -35,8 +35,8 @@ #endif #define DEV_ADDR 0xA0 -#define ADDR_ONE 0x19 -#define ADDR_TWO 0x18 +#define ADDR_ONE 0x30 +#define ADDR_TWO 0x32 #define AXIS_X 0x00 #define AXIS_Y 0x01 #define AXIS_Z 0x02 @@ -65,8 +65,7 @@ void AT24C512_WriteBytes(uint16_t addr, uint8_t *pbuf, uint16_t length, uint16_t i2cAddr) { Wire.beginTransmission(i2cAddr); - int err = Wire.write( (uint8_t)addr>>8 ); - Wire.write( (uint8_t)addr ); + int err = Wire.write( (uint8_t)addr ); Wire.write(pbuf, length); if (err != 0) { pc.printf("error on write write! %d\n", err); @@ -80,9 +79,7 @@ void AT24C512_ReadBytes(uint16_t addr, uint8_t *pbuf, uint16_t length, uint16_t i2cAddr) { Wire.beginTransmission(i2cAddr); - int err = Wire.write( (uint8_t)addr>>8 ); - Wire.write( (uint8_t)addr ); - Wire.write(pbuf, length); + int err= Wire.write( (uint8_t)addr ); if (err != 0) { pc.printf("error on read write! %d\n", err); }