Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Base_I2C_Device.cpp
- Revision:
- 3:bc08f5c87a7d
- Parent:
- 2:0a77105ec549
diff -r 0a77105ec549 -r bc08f5c87a7d Base_I2C_Device.cpp
--- a/Base_I2C_Device.cpp Wed Jul 29 14:53:01 2015 -0400
+++ b/Base_I2C_Device.cpp Wed Sep 30 16:21:45 2015 +0000
@@ -9,7 +9,7 @@
char temp_read[1];
temp_write[0] = reg;
- i2c.write(m_address, temp_write, 1, false); // no stop (unsure)
+ i2c.write(m_address, temp_write, 1, true); // no stop, because we follow with a read
i2c.read(m_address, temp_read, 1, 0);
return (uint8_t)temp_read[0];
@@ -20,7 +20,7 @@
char temp_read[2];
temp_write[0] = reg;
- i2c.write(m_address, temp_write, 1, false); // no stop (unsure)
+ i2c.write(m_address, temp_write, 1, true); // no stop, because we follow with a read
i2c.read(m_address, temp_read, 2, 0);
return (((uint16_t)temp_read[0]) << 8) | (uint16_t)temp_read[1];
@@ -32,7 +32,7 @@
char temp_write[1];
temp_write[0] = reg;
- i2c.write(m_address, temp_write, 1, false); // no stop (unsure)
+ i2c.write(m_address, temp_write, 1, true); // no stop, because we follow with a read
i2c.read(m_address, temp_read, bytes, 0);
return temp_read;
@@ -45,7 +45,7 @@
temp_write[0] = reg;
temp_write[1] = value; //check order of these (endianness)
- return i2c.write(m_address, temp_write, 2, 0);
+ return i2c.write(m_address, temp_write, 2, false);
}
int Base_I2C_Device::WriteRegister(uint8_t reg, uint16_t value)
@@ -55,5 +55,5 @@
temp_write[0] = reg;
temp_write[1] = value>>8;
temp_write[2] = (value & 0xFF);
- return i2c.write(m_address, temp_write, 3, 0);
+ return i2c.write(m_address, temp_write, 3, false);
}
\ No newline at end of file