ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
helpers.cpp
Go to the documentation of this file.
2
3#ifdef USE_LIBRETINY
4
5#include "esphome/core/hal.h"
6
7#include <WiFi.h> // for macAddress()
8
9namespace esphome {
10
11bool 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
18IRAM_ATTR InterruptLock::InterruptLock() { portDISABLE_INTERRUPTS(); }
19IRAM_ATTR InterruptLock::~InterruptLock() { portENABLE_INTERRUPTS(); }
20
21// LibreTiny LwIPLock is defined inline as a no-op in helpers.h
22
23void 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
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
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
std::string size_t len
Definition helpers.h:1045
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