Adding Jonathan’s ring buffer to serial repeater

This commit is contained in:
Andy CA6JAU 2017-07-04 14:27:57 -04:00
parent eefda572bf
commit 6486bf4efc
4 changed files with 76 additions and 14 deletions

View file

@ -112,5 +112,25 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
}
}
int CSerialPort::availableForWriteInt(uint8_t n)
{
switch (n) {
case 1U:
#if defined(STM32_USART1_HOST) && defined(__STM32F1__)
return Serial1.availableForWrite();
#else
return Serial.availableForWrite();
#endif
case 3U:
#if defined(SERIAL_REPEATER) && defined(__STM32F1__)
return Serial2.availableForWrite();
#elif defined(SERIAL_REPEATER) && (defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__))
return Serial1.availableForWrite();
#endif
default:
return false;
}
}
#endif