Skip to content

Commit

Permalink
Improved write speed by polling on ack.
Browse files Browse the repository at this point in the history
  • Loading branch information
nschurando committed Nov 5, 2023
1 parent d6d374f commit b50e2d9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/m24c64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ int m24c64::read(const uint16_t address, uint8_t* const data, const size_t lengt
}
size_t length_capped = (address + length > m_size_total) ? m_size_total - address : length;

/* Wait a little bit if a write has just been performed
* @todo Improve by implementing polling on ack */
/* Wait a little bit if a write has just been performed */
while (millis() - m_timestamp_write <= 5) {
if (detect() == true) {
break;
}
}

/* Read bytes */
Expand Down Expand Up @@ -117,9 +119,11 @@ int m24c64::write(const uint16_t address, const uint8_t* const data, const size_
/* Write bytes */
for (size_t i = 0; i < length_capped;) {

/* Wait a little bit if a write has just been performed
* @todo Improve by implementing polling on ack */
/* Wait a little bit if a write has just been performed */
while (millis() - m_timestamp_write <= 5) {
if (detect() == true) {
break;
}
}

#if PAGE_WRITE_SUPPORTED
Expand Down

0 comments on commit b50e2d9

Please sign in to comment.