ESPHome 2025.5.0
Loading...
Searching...
No Matches
uart_component.cpp
Go to the documentation of this file.
1#include "uart_component.h"
2
3namespace esphome {
4namespace uart {
5
6static const char *const TAG = "uart";
7
9 if (this->available() >= int(len))
10 return true;
11
12 uint32_t start_time = millis();
13 while (this->available() < int(len)) {
14 if (millis() - start_time > 100) {
15 ESP_LOGE(TAG, "Reading from UART timed out at byte %u!", this->available());
16 return false;
17 }
18 yield();
19 }
20 return true;
21}
22
23} // namespace uart
24} // namespace esphome
bool check_read_timeout_(size_t len=1)
const char *const TAG
Definition spi.cpp:8
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:301
void IRAM_ATTR HOT yield()
Definition core.cpp:26
uint32_t IRAM_ATTR HOT millis()
Definition core.cpp:27