ESPHome
2026.6.0-dev
Loading...
Searching...
No Matches
esphome
components
libretiny
helpers.cpp
Go to the documentation of this file.
1
#include "
esphome/core/helpers.h
"
2
3
#ifdef USE_LIBRETINY
4
5
#include "
esphome/core/hal.h
"
6
7
#include <WiFi.h>
// for macAddress()
8
9
namespace
esphome
{
10
11
bool
random_bytes
(uint8_t *data,
size_t
len
) {
12
lt_rand_bytes(data,
len
);
13
return
true
;
14
}
15
16
// only affects the executing core
17
// so should not be used as a mutex lock, only to get accurate timing
18
IRAM_ATTR
InterruptLock::InterruptLock
() { portDISABLE_INTERRUPTS(); }
19
IRAM_ATTR
InterruptLock::~InterruptLock
() { portENABLE_INTERRUPTS(); }
20
21
// LibreTiny LwIPLock is defined inline as a no-op in helpers.h
22
23
void
get_mac_address_raw
(uint8_t *mac) {
// NOLINT(readability-non-const-parameter)
24
WiFi.macAddress(mac);
25
}
26
27
}
// namespace esphome
28
29
#endif
// USE_LIBRETINY
esphome::InterruptLock::InterruptLock
InterruptLock()
Definition
helpers.cpp:27
esphome::InterruptLock::~InterruptLock
~InterruptLock()
Definition
helpers.cpp:28
hal.h
helpers.h
esphome
Definition
a01nyub.cpp:7
esphome::random_bytes
bool random_bytes(uint8_t *data, size_t len)
Generate len random bytes using the platform's secure RNG (hardware RNG or OS CSPRNG).
Definition
helpers.cpp:20
esphome::len
const void size_t len
Definition
hal.h:64
esphome::get_mac_address_raw
void get_mac_address_raw(uint8_t *mac)
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).
Definition
helpers.cpp:74
Generated by
1.12.0