include/nuttx/i2c/i2c_master.h: Add a definition to distinguish a new START of messages from a repeated start. No lower-half I2C drivers actually implement this new flag bit, however. drivers/i2c/i2c_writeread.c: Use new repeated START definition where appopriated. Other: Some cosmetic changes, updates to README files, etc.

This commit is contained in:
Gregory Nutt
2018-08-03 07:43:57 -06:00
parent ac5b2ea049
commit ee28cd9aeb
5 changed files with 39 additions and 37 deletions
+1 -1
View File
@@ -103,7 +103,7 @@
****************************************************************************/
#ifndef CONFIG_EE24XX_FREQUENCY
#define CONFIG_EE24XX_FREQUENCY 100000
# define CONFIG_EE24XX_FREQUENCY 100000
#endif
/****************************************************************************
+13 -12
View File
@@ -83,19 +83,20 @@ int i2c_writeread(FAR struct i2c_master_s *dev,
/* Format two messages: The first is a write */
msg[0].frequency = config->frequency,
msg[0].addr = config->address;
msg[0].flags = flags;
msg[0].buffer = (FAR uint8_t *)wbuffer; /* Override const */
msg[0].length = wbuflen;
msg[0].frequency = config->frequency,
msg[0].addr = config->address;
msg[0].flags = flags;
msg[0].buffer = (FAR uint8_t *)wbuffer; /* Override const */
msg[0].length = wbuflen;
/* The second is either a read (rbuflen > 0) or a write (rbuflen < 0) with
* no restart.
/* The second is either a read (rbuflen > 0) with a repeated start or a
* write (rbuflen < 0) with no restart.
*/
if (rbuflen > 0)
{
msg[1].flags = (flags | I2C_M_READ);
msg[0].flags |= I2C_M_NOSTOP;
msg[1].flags = (flags | I2C_M_READ);
}
else
{
@@ -103,10 +104,10 @@ int i2c_writeread(FAR struct i2c_master_s *dev,
rbuflen = -rbuflen;
}
msg[1].frequency = config->frequency,
msg[1].addr = config->address;
msg[1].buffer = rbuffer;
msg[1].length = rbuflen;
msg[1].frequency = config->frequency,
msg[1].addr = config->address;
msg[1].buffer = rbuffer;
msg[1].length = rbuflen;
/* Then perform the transfer. */