6#if (defined(USE_LIBRETINY) && !defined(USE_RTL87XX) && !defined(REMOTE_TRANSMITTER_BK_PWM)) || \
7 defined(USE_ESP8266) || defined(USE_RP2) || (defined(USE_ESP32) && !SOC_RMT_SUPPORTED)
16static constexpr bool LOCK_PER_EDGE =
true;
18static constexpr bool LOCK_PER_EDGE =
false;
20static constexpr int32_t EDGE_LOCK_US = 50;
29 "Remote Transmitter:\n"
30 " Carrier Duty: %u%%",
32 LOG_PIN(
" Pin: ", this->
pin_);
37 if (carrier_frequency == 0) {
42 uint32_t period = (1000000UL + carrier_frequency / 2) / carrier_frequency;
43 period = std::max(
uint32_t(1), period);
45 *off_time_period = period - *on_time_period;
52 }
else if ((int32_t) (this->
target_time_ - current_time) > lead_us) {
61 std::optional<InterruptLock> edge_lock;
82 if (LOCK_PER_EDGE && on_time > 0) {
83 const uint32_t period = on_time + off_time;
85 if ((int32_t) late >= (int32_t) period)
110 ESP_LOGD(TAG,
"Sending remote code");
114 for (
uint32_t i = 0; i < send_times; i++) {
116 std::optional<InterruptLock> frame_lock;
118 frame_lock.emplace();
137 if (i + 1 < send_times) {
142 while ((int32_t) (gap_end -
micros()) > 0) {
void feed_wdt()
Feed the task watchdog.
void trigger(const Ts &...x) ESPHOME_ALWAYS_INLINE
Inform the parent automation that the event has triggered.
void digital_write(bool value) override
uint32_t get_carrier_frequency() const
const RawTimings & get_data() const
RemoteTransmitData temp_
Use same vector for all transmits, avoids many allocations.
void send_internal(uint32_t send_times, uint32_t send_wait) override
void fire_complete_(bool sent=true)
void write_at_target_(bool value)
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)
Trigger transmit_trigger_
void await_target_time_(int32_t lead_us=0)
void space_(uint32_t usec)
void digital_write(bool value)
uint8_t carrier_duty_percent_
void dump_config() override
ESPHOME_LOG_TAG(TAG, "remote_transmitter")
uint32_t IRAM_ATTR HOT micros()
Application App
Global storage of Application pointer - only one Application can exist.