update for ci test shield
Fork of I2CEeprom by
Revision 2:973c4289c44c, committed 2016-12-19
- Comitter:
- LMESTM
- Date:
- Mon Dec 19 12:45:47 2016 +0000
- Parent:
- 1:b23f5561266c
- Commit message:
- Previous usage of API:; m_i2c.write(m_i2cAddress, values, 2, true); means the start will be automatically sent and then a repeated start will be later used when calling the next read().; Better to use a consistent set of APIs rather than a mix of APIs
Changed in this revision
I2CEeprom.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b23f5561266c -r 973c4289c44c I2CEeprom.cpp --- a/I2CEeprom.cpp Sun Jul 19 09:34:04 2015 +0000 +++ b/I2CEeprom.cpp Mon Dec 19 12:45:47 2016 +0000 @@ -99,8 +99,15 @@ //printf("Writing [%.*s] at %d size %d\n\r", toWrite, page, address, toWrite); // Start the page write with the addres ine one write call. char values[] = { (address >> 8), (address & 0xFF) }; - if (m_i2c.write(m_i2cAddress, values, 2, true) != 0) { - // Write failed to return bytes written so far. + + m_i2c.start(); + if (m_i2c.write(m_i2cAddress) == 0) { + return size - left; + } + if (m_i2c.write(values[0]) == 0) { + return size - left; + } + if (m_i2c.write(values[1]) == 0) { return size - left; } @@ -152,7 +159,15 @@ //printf("Writing %d at %d size %d\n\r", value, address, toWrite); char values[] = { (address >> 8), (address & 0xFF) }; - if (m_i2c.write(m_i2cAddress, values, 2, true) != 0) { + + m_i2c.start(); + if (m_i2c.write(m_i2cAddress) == 0) { + return size - left; + } + if (m_i2c.write(values[0]) == 0) { + return size - left; + } + if (m_i2c.write(values[1]) == 0) { return size - left; }