ESPHome  2024.11.1
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  Trigger<> *get_transmit_trigger() const { return this->transmit_trigger_; };
37  Trigger<> *get_complete_trigger() const { return this->complete_trigger_; };
38 
39  protected:
40  void send_internal(uint32_t send_times, uint32_t send_wait) override;
41 #if defined(USE_ESP8266) || defined(USE_LIBRETINY)
42  void calculate_on_off_time_(uint32_t carrier_frequency, uint32_t *on_time_period, uint32_t *off_time_period);
43 
44  void mark_(uint32_t on_time, uint32_t off_time, uint32_t usec);
45 
46  void space_(uint32_t usec);
47 
48  void await_target_time_();
49  uint32_t target_time_;
50 #endif
51 
52 #ifdef USE_ESP32
53  void configure_rmt_();
54 
55  uint32_t current_carrier_frequency_{38000};
56  bool initialized_{false};
57  std::vector<rmt_item32_t> rmt_temp_;
58  esp_err_t error_code_{ESP_OK};
59  std::string error_string_{""};
60  bool inverted_{false};
61 #endif
63 
66 };
67 
68 } // namespace remote_transmitter
69 } // 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)