ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
remote_transmitter.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <vector>
7
8#if defined(USE_ESP32)
9#include <driver/rmt_tx.h>
10#endif
11
12namespace esphome {
13namespace remote_transmitter {
14
16 public Component
17#ifdef USE_ESP32
18 ,
20#endif
21{
22 public:
24 void setup() override;
25
26 void dump_config() override;
27
28 // transmitter setup must run after receiver setup to allow the same GPIO to be used by both
29 float get_setup_priority() const override { return setup_priority::DATA - 1; }
30
31 void set_carrier_duty_percent(uint8_t carrier_duty_percent) { this->carrier_duty_percent_ = carrier_duty_percent; }
32
33 void digital_write(bool value);
34
35#if defined(USE_ESP32)
36 void set_with_dma(bool with_dma) { this->with_dma_ = with_dma; }
37 void set_eot_level(bool eot_level) { this->eot_level_ = eot_level; }
38#endif
39
42
43 protected:
44 void send_internal(uint32_t send_times, uint32_t send_wait) override;
45#if defined(USE_ESP8266) || defined(USE_LIBRETINY)
46 void calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period);
47
48 void mark_(uint32_t on_time, uint32_t off_time, uint32_t usec);
49
50 void space_(uint32_t usec);
51
52 void await_target_time_();
53 uint32_t target_time_;
54#endif
55
56#ifdef USE_ESP32
57 void configure_rmt_();
58
60 bool initialized_{false};
61 std::vector<rmt_symbol_word_t> rmt_temp_;
62 bool with_dma_{false};
63 bool eot_level_{false};
64 rmt_channel_handle_t channel_{NULL};
65 rmt_encoder_handle_t encoder_{NULL};
66 esp_err_t error_code_{ESP_OK};
67 std::string error_string_{""};
68 bool inverted_{false};
69#endif
71
74};
75
76} // namespace remote_transmitter
77} // namespace esphome
void send_internal(uint32_t send_times, uint32_t send_wait) override
void calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period)
void mark_(uint32_t on_time, uint32_t off_time, uint32_t usec)
void set_carrier_duty_percent(uint8_t carrier_duty_percent)
const float DATA
For components that import data from directly connected sensors like DHT.
Definition component.cpp:50
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7