Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/NoteI2c_Arduino.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "NoteI2c_Arduino.hpp"

#include "Notecard.h"

#if defined(NOTE_C_LOW_MEM)
static const char *i2cerr = "i2c {io}";
#endif
Expand Down Expand Up @@ -105,7 +107,7 @@ NoteI2c_Arduino::receive (
if (!transmission_error) {
// Delay briefly ensuring that the Notecard can
// deliver the data in real-time to the I2C ISR
::delay(2);
NoteDelayMs(2);

const int request_length = requested_byte_count_ + NoteI2c::REQUEST_HEADER_SIZE;
const int response_length = _i2cPort.requestFrom((int)device_address_, request_length);
Expand Down Expand Up @@ -139,7 +141,7 @@ NoteI2c_Arduino::receive (
// Flash stalls have been observed on the Notecard ESP. Delaying
// between retries provides time for the Notecard to recover from
// the resource contention.
::delay(1000);
NoteDelayMs(1000);
NOTE_C_LOG_ERROR(result);
NOTE_C_LOG_WARN("serial-over-i2c: reattempting to read Notecard response");
} while (result && (i++ < retry_count));
Expand Down
2 changes: 0 additions & 2 deletions src/NoteI2c_Arduino.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include "NoteI2c.hpp"

#include "Notecard.h"

#ifndef NOTE_MOCK
#include <Wire.h>
#else
Expand Down
7 changes: 5 additions & 2 deletions src/NoteSerial_Arduino.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "NoteSerial_Arduino.hpp"

#include "NoteDefines.h"
#include "Notecard.h"

#ifndef NOTE_MOCK
#ifdef NOTE_ARDUINO_SOFTWARE_SERIAL_SUPPORT
Expand Down Expand Up @@ -68,7 +68,10 @@ NoteSerial_Arduino<T>::NoteSerial_Arduino
_notecardSerial.begin(_notecardSerialSpeed);

// Wait for the serial port to be ready
for (const size_t startMs = ::millis() ; !_notecardSerial && ((::millis() - startMs) < NOTE_C_SERIAL_TIMEOUT_MS) ;);
for (const size_t startMs = NoteGetMs()
; !_notecardSerial && ((NoteGetMs() - startMs) < NOTE_C_SERIAL_TIMEOUT_MS)
;
);
}

template <typename T>
Expand Down
8 changes: 5 additions & 3 deletions src/NoteTxn_Arduino.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "NoteTxn_Arduino.hpp"

#include "Notecard.h"

#ifndef NOTE_MOCK
#include <Arduino.h>
#else
Expand Down Expand Up @@ -78,9 +80,9 @@ NoteTxn_Arduino::start (

// Await Clear To Transact Signal
::pinMode(_ctx_pin, INPUT_PULLUP);
for (uint32_t timeout = (::millis() + timeout_ms_)
; ::millis() < timeout
; ::delay(1)
for (uint32_t timeout = (NoteGetMs() + timeout_ms_)
; NoteGetMs() < timeout
; NoteDelayMs(1)
) {
if (HIGH == ::digitalRead(_ctx_pin)) {
result = true;
Expand Down
Loading