mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
[Serial] Add setXxBufferSize functions
This commit is contained in:
@@ -246,6 +246,22 @@ void ESPeasySerial::setDebugOutput(bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
size_t ESPeasySerial::setRxBufferSize(size_t new_size)
|
||||
{
|
||||
if (isValid()) {
|
||||
return _serialPort->setRxBufferSize(new_size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t ESPeasySerial::setTxBufferSize(size_t new_size)
|
||||
{
|
||||
if (isValid()) {
|
||||
return _serialPort->setTxBufferSize(new_size);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ESPeasySerial::isTxEnabled(void)
|
||||
{
|
||||
return getTxPin() != -1;
|
||||
|
||||
@@ -122,6 +122,11 @@ public:
|
||||
|
||||
void setDebugOutput(bool);
|
||||
|
||||
// Set buffer size, should be called before calling begin()
|
||||
size_t setRxBufferSize(size_t new_size);
|
||||
size_t setTxBufferSize(size_t new_size);
|
||||
|
||||
|
||||
bool isTxEnabled(void);
|
||||
bool isRxEnabled(void);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
inline size_t write(const char *s)
|
||||
{
|
||||
return write((uint8_t *)s, strlen(s));
|
||||
return (s) ? write((uint8_t *)s, strlen(s)) : 0;
|
||||
}
|
||||
|
||||
inline size_t write(unsigned long n)
|
||||
@@ -74,6 +74,8 @@ public:
|
||||
|
||||
virtual void setDebugOutput(bool) = 0;
|
||||
|
||||
|
||||
// Set buffer size, should be called before calling begin()
|
||||
virtual size_t setRxBufferSize(size_t new_size) = 0;
|
||||
virtual size_t setTxBufferSize(size_t new_size) = 0;
|
||||
virtual bool setRS485Mode(int8_t rtsPin, bool enableCollisionDetection) = 0;
|
||||
|
||||
Reference in New Issue
Block a user