ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
components
libretiny
core.cpp
Go to the documentation of this file.
1
#ifdef USE_LIBRETINY
2
3
// HAL functions live in hal.cpp; this file only holds the serial port
4
// workaround below.
5
6
#include "
core.h
"
7
8
#ifdef USE_LN882X
9
#include <sdk_private.h>
10
11
// The SDK's open port handles (components/serial/serial.c); not in its header.
12
extern
"C"
Serial_t *
serial_handles
[SER_PORT_NUM];
13
14
namespace
esphome::libretiny
{
15
16
void
ensure_serial_handle
(uint8_t port) {
17
if
(port >= SER_PORT_NUM ||
serial_handles
[port] !=
nullptr
)
18
return
;
19
// serial_init() zeroes and opens it; the port stays open for good.
20
serial_handles
[port] =
new
Serial_t();
21
}
22
23
}
// namespace esphome::libretiny
24
#endif
// USE_LN882X
25
26
#endif
// USE_LIBRETINY
serial_handles
Serial_t * serial_handles[SER_PORT_NUM]
Definition
core.cpp:12
core.h
esphome::libretiny
Definition
atexit_stubs.cpp:14
esphome::libretiny::ensure_serial_handle
void ensure_serial_handle(uint8_t port)
Give a hardware UART its SDK handle before its Serial begin()s.
Definition
core.cpp:16
Generated by
1.12.0