Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct const #130

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ clearDebugOutputStream KEYWORD2
clearTransactionPins KEYWORD2
debugSyncStatus KEYWORD2
deleteResponse KEYWORD2
logDebug KEYWORD2
logDebugf KEYWORD2
end KEYWORD2
newCommand KEYWORD2
newRequest KEYWORD2
requestAndResponse KEYWORD2
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Blues Wireless Notecard
version=1.6.0
version=1.6.1
author=Blues
maintainer=Blues <info@blues.com>
sentence=An easy to use Notecard Library for Arduino.
Expand Down
30 changes: 10 additions & 20 deletions src/Notecard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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`
Expand All @@ -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);
}
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand All @@ -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_);
}

Expand All @@ -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_);
}

Expand All @@ -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);
Expand Down
34 changes: 18 additions & 16 deletions src/Notecard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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;
Expand All @@ -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
Loading