diff --git a/README.md b/README.md index 763dcd1..f2128d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Coverage Status](https://coveralls.io/repos/github/blues/note-arduino/badge.svg?branch=master)](https://coveralls.io/github/blues/note-arduino?branch=master) -# note-arduino +# note-arduino The note-arduino Arduino library for communicating with the [Blues][blues] Notecard via serial or I²C. Includes example sketches in diff --git a/keywords.txt b/keywords.txt index 045d236..9b9a859 100644 --- a/keywords.txt +++ b/keywords.txt @@ -11,8 +11,7 @@ clearDebugOutputStream KEYWORD2 clearTransactionPins KEYWORD2 debugSyncStatus KEYWORD2 deleteResponse KEYWORD2 -logDebug KEYWORD2 -logDebugf KEYWORD2 +end KEYWORD2 newCommand KEYWORD2 newRequest KEYWORD2 requestAndResponse KEYWORD2 @@ -30,6 +29,10 @@ setTransactionPins KEYWORD2 ######################################## Notecard_h LITERAL1 Notecarrier_h LITERAL1 +NOTE_ARDUINO_VERSION LITERAL1 +NOTE_ARDUINO_VERSION_MAJOR LITERAL1 +NOTE_ARDUINO_VERSION_MINOR LITERAL1 +NOTE_ARDUINO_VERSION_PATCH LITERAL1 ######################################## ## DATA TYPES diff --git a/library.properties b/library.properties index bf40c2d..2fbb0b5 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Blues Wireless Notecard -version=1.6.0 +version=1.6.1 author=Blues maintainer=Blues sentence=An easy to use Notecard Library for Arduino. diff --git a/src/Notecard.cpp b/src/Notecard.cpp index 8f9bcff..07613dc 100644 --- a/src/Notecard.cpp +++ b/src/Notecard.cpp @@ -186,7 +186,7 @@ void noteTransactionStop (void) { The TwoWire implementation to use for I2C communication. */ /**************************************************************************/ -void Notecard::platformInit (bool assignCallbacks) const +void Notecard::platformInit (bool assignCallbacks) { NoteSetUserAgent((char *) ("note-arduino " NOTE_ARDUINO_VERSION)); if (assignCallbacks) { @@ -225,7 +225,7 @@ Notecard::~Notecard (void) appropriately for the host. */ /**************************************************************************/ -void Notecard::begin(NoteI2c * noteI2c_, uint32_t i2cAddress_, uint32_t i2cMax_) const +void Notecard::begin(NoteI2c * noteI2c_, uint32_t i2cAddress_, uint32_t i2cMax_) { noteI2c = noteI2c_; platformInit(noteI2c); @@ -247,7 +247,7 @@ void Notecard::begin(NoteI2c * noteI2c_, uint32_t i2cAddress_, uint32_t i2cMax_) communicating with the Notecard from the host. */ /**************************************************************************/ -void Notecard::begin(NoteSerial * noteSerial_) const +void Notecard::begin(NoteSerial * noteSerial_) { noteSerial = noteSerial_; platformInit(noteSerial); @@ -268,16 +268,6 @@ void Notecard::begin(NoteSerial * noteSerial_) const } } -/**************************************************************************/ -/*! - @brief Clear the debug output source. -*/ -/**************************************************************************/ -void Notecard::clearDebugOutputStream(void) const -{ - setDebugOutputStream(nullptr); -} - /**************************************************************************/ /*! @brief Periodically show Notecard sync status, returning `TRUE` @@ -287,10 +277,10 @@ void Notecard::clearDebugOutputStream(void) const @param maxLevel The maximum log level to output to the debug console. Pass -1 for all. - @return `True` if a pending response was displayed to the debug stream. + @return `true` if a pending response was displayed to the debug stream. */ /**************************************************************************/ -bool Notecard::debugSyncStatus(int pollFrequencyMs, int maxLevel) const +bool Notecard::debugSyncStatus(int pollFrequencyMs, int maxLevel) { return NoteDebugSyncStatus(pollFrequencyMs, maxLevel); } @@ -314,7 +304,7 @@ void Notecard::deleteResponse(J *rsp) const interfaces, and frees all associated memory. */ /**************************************************************************/ -void Notecard::end(void) const +void Notecard::end(void) { // Clear Communication Interfaces NoteSetFnI2C(0, 0, nullptr, nullptr, nullptr); @@ -490,7 +480,7 @@ bool Notecard::sendRequestWithRetry(J *req, uint32_t timeoutSeconds) const debug output. */ /**************************************************************************/ -void Notecard::setDebugOutputStream(NoteLog * noteLog_) const +void Notecard::setDebugOutputStream(NoteLog * noteLog_) { noteLog = noteLog_; if (noteLog) { @@ -513,7 +503,7 @@ void Notecard::setDebugOutputStream(NoteLog * noteLog_) const I2C bus taken during the call to `lockI2cFn()`. */ /**************************************************************************/ -void Notecard::setFnI2cMutex(mutexFn lockI2cFn_, mutexFn unlockI2cFn_) const { +void Notecard::setFnI2cMutex(mutexFn lockI2cFn_, mutexFn unlockI2cFn_) { NoteSetFnI2CMutex(lockI2cFn_, unlockI2cFn_); } @@ -530,7 +520,7 @@ void Notecard::setFnI2cMutex(mutexFn lockI2cFn_, mutexFn unlockI2cFn_) const { Notecard transaction taken during the call to `lockNoteFn()`. */ /**************************************************************************/ -void Notecard::setFnNoteMutex(mutexFn lockNoteFn_, mutexFn unlockNoteFn_) const { +void Notecard::setFnNoteMutex(mutexFn lockNoteFn_, mutexFn unlockNoteFn_) { NoteSetFnNoteMutex(lockNoteFn_, unlockNoteFn_); } @@ -549,7 +539,7 @@ void Notecard::setFnNoteMutex(mutexFn lockNoteFn_, mutexFn unlockNoteFn_) const A platform specific tuple of digital I/O pins. */ /**************************************************************************/ -void Notecard::setTransactionPins(NoteTxn * noteTxn_) const { +void Notecard::setTransactionPins(NoteTxn * noteTxn_) { noteTxn = noteTxn_; // Set global interface if (noteTxn_) { NoteSetFnTransaction(noteTransactionStart, noteTransactionStop); diff --git a/src/Notecard.h b/src/Notecard.h index 737554f..d882adf 100644 --- a/src/Notecard.h +++ b/src/Notecard.h @@ -47,7 +47,7 @@ #define NOTE_ARDUINO_VERSION_MAJOR 1 #define NOTE_ARDUINO_VERSION_MINOR 6 -#define NOTE_ARDUINO_VERSION_PATCH 0 +#define NOTE_ARDUINO_VERSION_PATCH 1 #define NOTE_ARDUINO_VERSION NOTE_C_STRINGIZE(NOTE_ARDUINO_VERSION_MAJOR) "." NOTE_C_STRINGIZE(NOTE_ARDUINO_VERSION_MINOR) "." NOTE_C_STRINGIZE(NOTE_ARDUINO_VERSION_PATCH) @@ -73,32 +73,34 @@ class Notecard #ifdef ARDUINO inline void begin(uint32_t i2cAddress = NOTE_I2C_ADDR_DEFAULT, uint32_t i2cMax = NOTE_I2C_MAX_DEFAULT, - TwoWire &wirePort = Wire) const { + TwoWire &wirePort = Wire) { begin(make_note_i2c(&wirePort), i2cAddress, i2cMax); } - inline void begin(HardwareSerial &serial, uint32_t speed = 9600) const { + inline void begin(HardwareSerial &serial, uint32_t speed = 9600) { MakeNoteSerial_ArduinoParameters arduino_parameters(serial, speed); begin(make_note_serial(&arduino_parameters)); } - inline void setDebugOutputStream(Stream &dbgserial) const { + inline void setDebugOutputStream(Stream &dbgserial) { setDebugOutputStream(make_note_log(&dbgserial)); } - inline void setTransactionPins(uint8_t ctx_pin, uint8_t rtx_pin) const { + inline void setTransactionPins(uint8_t ctx_pin, uint8_t rtx_pin) { uint8_t txn_pins[2] = {ctx_pin, rtx_pin}; setTransactionPins(make_note_txn(txn_pins)); } #endif void begin(NoteI2c * noteI2c, uint32_t i2cAddress = NOTE_I2C_ADDR_DEFAULT, - uint32_t i2cMax = NOTE_I2C_MAX_DEFAULT) const; - void begin(NoteSerial * noteSerial) const; - void clearDebugOutputStream(void) const; - inline void clearTransactionPins(void) const { + uint32_t i2cMax = NOTE_I2C_MAX_DEFAULT); + void begin(NoteSerial * noteSerial); + inline void clearDebugOutputStream(void) { + setDebugOutputStream(nullptr); + } + inline void clearTransactionPins(void) { setTransactionPins(nullptr); } - bool debugSyncStatus (int pollFrequencyMs, int maxLevel) const; + bool debugSyncStatus (int pollFrequencyMs, int maxLevel); void deleteResponse(J *rsp) const; - void end(void) const; + void end(void); NOTE_ARDUINO_DEPRECATED void logDebug(const char *message) const; NOTE_ARDUINO_DEPRECATED void logDebugf(const char *format, ...) const; J *newCommand(const char *request) const; @@ -108,13 +110,13 @@ class Notecard bool responseError(J *rsp) const; bool sendRequest(J *req) const; bool sendRequestWithRetry(J *req, uint32_t timeoutSeconds) const; - void setDebugOutputStream(NoteLog * noteLog) const; - void setFnI2cMutex(mutexFn lockI2cFn, mutexFn unlockI2cFn) const; - void setFnNoteMutex(mutexFn lockNoteFn, mutexFn unlockNoteFn) const; - void setTransactionPins(NoteTxn * noteTxn) const; + void setDebugOutputStream(NoteLog * noteLog); + void setFnI2cMutex(mutexFn lockI2cFn, mutexFn unlockI2cFn); + void setFnNoteMutex(mutexFn lockNoteFn, mutexFn unlockNoteFn); + void setTransactionPins(NoteTxn * noteTxn); private: - void platformInit (bool assignCallbacks) const; + void platformInit (bool assignCallbacks); }; #endif