9static const char *
const TAG =
"remote_base";
11#if defined(USE_ESP32) && ESP_IDF_VERSION_MAJOR < 5
13 static rmt_channel_t next_rmt_channel = RMT_CHANNEL_0;
15 next_rmt_channel = rmt_channel_t(
int(next_rmt_channel) + mem_block_num);
19 : channel_(channel), mem_block_num_(mem_block_num) {}
24 ESP_LOGW(TAG,
"Not enough RMT memory blocks available, reduced to %i blocks.", this->
mem_block_num_);
37 const int32_t value = this->
peek(offset);
40 return value >= 0 && lo <= value && value <= hi;
46 const int32_t value = this->
peek(offset);
49 return value <= 0 && lo <= -value && -value <= hi;
55 const int32_t value = this->
peek(offset);
57 return value <= 0 && lo <= -value;
115 bool success =
false;
116 for (
auto *dumper : this->
dumpers_) {
129#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
132 uint32_t buffer_offset = 0;
133 buffer_offset += sprintf(buffer,
"Sending times=%" PRIu32
" wait=%" PRIu32
"ms: ", send_times, send_wait);
135 for (
size_t i = 0; i < vec.size(); i++) {
136 const int32_t value = vec[i];
137 const uint32_t remaining_length =
sizeof(buffer) - buffer_offset;
140 if (i + 1 < vec.size()) {
141 written = snprintf(buffer + buffer_offset, remaining_length,
"%" PRId32
", ", value);
143 written = snprintf(buffer + buffer_offset, remaining_length,
"%" PRId32, value);
146 if (written < 0 || written >=
int(remaining_length)) {
148 buffer[buffer_offset] =
'\0';
149 ESP_LOGVV(TAG,
"%s", buffer);
151 written = sprintf(buffer,
" ");
152 if (i + 1 < vec.size()) {
153 written += sprintf(buffer + written,
"%" PRId32
", ", value);
155 written += sprintf(buffer + written,
"%" PRId32, value);
159 buffer_offset += written;
161 if (buffer_offset != 0) {
162 ESP_LOGVV(TAG,
"%s", buffer);
void publish_state(bool state)
Publish a new state to the front-end.
void config_rmt(rmt_config_t &rmt)
RemoteRMTChannel(uint8_t mem_block_num=1)
bool expect_item(uint32_t mark, uint32_t space)
bool peek_space(uint32_t length, uint32_t offset=0) const
int32_t peek(uint32_t offset=0) const
bool peek_item(uint32_t mark, uint32_t space, uint32_t offset=0) const
bool expect_space(uint32_t length)
int32_t upper_bound_(uint32_t length) const
bool expect_mark(uint32_t length)
bool is_valid(uint32_t offset=0) const
void advance(uint32_t amount=1)
bool peek_space_at_least(uint32_t length, uint32_t offset=0) const
int32_t lower_bound_(uint32_t length) const
bool peek_mark(uint32_t length, uint32_t offset=0) const
bool expect_pulse_with_gap(uint32_t mark, uint32_t space)
ToleranceMode tolerance_mode_
std::vector< RemoteReceiverDumperBase * > dumpers_
std::vector< RemoteReceiverListener * > listeners_
void register_dumper(RemoteReceiverDumperBase *dumper)
std::vector< RemoteReceiverDumperBase * > secondary_dumpers_
virtual bool matches(RemoteReceiveData src)=0
bool on_receive(RemoteReceiveData src) override
void dump_config() override
virtual bool is_secondary()
const RawTimings & get_data() const
void send_(uint32_t send_times, uint32_t send_wait)
virtual void send_internal(uint32_t send_times, uint32_t send_wait)=0
RemoteTransmitData temp_
Use same vector for all transmits, avoids many allocations.
Providing packet encoding functions for exchanging data with a remote host.
void IRAM_ATTR HOT yield()