16#include "driver/gptimer.h"
21template<
class T>
constexpr T
read_bit(T value, uint8_t bit) {
return (value >> bit) & 0x01; }
339 static bool timer_isr(gptimer_handle_t timer,
const gptimer_alarm_event_data_t *edata,
void *user_ctx);
355 gptimer_handle_t timer_handle_{
nullptr};
356 gptimer_alarm_config_t alarm_config_{
359 .flags = {.auto_reload_on_alarm =
true},
369 int32_t timeout_counter_;
370 int32_t device_timeout_;
373 esp_err_t timer_error_ = ESP_OK;
376 bool init_esp32_timer_();
377 void start_esp32_timer_(uint64_t alarm_value);
383 void start_read_timer_();
384 void start_write_timer_();
387 void bit_read_(uint8_t value);
389 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.
static void esp8266_timer_isr()
void report_and_reset_timer_error()
static bool timer_isr(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_ctx)
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.
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.
static bool timer_isr(OpenTherm *arg)
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.
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.
@ SET_COUNTER_VALUE_ERROR
constexpr T read_bit(T value, uint8_t bit)
@ REMOTE_VENTILATION_PARAM
ProtocolErrorType error_type
Structure to hold Opentherm data packet content.
void set_s16(int16_t value)
void set_u16(uint16_t value)
void set_f88(float value)