mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-01 22:16:50 +00:00
Preparing HanReader for specifying baud rate and config
This commit is contained in:
@@ -5,20 +5,26 @@ HanReader::HanReader()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HanReader::setup(HardwareSerial *hanPort, unsigned long baudrate, SerialConfig config, Stream *debugPort)
|
||||||
|
{
|
||||||
|
// Initialize H/W serial port for MBus communication
|
||||||
|
hanPort->begin(baudrate, config);
|
||||||
|
while (!hanPort) {}
|
||||||
|
bytesRead = 0;
|
||||||
|
han = hanPort;
|
||||||
|
|
||||||
|
debug = debugPort;
|
||||||
|
if (debug) debug->println("MBUS serial setup complete");
|
||||||
|
}
|
||||||
|
|
||||||
void HanReader::setup(HardwareSerial *hanPort)
|
void HanReader::setup(HardwareSerial *hanPort)
|
||||||
{
|
{
|
||||||
// Initialize H/W serial port for MBus communication
|
setup(hanPort, 2400, SERIAL_8E1, NULL);
|
||||||
hanPort->begin(2400, SERIAL_8E1);
|
|
||||||
while (!hanPort) {}
|
|
||||||
bytesRead = 0;
|
|
||||||
han = hanPort;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HanReader::setup(HardwareSerial *hanPort, Stream *debugPort)
|
void HanReader::setup(HardwareSerial *hanPort, Stream *debugPort)
|
||||||
{
|
{
|
||||||
setup(hanPort);
|
setup(hanPort, 2400, SERIAL_8E1, debugPort);
|
||||||
debug = debugPort;
|
|
||||||
if (debug) debug->println("MBUS serial setup complete");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HanReader::read()
|
bool HanReader::read()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class HanReader
|
|||||||
HanReader();
|
HanReader();
|
||||||
void setup(HardwareSerial *hanPort);
|
void setup(HardwareSerial *hanPort);
|
||||||
void setup(HardwareSerial *hanPort, Stream *debugPort);
|
void setup(HardwareSerial *hanPort, Stream *debugPort);
|
||||||
|
void setup(HardwareSerial *hanPort, unsigned long baudrate, SerialConfig config, Stream *debugPort);
|
||||||
bool read();
|
bool read();
|
||||||
List getList();
|
List getList();
|
||||||
time_t getPackageTime();
|
time_t getPackageTime();
|
||||||
|
|||||||
@@ -5,20 +5,26 @@ HanReader::HanReader()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HanReader::setup(HardwareSerial *hanPort, unsigned long baudrate, SerialConfig config, Stream *debugPort)
|
||||||
|
{
|
||||||
|
// Initialize H/W serial port for MBus communication
|
||||||
|
hanPort->begin(baudrate, config);
|
||||||
|
while (!hanPort) {}
|
||||||
|
bytesRead = 0;
|
||||||
|
han = hanPort;
|
||||||
|
|
||||||
|
debug = debugPort;
|
||||||
|
if (debug) debug->println("MBUS serial setup complete");
|
||||||
|
}
|
||||||
|
|
||||||
void HanReader::setup(HardwareSerial *hanPort)
|
void HanReader::setup(HardwareSerial *hanPort)
|
||||||
{
|
{
|
||||||
// Initialize H/W serial port for MBus communication
|
setup(hanPort, 2400, SERIAL_8E1, NULL);
|
||||||
hanPort->begin(2400, SERIAL_8E1);
|
|
||||||
while (!hanPort) {}
|
|
||||||
bytesRead = 0;
|
|
||||||
han = hanPort;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HanReader::setup(HardwareSerial *hanPort, Stream *debugPort)
|
void HanReader::setup(HardwareSerial *hanPort, Stream *debugPort)
|
||||||
{
|
{
|
||||||
setup(hanPort);
|
setup(hanPort, 2400, SERIAL_8E1, debugPort);
|
||||||
debug = debugPort;
|
|
||||||
if (debug) debug->println("MBUS serial setup complete");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HanReader::read()
|
bool HanReader::read()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class HanReader
|
|||||||
HanReader();
|
HanReader();
|
||||||
void setup(HardwareSerial *hanPort);
|
void setup(HardwareSerial *hanPort);
|
||||||
void setup(HardwareSerial *hanPort, Stream *debugPort);
|
void setup(HardwareSerial *hanPort, Stream *debugPort);
|
||||||
|
void setup(HardwareSerial *hanPort, unsigned long baudrate, SerialConfig config, Stream *debugPort);
|
||||||
bool read();
|
bool read();
|
||||||
List getList();
|
List getList();
|
||||||
time_t getPackageTime();
|
time_t getPackageTime();
|
||||||
|
|||||||
Reference in New Issue
Block a user