Skip to content

Commit d8e8a7b

Browse files
committed
v1.3: removed EndTransmission after RequestFrom & delay between retries is now set to 1ms
1 parent 252f7c0 commit d8e8a7b

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ WARN_FORMAT = "$file:$line: $text"
770770
# messages should be written. If left blank the output is written to standard
771771
# error (stderr).
772772

773-
WARN_LOGFILE = doxy.log
773+
WARN_LOGFILE = workdir/doxy.log
774774

775775
#---------------------------------------------------------------------------
776776
# Configuration options related to the input files

ReleaseNotes.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Feel free to share your thoughts @ xgarmanboziax@gmail.com about:
1313
------------
1414

1515
** Actual:
16-
v1.3 3 May 2018:
16+
v1.3 13 May 2018:
17+
- Removed call to endTramsission after requestFrom
18+
- Delay between retries is now 1ms
1719
- Adding support for unit tests and doxygen documentation generation with Travis CI
1820
- Updated README.md
1921

examples/wirewrapper_advanced/wirewrapper_advanced.ino

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
This example code is in the public domain.
88
99
created Jan 23 2017
10-
latest mod Nov 30 2017
10+
latest mod May 13 2018
1111
by SMFSW
1212
*/
1313

@@ -113,15 +113,14 @@ bool I2C_rd_advanced(I2C_SLAVE * slave, const uint16_t reg_addr, uint8_t * data,
113113
if (Wire.write((uint8_t) reg_addr) == 0) { return false; }
114114
if (Wire.endTransmission(false) != 0) { return false; }
115115
}
116+
116117
if (Wire.requestFrom((int) slave->cfg.addr, (int) bytes) == 0) { return false; }
117118
for (uint16_t cnt = 0; cnt < bytes; cnt++)
118119
{
119120
*data++ = Wire.read();
120121
slave->reg_addr++;
121122
}
122123

123-
if (Wire.endTransmission() != 0) { return false; }
124-
125124
return true;
126125
}
127126

@@ -144,7 +143,6 @@ bool I2C_get_chip_id(I2C_SLAVE * slave, uint8_t * data)
144143
if (Wire.requestFrom((int) FRAM_ID.cfg.addr, (int) bytes) == 0) { return false; }
145144
for (uint16_t cnt = 0; cnt < bytes; cnt++)
146145
{ *data++ = Wire.read(); }
147-
if (Wire.endTransmission() != 0) { return false; }
148146

149147
return true;
150148
}

src/WireWrapper.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!\file WireWrapper.cpp
22
** \author SMFSW
3-
** \copyright MIT SMFSW (2017)
4-
** \brief Arduino Wrapper for Wire librarry (for SAM, ESP8266...) code
3+
** \copyright MIT SMFSW (2017-2018)
4+
** \brief Arduino Wrapper for Wire library (for SAM, ESP8266...) code
55
** \warning Don't access (r/w) last 16b internal address byte alone right after init, this would lead to hazardous result (in such case, make a dummy read of addr 0 before)
66
**/
77

@@ -177,7 +177,7 @@ static I2C_STATUS I2C_comm(I2C_SLAVE * slave, const uint16_t reg_addr, uint8_t *
177177
ack = fc(slave, reg_addr, data, bytes);
178178
while ((!ack) && (retry != 0)) // If com not successful, retry some more times
179179
{
180-
delay(5);
180+
delay(1);
181181
ack = fc(slave, reg_addr, data, bytes);
182182
retry--;
183183
}
@@ -266,14 +266,13 @@ static bool I2C_rd(I2C_SLAVE * slave, const uint16_t reg_addr, uint8_t * data, c
266266
if (Wire.write((uint8_t) reg_addr) == 0) { return false; }
267267
if (Wire.endTransmission(false) != 0) { return false; }
268268
}
269+
269270
if (Wire.requestFrom((int) slave->cfg.addr, (int) bytes) == 0) { return false; }
270271
for (uint16_t cnt = 0; cnt < bytes; cnt++)
271272
{
272273
*data++ = Wire.read();
273274
slave->reg_addr++;
274275
}
275276

276-
if (Wire.endTransmission() != 0) { return false; }
277-
278277
return true;
279278
}

src/WireWrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*!\file WireWrapper.h
22
** \author SMFSW
3-
** \copyright MIT SMFSW (2017)
4-
** \brief Arduino Wrapper for Wire librarry (for SAM, ESP8266...) declarations
3+
** \copyright MIT SMFSW (2017-2018)
4+
** \brief Arduino Wrapper for Wire library (for SAM, ESP8266...) declarations
55
** \warning Don't access (r/w) last 16b internal address byte alone right after init, this would lead to hazardous result (in such case, make a dummy read of addr 0 before)
66
**/
77
/****************************************************************/

0 commit comments

Comments
 (0)