ESPHome  2024.11.0
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:293
void IRAM_ATTR HOT yield()
Definition: core.cpp:24
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
bool check_read_timeout_(size_t len=1)