ESPHome  2024.9.2
remote_transmitter.h
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <vector>
7 
8 namespace esphome {
9 namespace remote_transmitter {
10 
12  public Component
13 #ifdef USE_ESP32
14  ,
16 #endif
17 {
18  public:
19 #ifdef USE_ESP32
20  RemoteTransmitterComponent(InternalGPIOPin *pin, uint8_t mem_block_num = 1)
21  : remote_base::RemoteTransmitterBase(pin), remote_base::RemoteRMTChannel(mem_block_num) {}
22 
23  RemoteTransmitterComponent(InternalGPIOPin *pin, rmt_channel_t channel, uint8_t mem_block_num = 1)
24  : remote_base::RemoteTransmitterBase(pin), remote_base::RemoteRMTChannel(channel, mem_block_num) {}
25 #else
27 #endif
28  void setup() override;
29 
30  void dump_config() override;
31 
32  float get_setup_priority() const override { return setup_priority::DATA; }
33 
34  void set_carrier_duty_percent(uint8_t carrier_duty_percent) { this->carrier_duty_percent_ = carrier_duty_percent; }
35 
36  protected:
37  void send_internal(uint32_t send_times, uint32_t send_wait) override;
38 #if defined(USE_ESP8266) || defined(USE_LIBRETINY)
39  void calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period);
40 
41  void mark_(uint32_t on_time, uint32_t off_time, uint32_t usec);
42 
43  void space_(uint32_t usec);
44 
45  void await_target_time_();
46  uint32_t target_time_;
47 #endif
48 
49 #ifdef USE_ESP32
50  void configure_rmt_();
51 
52  uint32_t current_carrier_frequency_{38000};
53  bool initialized_{false};
54  std::vector<rmt_item32_t> rmt_temp_;
55  esp_err_t error_code_{ESP_OK};
56  std::string error_string_{""};
57  bool inverted_{false};
58 #endif
60 };
61 
62 } // namespace remote_transmitter
63 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
void calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period)
void set_carrier_duty_percent(uint8_t carrier_duty_percent)
void send_internal(uint32_t send_times, uint32_t send_wait) override
RemoteTransmitterComponent(InternalGPIOPin *pin, uint8_t mem_block_num=1)
RemoteTransmitterComponent(InternalGPIOPin *pin, rmt_channel_t channel, uint8_t mem_block_num=1)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void mark_(uint32_t on_time, uint32_t off_time, uint32_t usec)