Skip to content
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
8 changes: 8 additions & 0 deletions SoftwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ void SoftwareSerial::begin(long speed) {
m_bitTime = ESP.getCpuFreqMHz()*1000000/speed;
}

long SoftwareSerial::baudRate() {
// Use getCycleCount() loop to get as exact timing as possible
long speed = ESP.getCpuFreqMHz()*1000000/m_bitTime;
return speed;
}

void SoftwareSerial::setTransmitEnablePin(int transmitEnablePin) {
if (isValidGPIOpin(transmitEnablePin)) {
m_txEnableValid = true;
Expand Down Expand Up @@ -205,3 +211,5 @@ void ICACHE_RAM_ATTR SoftwareSerial::rxRead() {
// it gets set even when interrupts are disabled
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, 1 << m_rxPin);
}


2 changes: 2 additions & 0 deletions SoftwareSerial.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class SoftwareSerial : public Stream
~SoftwareSerial();

void begin(long speed);
long baudRate();
void setTransmitEnablePin(int transmitEnablePin);


int peek();

virtual size_t write(uint8_t byte);
Expand Down