[uart] Multiple ESP32 features and fixes (#8103)
Co-authored-by: Keith Burzinski <kbx81x@gmail.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
16 files changed
+224
-22
No files matched your search
@@ -20,5 +20,13 @@ bool UARTComponent::check_read_timeout_(size_t len) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void UARTComponent::set_rx_full_threshold_ms(uint8_t time) {
|
||||
uint8_t bytelength = this->data_bits_ + this->stop_bits_ + 1;
|
||||
if (this->parity_ != UARTParityOptions::UART_CONFIG_PARITY_NONE)
|
||||
bytelength += 1;
|
||||
int32_t val = clamp<int32_t>((this->baud_rate_ / (bytelength * 1000 / time)) - 1, 1, 120);
|
||||
this->set_rx_full_threshold(val);
|
||||
}
|
||||
|
||||
} // namespace uart
|
||||
} // namespace esphome
|
||||
Reference in new issue
Block a user