ESPHome  2024.4.1
uart_component.cpp
Go to the documentation of this file.
1 #include "uart_component.h"
2 
3 namespace esphome {
4 namespace uart {
5 
6 static 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
uint32_t IRAM_ATTR HOT millis()
Definition: core.cpp:25
const char *const TAG
Definition: spi.cpp:8
std::string size_t len
Definition: helpers.h:292
void IRAM_ATTR HOT yield()
Definition: core.cpp:24
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
bool check_read_timeout_(size_t len=1)