Skip to content

Commit b54978f

Browse files
committed
Abstract debugSerial. Re-add unsafe getVal overloads. Better spiBuffer
1 parent 3c44ace commit b54978f

File tree

4 files changed

+523
-393
lines changed

4 files changed

+523
-393
lines changed

src/sfe_bus.h

+23
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,27 @@ namespace SparkFun_UBLOX_GNSS
116116
Stream *_serialPort;
117117
};
118118

119+
// The sfeStream device defines behavior for Serial diagnostic prints based around the Stream class.
120+
// This is Arduino specific.
121+
class SfeStream
122+
{
123+
public:
124+
SfeStream(void) { _serialPort = nullptr; }
125+
126+
void init(Stream &serialPort) { _serialPort = &serialPort; }
127+
void write(uint8_t c) { if (_serialPort != nullptr) _serialPort->write(c); }
128+
void print(const char *c) { if (_serialPort != nullptr) _serialPort->print(c); }
129+
void print(const __FlashStringHelper*c) { if (_serialPort != nullptr) _serialPort->print(c); }
130+
void print(unsigned int c, int f) { if (_serialPort != nullptr) _serialPort->print(c, f); }
131+
void print(uint16_t c) { if (_serialPort != nullptr) _serialPort->print(c); }
132+
void println() { if (_serialPort != nullptr) _serialPort->println(); }
133+
void println(const char *c) { if (_serialPort != nullptr) _serialPort->println(c); }
134+
void println(const __FlashStringHelper*c) { if (_serialPort != nullptr) _serialPort->println(c); }
135+
void println(size_t c) { if (_serialPort != nullptr) _serialPort->println(c); }
136+
void println(uint8_t c, int f) { if (_serialPort != nullptr) _serialPort->println(c, f); }
137+
138+
private:
139+
Stream *_serialPort;
140+
};
141+
119142
};

0 commit comments

Comments
 (0)