15#if defined(ESP32) || defined(USE_ESP_IDF)
16#include "driver/timer.h"
22template<
class T>
constexpr T
read_bit(T value, uint8_t bit) {
return (value >> bit) & 0x01; }
24template<
class T>
constexpr T
set_bit(T value, uint8_t bit) {
return value |= (1UL << bit); }
26template<
class T>
constexpr T
clear_bit(T value, uint8_t bit) {
return value &= ~(1UL << bit); }
28template<
class T>
constexpr T
write_bit(T value, uint8_t bit, uint8_t bit_value) {
200 void f88(
float value);
210 void u16(uint16_t value);
220 void s16(int16_t value);
359#if defined(ESP32) || defined(USE_ESP_IDF)
360 timer_group_t timer_group_;
361 timer_idx_t timer_idx_;
370 int32_t timeout_counter_;
371 int32_t device_timeout_;
373#if defined(ESP32) || defined(USE_ESP_IDF)
374 esp_err_t timer_error_ = ESP_OK;
377 bool init_esp32_timer_();
378 void start_esp32_timer_(uint64_t alarm_value);
384 void start_read_timer_();
385 void start_write_timer_();
386 bool check_parity_(uint32_t
val);
388 void bit_read_(uint8_t value);
390 void write_bit_(uint8_t high, uint8_t clock);
BedjetMode mode
BedJet operating mode.
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
Opentherm static class that supports either listening or sending Opentherm data packets in the same t...
bool is_timeout()
Indicates whether last listen() or send() operation ends up with a timeout error.
void debug_error(OpenThermError &error) const
const char * message_id_to_str(MessageId id)
void listen()
Start listening for Opentherm data packet comming from line connected to given pin.
void report_and_reset_timer_error()
bool is_idle()
Indicates whether listinig or sending is not in progress.
bool get_message(OpenthermData &data)
Use this to retrive data packed captured by listen() function.
static bool timer_isr(OpenTherm *arg)
void send(OpenthermData &data)
Immediately send out Opentherm data packet to line connected on given pin.
const char * timer_error_to_str(TimerErrorType error_type)
bool is_timer_error()
Indicates whether start_esp32_timer_() or stop_timer_() had an error.
bool initialize()
Setup pins.
bool is_sent()
Use this function to check whether send() function already finished sending data packed to line.
const char * operation_mode_to_str(OperationMode mode)
OpenTherm(InternalGPIOPin *in_pin, InternalGPIOPin *out_pin, int32_t device_timeout=800)
void debug_data(OpenthermData &data)
bool has_message()
Use this function to check whether listen() function already captured a valid data packet.
const char * protocol_error_to_str(ProtocolErrorType error_type)
bool is_protocol_error()
Indicates whether last listen() or send() operation ends up with a protocol error.
static void esp8266_timer_isr()
const char * message_type_to_str(MessageType message_type)
bool get_protocol_error(OpenThermError &error)
Get protocol error details in case a protocol error occured.
void stop()
Stops listening for data packet or sending out data packet and resets internal state of this class.
bool is_error()
Indicates whether last listen() or send() operation ends up with an error.
constexpr T clear_bit(T value, uint8_t bit)
constexpr T write_bit(T value, uint8_t bit, uint8_t bit_value)
@ SET_COUNTER_VALUE_ERROR
constexpr T set_bit(T value, uint8_t bit)
constexpr T read_bit(T value, uint8_t bit)
@ REMOTE_VENTILATION_PARAM
Providing packet encoding functions for exchanging data with a remote host.
ProtocolErrorType error_type
Structure to hold Opentherm data packet content.