ESPHome
2024.11.2
|
Implementation of SPI Controller mode. More...
Data Structures | |
class | Action |
class | ActionList |
class | AndCondition |
class | Application |
class | Automation |
class | CallbackManager |
class | CallbackManager< void(Ts...)> |
Helper class to allow having multiple subscribers to a callback. More... | |
struct | Color |
class | Component |
class | ComponentIterator |
class | Condition |
Base class for all automation conditions. More... | |
class | Controller |
class | Deduplicator |
Helper class to deduplicate items in a series of values. More... | |
class | DelayAction |
class | EntityBase |
class | EntityBase_DeviceClass |
class | EntityBase_UnitOfMeasurement |
class | ESPHomeOTAComponent |
ESPHomeOTAComponent provides a simple way to integrate Over-the-Air updates into your app using ArduinoOTA. More... | |
class | ESPPreferenceBackend |
class | ESPPreferenceObject |
class | ESPPreferences |
struct | ESPTime |
A more user-friendly version of struct tm from time.h. More... | |
class | ForCondition |
struct | gens |
struct | gens< 0, S... > |
class | GPIOPin |
class | HighFrequencyLoopRequester |
Helper class to request loop() to be called as fast as possible. More... | |
class | IfAction |
struct | int24_t |
24-bit signed integer type, transparently converting to 32-bit. More... | |
class | InternalGPIOPin |
class | InterruptLock |
Helper class to disable interrupts. More... | |
struct | is_invocable |
struct | is_trivially_copyable |
class | ISRInternalGPIOPin |
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions) More... | |
class | LambdaAction |
class | LambdaCondition |
class | LockGuard |
Helper class that wraps a mutex with a RAII-style API. More... | |
class | LoopTrigger |
class | Mutex |
Mutex implementation, with API based on the unavailable std::mutex. More... | |
class | NotCondition |
struct | nullopt_t |
class | optional |
class | OrCondition |
class | Parented |
Helper class to easily give an object a parent of type T . More... | |
class | PollingComponent |
This class simplifies creating components that periodically check a state. More... | |
class | ProjectUpdateTrigger |
class | RAMAllocator |
An STL allocator that uses SPI or internal RAM. More... | |
class | RepeatAction |
class | ResumeComponentAction |
class | RingBuffer |
class | Scheduler |
struct | seq |
class | ShutdownTrigger |
class | StartupTrigger |
class | StringRef |
StringRef is a reference to a string owned by something else. More... | |
class | SuspendComponentAction |
class | TemplatableValue |
class | Trigger |
struct | uint24_t |
24-bit unsigned integer type, transparently converting to 32-bit. More... | |
class | UpdateComponentAction |
class | WaitUntilAction |
class | WarnIfComponentBlockingGuard |
class | WhileAction |
class | XorCondition |
Enumerations | |
enum | RetryResult { RetryResult::DONE, RetryResult::RETRY } |
enum | EntityCategory : uint8_t { ENTITY_CATEGORY_NONE = 0, ENTITY_CATEGORY_CONFIG = 1, ENTITY_CATEGORY_DIAGNOSTIC = 2 } |
Functions | |
void IRAM_ATTR HOT | yield () |
uint32_t IRAM_ATTR HOT | millis () |
void IRAM_ATTR HOT | delay (uint32_t ms) |
uint32_t IRAM_ATTR HOT | micros () |
void IRAM_ATTR HOT | delayMicroseconds (uint32_t us) |
void | arch_restart () |
void | arch_init () |
void IRAM_ATTR HOT | arch_feed_wdt () |
uint8_t | progmem_read_byte (const uint8_t *addr) |
uint32_t | arch_get_cpu_cycle_count () |
uint32_t | arch_get_cpu_freq_hz () |
void | loop_task (void *pv_params) |
void | app_main () |
void | init () |
void | force_link_symbols () |
void | resetPins () |
ESPDEPRECATED ("Use Color::BLACK instead of COLOR_BLACK", "v1.21") extern const Color COLOR_BLACK | |
ESPDEPRECATED ("Use Color::WHITE instead of COLOR_WHITE", "v1.21") extern const Color COLOR_WHITE | |
struct esphome::uint24_t | __attribute__ ((packed)) |
void | __attribute__ ((noreturn)) arch_restart() |
template<int(*)(int) fn> | |
std::string | str_ctype_transform (const std::string &str) |
std::string | str_snprintf (const char *fmt, size_t len,...) |
std::string | str_sprintf (const char *fmt,...) |
void HOT | esp_log_printf_ (int level, const char *tag, int line, const char *format,...) |
void HOT | esp_log_printf_ (int level, const char *tag, int line, const __FlashStringHelper *format,...) |
void HOT | esp_log_vprintf_ (int level, const char *tag, int line, const char *format, va_list args) |
void HOT | esp_log_vprintf_ (int level, const char *tag, int line, const __FlashStringHelper *format, va_list args) |
int HOT | esp_idf_log_vprintf_ (const char *format, va_list args) |
const nullopt_t | nullopt ((nullopt_t::init())) |
template<typename T , typename U > | |
bool | operator== (optional< T > const &x, optional< U > const &y) |
template<typename T , typename U > | |
bool | operator!= (optional< T > const &x, optional< U > const &y) |
template<typename T , typename U > | |
bool | operator< (optional< T > const &x, optional< U > const &y) |
template<typename T , typename U > | |
bool | operator> (optional< T > const &x, optional< U > const &y) |
template<typename T , typename U > | |
bool | operator<= (optional< T > const &x, optional< U > const &y) |
template<typename T , typename U > | |
bool | operator>= (optional< T > const &x, optional< U > const &y) |
template<typename T > | |
bool | operator== (optional< T > const &x, nullopt_t) |
template<typename T > | |
bool | operator== (nullopt_t, optional< T > const &x) |
template<typename T > | |
bool | operator!= (optional< T > const &x, nullopt_t) |
template<typename T > | |
bool | operator!= (nullopt_t, optional< T > const &x) |
template<typename T > | |
bool | operator< (optional< T > const &, nullopt_t) |
template<typename T > | |
bool | operator< (nullopt_t, optional< T > const &x) |
template<typename T > | |
bool | operator<= (optional< T > const &x, nullopt_t) |
template<typename T > | |
bool | operator<= (nullopt_t, optional< T > const &) |
template<typename T > | |
bool | operator> (optional< T > const &x, nullopt_t) |
template<typename T > | |
bool | operator> (nullopt_t, optional< T > const &) |
template<typename T > | |
bool | operator>= (optional< T > const &, nullopt_t) |
template<typename T > | |
bool | operator>= (nullopt_t, optional< T > const &x) |
template<typename T , typename U > | |
bool | operator== (optional< T > const &x, U const &v) |
template<typename T , typename U > | |
bool | operator== (U const &v, optional< T > const &x) |
template<typename T , typename U > | |
bool | operator!= (optional< T > const &x, U const &v) |
template<typename T , typename U > | |
bool | operator!= (U const &v, optional< T > const &x) |
template<typename T , typename U > | |
bool | operator< (optional< T > const &x, U const &v) |
template<typename T , typename U > | |
bool | operator< (U const &v, optional< T > const &x) |
template<typename T , typename U > | |
bool | operator<= (optional< T > const &x, U const &v) |
template<typename T , typename U > | |
bool | operator<= (U const &v, optional< T > const &x) |
template<typename T , typename U > | |
bool | operator> (optional< T > const &x, U const &v) |
template<typename T , typename U > | |
bool | operator> (U const &v, optional< T > const &x) |
template<typename T , typename U > | |
bool | operator>= (optional< T > const &x, U const &v) |
template<typename T , typename U > | |
bool | operator>= (U const &v, optional< T > const &x) |
template<typename T > | |
void | swap (optional< T > &x, optional< T > &y) |
template<typename T > | |
optional< T > | make_optional (T const &v) |
void | convertToJson (const StringRef &src, JsonVariant dst) |
bool | operator== (const StringRef &lhs, const StringRef &rhs) |
bool | operator== (const StringRef &lhs, const std::string &rhs) |
bool | operator== (const std::string &lhs, const StringRef &rhs) |
bool | operator== (const StringRef &lhs, const char *rhs) |
bool | operator== (const char *lhs, const StringRef &rhs) |
bool | operator!= (const StringRef &lhs, const StringRef &rhs) |
bool | operator!= (const StringRef &lhs, const std::string &rhs) |
bool | operator!= (const std::string &lhs, const StringRef &rhs) |
bool | operator!= (const StringRef &lhs, const char *rhs) |
bool | operator!= (const char *lhs, const StringRef &rhs) |
bool | operator< (const StringRef &lhs, const StringRef &rhs) |
std::string & | operator+= (std::string &lhs, const StringRef &rhs) |
std::string | operator+ (const char *lhs, const StringRef &rhs) |
std::string | operator+ (const StringRef &lhs, const char *rhs) |
bool | is_leap_year (uint32_t year) |
uint8_t | days_in_month (uint8_t month, uint16_t year) |
template<typename T > | |
bool | increment_time_value (T ¤t, uint16_t begin, uint16_t end) |
bool | api_is_connected () |
Return whether the node has at least one client connected to the native API. More... | |
bool | mqtt_is_connected () |
Return whether the node has an active connection to an MQTT broker. More... | |
bool | remote_is_connected () |
Return whether the node has any form of "remote" connection via the API or to an MQTT broker. More... | |
Mathematics | |
float | lerp (float completion, float start, float end) |
Linearly interpolate between start and end by completion (between 0 and 1). More... | |
uint8_t | crc8 (const uint8_t *data, uint8_t len) |
Calculate a CRC-8 checksum of data with size len . More... | |
uint16_t | crc16 (const uint8_t *data, uint16_t len, uint16_t crc=0xffff, uint16_t reverse_poly=0xa001, bool refin=false, bool refout=false) |
Calculate a CRC-16 checksum of data with size len . More... | |
uint16_t | crc16be (const uint8_t *data, uint16_t len, uint16_t crc, uint16_t poly, bool refin, bool refout) |
uint32_t | fnv1_hash (const std::string &str) |
Calculate a FNV-1 hash of str . More... | |
uint32_t | random_uint32 () |
Return a random 32-bit unsigned integer. More... | |
float | random_float () |
Return a random float between 0 and 1. More... | |
bool | random_bytes (uint8_t *data, size_t len) |
Generate len number of random bytes. More... | |
template<typename T , typename U > | |
T | remap (U value, U min, U max, T min_out, T max_out) |
Remap value from the range (min , max ) to (min_out , max_out ). More... | |
Colors | |
float | gamma_correct (float value, float gamma) |
Applies gamma correction of gamma to value . More... | |
float | gamma_uncorrect (float value, float gamma) |
Reverts gamma correction of gamma to value . More... | |
void | rgb_to_hsv (float red, float green, float blue, int &hue, float &saturation, float &value) |
Convert red , green and blue (all 0-1) values to hue (0-360), saturation (0-1) and value (0-1). More... | |
void | hsv_to_rgb (int hue, float saturation, float value, float &red, float &green, float &blue) |
Convert hue (0-360), saturation (0-1) and value (0-1) to red , green and blue (all 0-1). More... | |
System APIs | |
void | get_mac_address_raw (uint8_t *mac) |
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes). More... | |
std::string | get_mac_address () |
Get the device MAC address as a string, in lowercase hex notation. More... | |
std::string | get_mac_address_pretty () |
Get the device MAC address as a string, in colon-separated uppercase hex notation. More... | |
void | set_mac_address (uint8_t *mac) |
Set the MAC address to use from the provided byte array (6 bytes). More... | |
bool | has_custom_mac_address () |
Check if a custom MAC address is set (ESP32 & variants) More... | |
bool | mac_address_is_valid (const uint8_t *mac) |
Check if the MAC address is not all zeros or all ones. More... | |
void | delay_microseconds_safe (uint32_t us) |
Delay for the given amount of microseconds, possibly yielding to other processes during the wait. More... | |
Bit manipulation | |
constexpr uint16_t | encode_uint16 (uint8_t msb, uint8_t lsb) |
Encode a 16-bit value given the most and least significant byte. More... | |
constexpr uint32_t | encode_uint32 (uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4) |
Encode a 32-bit value given four bytes in most to least significant byte order. More... | |
constexpr uint32_t | encode_uint24 (uint8_t byte1, uint8_t byte2, uint8_t byte3) |
Encode a 24-bit value given three bytes in most to least significant byte order. More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
constexpr14 T | encode_value (const uint8_t *bytes) |
Encode a value from its constituent bytes (from most to least significant) in an array with length sizeof(T). More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
constexpr14 T | encode_value (const std::array< uint8_t, sizeof(T)> bytes) |
Encode a value from its constituent bytes (from most to least significant) in an std::array with length sizeof(T). More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
constexpr14 std::array< uint8_t, sizeof(T)> | decode_value (T val) |
Decode a value into its constituent bytes (from most to least significant). More... | |
uint8_t | reverse_bits (uint8_t x) |
Reverse the order of 8 bits. More... | |
uint16_t | reverse_bits (uint16_t x) |
Reverse the order of 16 bits. More... | |
uint32_t | reverse_bits (uint32_t x) |
Reverse the order of 32 bits. More... | |
template<typename T > | |
constexpr14 T | convert_big_endian (T val) |
Convert a value between host byte order and big endian (most significant byte first) order. More... | |
template<typename T > | |
constexpr14 T | convert_little_endian (T val) |
Convert a value between host byte order and little endian (least significant byte first) order. More... | |
Units | |
constexpr float | celsius_to_fahrenheit (float value) |
Convert degrees Celsius to degrees Fahrenheit. More... | |
constexpr float | fahrenheit_to_celsius (float value) |
Convert degrees Fahrenheit to degrees Celsius. More... | |
Internal functions | |
template<typename T , enable_if_t<!std::is_pointer< T >::value, int > = 0> | |
T | id (T value) |
Helper function to make id(var) known from lambdas work in custom components. More... | |
template<typename T , enable_if_t< std::is_pointer< T *>::value, int > = 0> | |
T & | id (T *value) |
Helper function to make id(var) known from lambdas work in custom components. More... | |
Deprecated functions | |
ESPDEPRECATED ("hexencode() is deprecated, use format_hex_pretty() instead.", "2022.1") inline std | |
Variables | |
TaskHandle_t | loop_task_handle = nullptr |
ESPPreferences * | global_preferences |
Application | App |
Global storage of Application pointer - only one Application can exist. More... | |
const Color | COLOR_BLACK (0, 0, 0, 0) |
const Color | COLOR_WHITE (255, 255, 255, 255) |
const uint32_t | COMPONENT_STATE_MASK = 0xFF |
const uint32_t | COMPONENT_STATE_CONSTRUCTION = 0x00 |
const uint32_t | COMPONENT_STATE_SETUP = 0x01 |
const uint32_t | COMPONENT_STATE_LOOP = 0x02 |
const uint32_t | COMPONENT_STATE_FAILED = 0x03 |
const uint32_t | STATUS_LED_MASK = 0xFF00 |
const uint32_t | STATUS_LED_OK = 0x0000 |
const uint32_t | STATUS_LED_WARNING = 0x0100 |
const uint32_t | STATUS_LED_ERROR = 0x0200 |
uint32_t | global_state = 0 |
enum esphome::EntityCategory | __attribute__ |
STL backports | |
template<bool B, class T = void> | |
using | enable_if_t = typename std::enable_if< B, T >::type |
std::string | to_string (int value) |
std::string | to_string (long value) |
std::string | to_string (long long value) |
std::string | to_string (unsigned value) |
std::string | to_string (unsigned long value) |
std::string | to_string (unsigned long long value) |
std::string | to_string (float value) |
std::string | to_string (double value) |
std::string | to_string (long double value) |
template<typename T , typename... Args> | |
std::unique_ptr< T > | make_unique (Args &&...args) |
template<typename T , typename Compare > | |
constexpr const T & | clamp (const T &v, const T &lo, const T &hi, Compare comp) |
template<typename T > | |
constexpr const T & | clamp (const T &v, const T &lo, const T &hi) |
template<typename To , typename From , enable_if_t< sizeof(To)==sizeof(From) &&is_trivially_copyable< From >::value &&is_trivially_copyable< To >::value, int > = 0> | |
To | bit_cast (const From &src) |
Convert data between types, without aliasing issues or undefined behaviour. More... | |
template<typename T > | |
constexpr14 T | byteswap (T n) |
template<> | |
constexpr14 uint8_t | byteswap (uint8_t n) |
template<> | |
constexpr14 uint16_t | byteswap (uint16_t n) |
template<> | |
constexpr14 uint32_t | byteswap (uint32_t n) |
template<> | |
constexpr14 uint64_t | byteswap (uint64_t n) |
template<> | |
constexpr14 int8_t | byteswap (int8_t n) |
template<> | |
constexpr14 int16_t | byteswap (int16_t n) |
template<> | |
constexpr14 int32_t | byteswap (int32_t n) |
template<> | |
constexpr14 int64_t | byteswap (int64_t n) |
Strings | |
std::string size_t | len |
bool | str_equals_case_insensitive (const std::string &a, const std::string &b) |
Compare strings for equality in case-insensitive manner. More... | |
bool | str_startswith (const std::string &str, const std::string &start) |
Check whether a string starts with a value. More... | |
bool | str_endswith (const std::string &str, const std::string &end) |
Check whether a string ends with a value. More... | |
std::string | str_truncate (const std::string &str, size_t length) |
Truncate a string to a specific length. More... | |
std::string | str_until (const char *str, char ch) |
Extract the part of the string until either the first occurrence of the specified character, or the end (requires str to be null-terminated). More... | |
std::string | str_until (const std::string &str, char ch) |
Extract the part of the string until either the first occurrence of the specified character, or the end. More... | |
std::string | str_lower_case (const std::string &str) |
Convert the string to lower case. More... | |
std::string | str_upper_case (const std::string &str) |
Convert the string to upper case. More... | |
std::string | str_snake_case (const std::string &str) |
Convert the string to snake case (lowercase with underscores). More... | |
std::string | str_sanitize (const std::string &str) |
Sanitizes the input string by removing all characters but alphanumerics, dashes and underscores. More... | |
std::string | to_string (const std::string &val) |
Convert the value to a string (added as extra overload so that to_string() can be used on all stringifiable types). More... | |
std::string | __attribute__ ((format(printf, 1, 3))) str_snprintf(const char *fmt |
snprintf-like function returning std::string of maximum length len (excluding null terminator). More... | |
std::string size_t std::string | __attribute__ ((format(printf, 1, 2))) str_sprintf(const char *fmt |
sprintf-like function returning std::string. More... | |
Parsing & formatting | |
enum | ParseOnOffState { PARSE_NONE = 0, PARSE_ON, PARSE_OFF, PARSE_TOGGLE } |
Return values for parse_on_off(). More... | |
size_t | parse_hex (const char *str, size_t len, uint8_t *data, size_t count) |
Parse bytes from a hex-encoded string into a byte array. More... | |
std::string | format_hex (const uint8_t *data, size_t length) |
Format the byte array data of length len in lowercased hex. More... | |
std::string | format_hex (const std::vector< uint8_t > &data) |
Format the vector data in lowercased hex. More... | |
std::string | format_hex_pretty (const uint8_t *data, size_t length) |
Format the byte array data of length len in pretty-printed, human-readable hex. More... | |
std::string | format_hex_pretty (const std::vector< uint8_t > &data) |
Format the vector data in pretty-printed, human-readable hex. More... | |
std::string | format_hex_pretty (const uint16_t *data, size_t length) |
Format the word array data of length len in pretty-printed, human-readable hex. More... | |
std::string | format_hex_pretty (const std::vector< uint16_t > &data) |
Format the vector data in pretty-printed, human-readable hex. More... | |
ParseOnOffState | parse_on_off (const char *str, const char *on=nullptr, const char *off=nullptr) |
Parse a string that contains either on, off or toggle. More... | |
std::string | value_accuracy_to_string (float value, int8_t accuracy_decimals) |
Create a string from a value and an accuracy in decimals. More... | |
int8_t | step_to_accuracy_decimals (float step) |
Derive accuracy in decimals from an increment step. More... | |
std::string | base64_encode (const std::vector< uint8_t > &buf) |
std::string | base64_encode (const uint8_t *buf, size_t buf_len) |
size_t | base64_decode (const std::string &encoded_string, uint8_t *buf, size_t buf_len) |
std::vector< uint8_t > | base64_decode (const std::string &encoded_string) |
template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_unsigned< T >::value), int > = 0> | |
optional< T > | parse_number (const char *str) |
Parse an unsigned decimal number from a null-terminated string. More... | |
template<typename T , enable_if_t<(std::is_integral< T >::value &&std::is_unsigned< T >::value), int > = 0> | |
optional< T > | parse_number (const std::string &str) |
Parse an unsigned decimal number. More... | |
bool | parse_hex (const char *str, uint8_t *data, size_t count) |
Parse count bytes from the hex-encoded string str of at least 2*count characters into array data . More... | |
bool | parse_hex (const std::string &str, uint8_t *data, size_t count) |
Parse count bytes from the hex-encoded string str of at least 2*count characters into array data . More... | |
bool | parse_hex (const char *str, std::vector< uint8_t > &data, size_t count) |
Parse count bytes from the hex-encoded string str of at least 2*count characters into vector data . More... | |
bool | parse_hex (const std::string &str, std::vector< uint8_t > &data, size_t count) |
Parse count bytes from the hex-encoded string str of at least 2*count characters into vector data . More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
optional< T > | parse_hex (const char *str, size_t len) |
Parse a hex-encoded string into an unsigned integer. More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
optional< T > | parse_hex (const char *str) |
Parse a hex-encoded null-terminated string (starting with the most significant byte) into an unsigned integer. More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
optional< T > | parse_hex (const std::string &str) |
Parse a hex-encoded null-terminated string (starting with the most significant byte) into an unsigned integer. More... | |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
std::string | format_hex (T val) |
Format an unsigned integer in lowercased hex, starting with the most significant byte. More... | |
template<std::size_t N> | |
std::string | format_hex (const std::array< uint8_t, N > &data) |
template<typename T , enable_if_t< std::is_unsigned< T >::value, int > = 0> | |
std::string | format_hex_pretty (T val) |
Format an unsigned integer in pretty-printed, human-readable hex, starting with the most significant byte. More... | |
Implementation of SPI Controller mode.
When the TEST_COMPONENT flag is defined we include some auto-test methods.
Author: Gustavo Ambrozio Based on work by: Atsushi Sasaki (https://github.com/aselectroworks/Arduino-FT6336U)
Used to test the software during development but can also be used in situ to test if the component is working correctly. For release we do not set it by default but you can set it by using the following lines in you configuration file:
using esphome::enable_if_t = typedef typename std::enable_if<B, T>::type |
using esphome::ExternalRAMAllocator = typedef RAMAllocator<T> |
using esphome::int16_be_t = typedef internal::BigEndianLayout<int16_t> |
Definition at line 51 of file datatypes.h.
using esphome::int16_le_t = typedef internal::LittleEndianLayout<int16_t> |
Definition at line 59 of file datatypes.h.
using esphome::int24_be_t = typedef internal::BigEndianLayout<int24_t> |
Definition at line 50 of file datatypes.h.
using esphome::int24_le_t = typedef internal::LittleEndianLayout<int24_t> |
Definition at line 58 of file datatypes.h.
using esphome::int32_be_t = typedef internal::BigEndianLayout<int32_t> |
Definition at line 49 of file datatypes.h.
using esphome::int32_le_t = typedef internal::LittleEndianLayout<int32_t> |
Definition at line 57 of file datatypes.h.
using esphome::int64_be_t = typedef internal::BigEndianLayout<int64_t> |
Definition at line 48 of file datatypes.h.
using esphome::int64_le_t = typedef internal::LittleEndianLayout<int64_t> |
Definition at line 56 of file datatypes.h.
using esphome::uint16_be_t = typedef internal::BigEndianLayout<uint16_t> |
Definition at line 47 of file datatypes.h.
using esphome::uint16_le_t = typedef internal::LittleEndianLayout<uint16_t> |
Definition at line 55 of file datatypes.h.
using esphome::uint24_be_t = typedef internal::BigEndianLayout<uint24_t> |
Definition at line 46 of file datatypes.h.
using esphome::uint24_le_t = typedef internal::LittleEndianLayout<uint24_t> |
Definition at line 54 of file datatypes.h.
using esphome::uint32_be_t = typedef internal::BigEndianLayout<uint32_t> |
Definition at line 45 of file datatypes.h.
using esphome::uint32_le_t = typedef internal::LittleEndianLayout<uint32_t> |
Definition at line 53 of file datatypes.h.
using esphome::uint64_be_t = typedef internal::BigEndianLayout<uint64_t> |
Definition at line 44 of file datatypes.h.
using esphome::uint64_le_t = typedef internal::LittleEndianLayout<uint64_t> |
Definition at line 52 of file datatypes.h.
enum esphome::EntityCategory : uint8_t |
Enumerator | |
---|---|
ENTITY_CATEGORY_NONE | |
ENTITY_CATEGORY_CONFIG | |
ENTITY_CATEGORY_DIAGNOSTIC |
Definition at line 9 of file entity_base.h.
Return values for parse_on_off().
Enumerator | |
---|---|
PARSE_NONE | |
PARSE_ON | |
PARSE_OFF | |
PARSE_TOGGLE |
|
strong |
Enumerator | |
---|---|
DONE | |
RETRY |
Definition at line 66 of file component.h.
void esphome::__attribute__ | ( | (noreturn) | ) |
struct esphome::uint24_t esphome::__attribute__ | ( | (packed) | ) |
std::string esphome::__attribute__ | ( | (format(printf, 1, 3)) | ) | const |
snprintf-like function returning std::string of maximum length len
(excluding null terminator).
std::string size_t std::string esphome::__attribute__ | ( | (format(printf, 1, 2)) | ) | const |
sprintf-like function returning std::string.
bool esphome::api_is_connected | ( | ) |
size_t esphome::base64_decode | ( | const std::string & | encoded_string, |
uint8_t * | buf, | ||
size_t | buf_len | ||
) |
Definition at line 487 of file helpers.cpp.
std::vector< uint8_t > esphome::base64_decode | ( | const std::string & | encoded_string | ) |
Definition at line 497 of file helpers.cpp.
std::string esphome::base64_encode | ( | const std::vector< uint8_t > & | buf | ) |
Definition at line 445 of file helpers.cpp.
std::string esphome::base64_encode | ( | const uint8_t * | buf, |
size_t | buf_len | ||
) |
Definition at line 447 of file helpers.cpp.
To esphome::bit_cast | ( | const From & | src | ) |
constexpr14 T esphome::byteswap | ( | T | n | ) |
constexpr14 uint8_t esphome::byteswap | ( | uint8_t | n | ) |
constexpr14 uint16_t esphome::byteswap | ( | uint16_t | n | ) |
constexpr14 uint32_t esphome::byteswap | ( | uint32_t | n | ) |
constexpr14 uint64_t esphome::byteswap | ( | uint64_t | n | ) |
constexpr14 int8_t esphome::byteswap | ( | int8_t | n | ) |
constexpr14 int16_t esphome::byteswap | ( | int16_t | n | ) |
constexpr14 int32_t esphome::byteswap | ( | int32_t | n | ) |
constexpr14 int64_t esphome::byteswap | ( | int64_t | n | ) |
constexpr float esphome::celsius_to_fahrenheit | ( | float | value | ) |
constexpr const T& esphome::clamp | ( | const T & | v, |
const T & | lo, | ||
const T & | hi, | ||
Compare | comp | ||
) |
constexpr const T& esphome::clamp | ( | const T & | v, |
const T & | lo, | ||
const T & | hi | ||
) |
constexpr14 T esphome::convert_big_endian | ( | T | val | ) |
constexpr14 T esphome::convert_little_endian | ( | T | val | ) |
void esphome::convertToJson | ( | const StringRef & | src, |
JsonVariant | dst | ||
) |
Definition at line 8 of file string_ref.cpp.
uint16_t esphome::crc16 | ( | const uint8_t * | data, |
uint16_t | len, | ||
uint16_t | crc, | ||
uint16_t | reverse_poly, | ||
bool | refin, | ||
bool | refout | ||
) |
Calculate a CRC-16 checksum of data
with size len
.
Definition at line 111 of file helpers.cpp.
uint16_t esphome::crc16be | ( | const uint8_t * | data, |
uint16_t | len, | ||
uint16_t | crc, | ||
uint16_t | poly, | ||
bool | refin, | ||
bool | refout | ||
) |
Definition at line 149 of file helpers.cpp.
uint8_t esphome::crc8 | ( | const uint8_t * | data, |
uint8_t | len | ||
) |
Calculate a CRC-8 checksum of data
with size len
.
Definition at line 95 of file helpers.cpp.
uint8_t esphome::days_in_month | ( | uint8_t | month, |
uint16_t | year | ||
) |
constexpr14 std::array<uint8_t, sizeof(T)> esphome::decode_value | ( | T | val | ) |
void esphome::delay_microseconds_safe | ( | uint32_t | us | ) |
Delay for the given amount of microseconds, possibly yielding to other processes during the wait.
Definition at line 753 of file helpers.cpp.
constexpr uint16_t esphome::encode_uint16 | ( | uint8_t | msb, |
uint8_t | lsb | ||
) |
constexpr uint32_t esphome::encode_uint24 | ( | uint8_t | byte1, |
uint8_t | byte2, | ||
uint8_t | byte3 | ||
) |
constexpr uint32_t esphome::encode_uint32 | ( | uint8_t | byte1, |
uint8_t | byte2, | ||
uint8_t | byte3, | ||
uint8_t | byte4 | ||
) |
constexpr14 T esphome::encode_value | ( | const uint8_t * | bytes | ) |
constexpr14 T esphome::encode_value | ( | const std::array< uint8_t, sizeof(T)> | bytes | ) |
int esphome::esp_idf_log_vprintf_ | ( | const char * | format, |
va_list | args | ||
) |
void esphome::esp_log_printf_ | ( | int | level, |
const char * | tag, | ||
int | line, | ||
const char * | format, | ||
... | |||
) |
void void esphome::esp_log_printf_ | ( | int | level, |
const char * | tag, | ||
int | line, | ||
const __FlashStringHelper * | format, | ||
... | |||
) |
void esphome::esp_log_vprintf_ | ( | int | level, |
const char * | tag, | ||
int | line, | ||
const char * | format, | ||
va_list | args | ||
) |
void esphome::esp_log_vprintf_ | ( | int | level, |
const char * | tag, | ||
int | line, | ||
const __FlashStringHelper * | format, | ||
va_list | args | ||
) |
esphome::ESPDEPRECATED | ( | "Use Color::BLACK instead of COLOR_BLACK" | , |
"v1.21" | |||
) | const |
esphome::ESPDEPRECATED | ( | "Use Color::WHITE instead of COLOR_WHITE" | , |
"v1.21" | |||
) | const |
esphome::ESPDEPRECATED | ( | "hexencode() is | deprecated, |
use format_hex_pretty() instead." | , | ||
"2022.1" | |||
) |
constexpr float esphome::fahrenheit_to_celsius | ( | float | value | ) |
uint32_t esphome::fnv1_hash | ( | const std::string & | str | ) |
Calculate a FNV-1 hash of str
.
Definition at line 183 of file helpers.cpp.
std::string esphome::format_hex | ( | const uint8_t * | data, |
size_t | length | ||
) |
Format the byte array data
of length len
in lowercased hex.
Definition at line 352 of file helpers.cpp.
std::string esphome::format_hex | ( | const std::vector< uint8_t > & | data | ) |
Format the vector data
in lowercased hex.
Definition at line 361 of file helpers.cpp.
std::string esphome::format_hex | ( | T | val | ) |
std::string esphome::format_hex | ( | const std::array< uint8_t, N > & | data | ) |
std::string esphome::format_hex_pretty | ( | const uint8_t * | data, |
size_t | length | ||
) |
Format the byte array data
of length len
in pretty-printed, human-readable hex.
Definition at line 364 of file helpers.cpp.
std::string esphome::format_hex_pretty | ( | const std::vector< uint8_t > & | data | ) |
Format the vector data
in pretty-printed, human-readable hex.
Definition at line 379 of file helpers.cpp.
std::string esphome::format_hex_pretty | ( | const uint16_t * | data, |
size_t | length | ||
) |
Format the word array data
of length len
in pretty-printed, human-readable hex.
Definition at line 381 of file helpers.cpp.
std::string esphome::format_hex_pretty | ( | const std::vector< uint16_t > & | data | ) |
Format the vector data
in pretty-printed, human-readable hex.
Definition at line 398 of file helpers.cpp.
std::string esphome::format_hex_pretty | ( | T | val | ) |
float esphome::gamma_correct | ( | float | value, |
float | gamma | ||
) |
Applies gamma correction of gamma
to value
.
Definition at line 542 of file helpers.cpp.
float esphome::gamma_uncorrect | ( | float | value, |
float | gamma | ||
) |
Reverts gamma correction of gamma
to value
.
Definition at line 550 of file helpers.cpp.
std::string esphome::get_mac_address | ( | ) |
Get the device MAC address as a string, in lowercase hex notation.
Definition at line 706 of file helpers.cpp.
std::string esphome::get_mac_address_pretty | ( | ) |
Get the device MAC address as a string, in colon-separated uppercase hex notation.
Definition at line 712 of file helpers.cpp.
void esphome::get_mac_address_raw | ( | uint8_t * | mac | ) |
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).
Definition at line 668 of file helpers.cpp.
bool esphome::has_custom_mac_address | ( | ) |
Check if a custom MAC address is set (ESP32 & variants)
Definition at line 722 of file helpers.cpp.
void esphome::hsv_to_rgb | ( | int | hue, |
float | saturation, | ||
float | value, | ||
float & | red, | ||
float & | green, | ||
float & | blue | ||
) |
Convert hue
(0-360), saturation
(0-1) and value
(0-1) to red
, green
and blue
(all 0-1).
Definition at line 582 of file helpers.cpp.
T esphome::id | ( | T | value | ) |
T& esphome::id | ( | T * | value | ) |
bool esphome::increment_time_value | ( | T & | current, |
uint16_t | begin, | ||
uint16_t | end | ||
) |
float esphome::lerp | ( | float | completion, |
float | start, | ||
float | end | ||
) |
Linearly interpolate between start
and end
by completion
(between 0 and 1).
Definition at line 94 of file helpers.cpp.
bool esphome::mac_address_is_valid | ( | const uint8_t * | mac | ) |
Check if the MAC address is not all zeros or all ones.
Definition at line 736 of file helpers.cpp.
|
inline |
Definition at line 213 of file optional.h.
std::unique_ptr<T> esphome::make_unique | ( | Args &&... | args | ) |
bool esphome::mqtt_is_connected | ( | ) |
const nullopt_t esphome::nullopt | ( | (nullopt_t::init()) | ) |
Definition at line 99 of file string_ref.h.
|
inline |
Definition at line 101 of file string_ref.h.
|
inline |
Definition at line 103 of file string_ref.h.
|
inline |
Definition at line 105 of file string_ref.h.
|
inline |
Definition at line 107 of file string_ref.h.
|
inline |
Definition at line 117 of file optional.h.
Definition at line 137 of file optional.h.
Definition at line 139 of file optional.h.
|
inline |
Definition at line 167 of file optional.h.
|
inline |
Definition at line 171 of file optional.h.
|
inline |
Definition at line 118 of file string_ref.h.
|
inline |
Definition at line 124 of file string_ref.h.
|
inline |
Definition at line 113 of file string_ref.h.
Definition at line 109 of file string_ref.h.
|
inline |
Definition at line 121 of file optional.h.
Definition at line 141 of file optional.h.
Definition at line 143 of file optional.h.
|
inline |
Definition at line 175 of file optional.h.
|
inline |
Definition at line 179 of file optional.h.
|
inline |
Definition at line 127 of file optional.h.
Definition at line 145 of file optional.h.
Definition at line 147 of file optional.h.
|
inline |
Definition at line 183 of file optional.h.
|
inline |
Definition at line 187 of file optional.h.
Definition at line 83 of file string_ref.h.
|
inline |
Definition at line 87 of file string_ref.h.
|
inline |
Definition at line 91 of file string_ref.h.
|
inline |
Definition at line 93 of file string_ref.h.
|
inline |
Definition at line 97 of file string_ref.h.
|
inline |
Definition at line 113 of file optional.h.
Definition at line 133 of file optional.h.
Definition at line 135 of file optional.h.
|
inline |
Definition at line 159 of file optional.h.
|
inline |
Definition at line 163 of file optional.h.
|
inline |
Definition at line 125 of file optional.h.
Definition at line 149 of file optional.h.
Definition at line 151 of file optional.h.
|
inline |
Definition at line 191 of file optional.h.
|
inline |
Definition at line 195 of file optional.h.
|
inline |
Definition at line 129 of file optional.h.
Definition at line 153 of file optional.h.
Definition at line 155 of file optional.h.
|
inline |
Definition at line 199 of file optional.h.
|
inline |
Definition at line 203 of file optional.h.
size_t esphome::parse_hex | ( | const char * | str, |
size_t | len, | ||
uint8_t * | data, | ||
size_t | count | ||
) |
Parse bytes from a hex-encoded string into a byte array.
When len
is less than 2*count
, the result is written to the back of data
(i.e. this function treats str
as if it were padded with zeros at the front).
str | String to read from. |
len | Length of str (excluding optional null-terminator), is a limit on the number of characters parsed. |
data | Byte array to write to. |
count | Length of data . |
str
. Definition at line 333 of file helpers.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
optional<T> esphome::parse_hex | ( | const char * | str, |
size_t | len | ||
) |
optional<T> esphome::parse_hex | ( | const char * | str | ) |
optional<T> esphome::parse_hex | ( | const std::string & | str | ) |
optional< T > esphome::parse_number | ( | const char * | str | ) |
optional< T > esphome::parse_number | ( | const std::string & | str | ) |
ParseOnOffState esphome::parse_on_off | ( | const char * | str, |
const char * | on, | ||
const char * | off | ||
) |
Parse a string that contains either on, off or toggle.
Definition at line 400 of file helpers.cpp.
bool esphome::random_bytes | ( | uint8_t * | data, |
size_t | len | ||
) |
Generate len
number of random bytes.
Definition at line 217 of file helpers.cpp.
float esphome::random_float | ( | ) |
Return a random float between 0 and 1.
Definition at line 215 of file helpers.cpp.
uint32_t esphome::random_uint32 | ( | ) |
Return a random 32-bit unsigned integer.
Definition at line 193 of file helpers.cpp.
T esphome::remap | ( | U | value, |
U | min, | ||
U | max, | ||
T | min_out, | ||
T | max_out | ||
) |
bool esphome::remote_is_connected | ( | ) |
|
inline |
|
inline |
|
inline |
void esphome::rgb_to_hsv | ( | float | red, |
float | green, | ||
float | blue, | ||
int & | hue, | ||
float & | saturation, | ||
float & | value | ||
) |
Convert red
, green
and blue
(all 0-1) values to hue
(0-360), saturation
(0-1) and value
(0-1).
Definition at line 559 of file helpers.cpp.
void esphome::set_mac_address | ( | uint8_t * | mac | ) |
Set the MAC address to use from the provided byte array (6 bytes).
Definition at line 719 of file helpers.cpp.
int8_t esphome::step_to_accuracy_decimals | ( | float | step | ) |
Derive accuracy in decimals from an increment step.
Definition at line 426 of file helpers.cpp.
std::string esphome::str_ctype_transform | ( | const std::string & | str | ) |
Definition at line 276 of file helpers.cpp.
bool esphome::str_endswith | ( | const std::string & | str, |
const std::string & | end | ||
) |
Check whether a string ends with a value.
Definition at line 263 of file helpers.cpp.
bool esphome::str_equals_case_insensitive | ( | const std::string & | a, |
const std::string & | b | ||
) |
Compare strings for equality in case-insensitive manner.
Definition at line 259 of file helpers.cpp.
std::string esphome::str_lower_case | ( | const std::string & | str | ) |
Convert the string to lower case.
Definition at line 282 of file helpers.cpp.
std::string esphome::str_sanitize | ( | const std::string & | str | ) |
Sanitizes the input string by removing all characters but alphanumerics, dashes and underscores.
Definition at line 291 of file helpers.cpp.
std::string esphome::str_snake_case | ( | const std::string & | str | ) |
Convert the string to snake case (lowercase with underscores).
Definition at line 284 of file helpers.cpp.
std::string esphome::str_snprintf | ( | const char * | fmt, |
size_t | len, | ||
... | |||
) |
Definition at line 301 of file helpers.cpp.
std::string esphome::str_sprintf | ( | const char * | fmt, |
... | |||
) |
Definition at line 315 of file helpers.cpp.
bool esphome::str_startswith | ( | const std::string & | str, |
const std::string & | start | ||
) |
Check whether a string starts with a value.
Definition at line 262 of file helpers.cpp.
std::string esphome::str_truncate | ( | const std::string & | str, |
size_t | length | ||
) |
Truncate a string to a specific length.
Definition at line 266 of file helpers.cpp.
std::string esphome::str_until | ( | const char * | str, |
char | ch | ||
) |
Extract the part of the string until either the first occurrence of the specified character, or the end (requires str to be null-terminated).
Definition at line 269 of file helpers.cpp.
std::string esphome::str_until | ( | const std::string & | str, |
char | ch | ||
) |
Extract the part of the string until either the first occurrence of the specified character, or the end.
Definition at line 273 of file helpers.cpp.
std::string esphome::str_upper_case | ( | const std::string & | str | ) |
Convert the string to upper case.
Definition at line 283 of file helpers.cpp.
Definition at line 209 of file optional.h.
std::string esphome::to_string | ( | int | value | ) |
Definition at line 81 of file helpers.cpp.
std::string esphome::to_string | ( | long | value | ) |
Definition at line 82 of file helpers.cpp.
std::string esphome::to_string | ( | long long | value | ) |
Definition at line 83 of file helpers.cpp.
std::string esphome::to_string | ( | unsigned | value | ) |
Definition at line 84 of file helpers.cpp.
std::string esphome::to_string | ( | unsigned long | value | ) |
Definition at line 85 of file helpers.cpp.
std::string esphome::to_string | ( | unsigned long long | value | ) |
Definition at line 86 of file helpers.cpp.
std::string esphome::to_string | ( | float | value | ) |
Definition at line 87 of file helpers.cpp.
std::string esphome::to_string | ( | double | value | ) |
Definition at line 88 of file helpers.cpp.
std::string esphome::to_string | ( | long double | value | ) |
Definition at line 89 of file helpers.cpp.
|
inline |
Convert the value to a string (added as extra overload so that to_string() can be used on all stringifiable types).
std::string esphome::value_accuracy_to_string | ( | float | value, |
int8_t | accuracy_decimals | ||
) |
Create a string from a value and an accuracy in decimals.
Definition at line 415 of file helpers.cpp.
struct esphome::int24_t esphome::__attribute__ |
Application esphome::App |
Global storage of Application pointer - only one Application can exist.
Definition at line 153 of file application.cpp.
const Color esphome::COLOR_BLACK(0, 0, 0, 0) |
const Color esphome::COLOR_WHITE(255, 255, 255, 255) |
const uint32_t esphome::COMPONENT_STATE_CONSTRUCTION = 0x00 |
Definition at line 33 of file component.cpp.
const uint32_t esphome::COMPONENT_STATE_FAILED = 0x03 |
Definition at line 36 of file component.cpp.
const uint32_t esphome::COMPONENT_STATE_LOOP = 0x02 |
Definition at line 35 of file component.cpp.
const uint32_t esphome::COMPONENT_STATE_MASK = 0xFF |
Definition at line 32 of file component.cpp.
const uint32_t esphome::COMPONENT_STATE_SETUP = 0x01 |
Definition at line 34 of file component.cpp.
ESPPreferences * esphome::global_preferences |
Definition at line 195 of file preferences.cpp.
uint32_t esphome::global_state = 0 |
Definition at line 42 of file component.cpp.
const uint32_t esphome::STATUS_LED_ERROR = 0x0200 |
Definition at line 40 of file component.cpp.
const uint32_t esphome::STATUS_LED_MASK = 0xFF00 |
Definition at line 37 of file component.cpp.
const uint32_t esphome::STATUS_LED_OK = 0x0000 |
Definition at line 38 of file component.cpp.
const uint32_t esphome::STATUS_LED_WARNING = 0x0100 |
Definition at line 39 of file component.cpp.