ESPHome
2025.2.0
|
Opentherm static class that supports either listening or sending Opentherm data packets in the same time. More...
#include <opentherm.h>
Public Member Functions | |
OpenTherm (InternalGPIOPin *in_pin, InternalGPIOPin *out_pin, int32_t device_timeout=800) | |
bool | initialize () |
Setup pins. More... | |
void | listen () |
Start listening for Opentherm data packet comming from line connected to given pin. More... | |
bool | has_message () |
Use this function to check whether listen() function already captured a valid data packet. More... | |
bool | get_message (OpenthermData &data) |
Use this to retrive data packed captured by listen() function. More... | |
void | send (OpenthermData &data) |
Immediately send out Opentherm data packet to line connected on given pin. More... | |
void | stop () |
Stops listening for data packet or sending out data packet and resets internal state of this class. More... | |
bool | get_protocol_error (OpenThermError &error) |
Get protocol error details in case a protocol error occured. More... | |
bool | is_sent () |
Use this function to check whether send() function already finished sending data packed to line. More... | |
bool | is_idle () |
Indicates whether listinig or sending is not in progress. More... | |
bool | is_error () |
Indicates whether last listen() or send() operation ends up with an error. More... | |
bool | is_timeout () |
Indicates whether last listen() or send() operation ends up with a timeout error. More... | |
bool | is_protocol_error () |
Indicates whether last listen() or send() operation ends up with a protocol error. More... | |
bool | is_timer_error () |
Indicates whether start_esp32_timer_() or stop_timer_() had an error. More... | |
bool | is_active () |
OperationMode | get_mode () |
void | debug_data (OpenthermData &data) |
void | debug_error (OpenThermError &error) const |
void | report_and_reset_timer_error () |
const char * | protocol_error_to_str (ProtocolErrorType error_type) |
const char * | timer_error_to_str (TimerErrorType error_type) |
const char * | message_type_to_str (MessageType message_type) |
const char * | operation_mode_to_str (OperationMode mode) |
const char * | message_id_to_str (MessageId id) |
Static Public Member Functions | |
static bool | timer_isr (OpenTherm *arg) |
static void | esp8266_timer_isr () |
Opentherm static class that supports either listening or sending Opentherm data packets in the same time.
Definition at line 234 of file opentherm.h.
esphome::opentherm::OpenTherm::OpenTherm | ( | InternalGPIOPin * | in_pin, |
InternalGPIOPin * | out_pin, | ||
int32_t | device_timeout = 800 |
||
) |
Definition at line 31 of file opentherm.cpp.
void esphome::opentherm::OpenTherm::debug_data | ( | OpenthermData & | data | ) |
Definition at line 568 of file opentherm.cpp.
void esphome::opentherm::OpenTherm::debug_error | ( | OpenThermError & | error | ) | const |
Definition at line 576 of file opentherm.cpp.
|
static |
Definition at line 217 of file opentherm.cpp.
bool esphome::opentherm::OpenTherm::get_message | ( | OpenthermData & | data | ) |
Use this to retrive data packed captured by listen() function.
Data packet is ready when has_message() function returns true. This function can be called multiple times until stop() is called.
data | reference to data structure to which fill the data packet data. |
Definition at line 95 of file opentherm.cpp.
|
inline |
Definition at line 335 of file opentherm.h.
bool esphome::opentherm::OpenTherm::get_protocol_error | ( | OpenThermError & | error | ) |
Get protocol error details in case a protocol error occured.
error | reference to data structure to which fill the error details |
Definition at line 106 of file opentherm.cpp.
|
inline |
Use this function to check whether listen() function already captured a valid data packet.
Definition at line 257 of file opentherm.h.
bool esphome::opentherm::OpenTherm::initialize | ( | ) |
Setup pins.
Definition at line 50 of file opentherm.cpp.
|
inline |
Definition at line 333 of file opentherm.h.
|
inline |
|
inline |
Indicates whether listinig or sending is not in progress.
That also means that no timers are running and no interrupts are attached.
Definition at line 303 of file opentherm.h.
|
inline |
|
inline |
Use this function to check whether send() function already finished sending data packed to line.
Definition at line 295 of file opentherm.h.
|
inline |
|
inline |
Indicates whether start_esp32_timer_() or stop_timer_() had an error.
Only relevant when used on ESP32.
Definition at line 331 of file opentherm.h.
void esphome::opentherm::OpenTherm::listen | ( | ) |
Start listening for Opentherm data packet comming from line connected to given pin.
If data packet is received then has_message() function returns true and data packet can be retrieved by calling get_message() function. If timeout > 0 then this function waits for incomming data package for timeout millis and if no data packet is recevived, error state is indicated by is_error() function. If either data packet is received or timeout is reached listening is stopped.
Definition at line 67 of file opentherm.cpp.
const char * esphome::opentherm::OpenTherm::message_id_to_str | ( | MessageId | id | ) |
Definition at line 468 of file opentherm.cpp.
const char * esphome::opentherm::OpenTherm::message_type_to_str | ( | MessageType | message_type | ) |
Definition at line 454 of file opentherm.cpp.
const char * esphome::opentherm::OpenTherm::operation_mode_to_str | ( | OperationMode | mode | ) |
Definition at line 417 of file opentherm.cpp.
const char * esphome::opentherm::OpenTherm::protocol_error_to_str | ( | ProtocolErrorType | error_type | ) |
Definition at line 432 of file opentherm.cpp.
void esphome::opentherm::OpenTherm::report_and_reset_timer_error | ( | ) |
Definition at line 332 of file opentherm.cpp.
void esphome::opentherm::OpenTherm::send | ( | OpenthermData & | data | ) |
Immediately send out Opentherm data packet to line connected on given pin.
Completed data transfer is indicated by is_sent() function. Error state is indicated by is_error() function.
data | Opentherm data packet. |
Definition at line 78 of file opentherm.cpp.
void esphome::opentherm::OpenTherm::stop | ( | ) |
Stops listening for data packet or sending out data packet and resets internal state of this class.
Stops all timers and unattaches all interrupts.
Definition at line 120 of file opentherm.cpp.
const char * esphome::opentherm::OpenTherm::timer_error_to_str | ( | TimerErrorType | error_type | ) |
Definition at line 443 of file opentherm.cpp.
|
static |
Definition at line 135 of file opentherm.cpp.