esphome/esphome/components/remote_transmitter/remote_transmitter.h
Otto Winter 8e75980ebd
Cleanup dashboard JS (#491)
* Cleanup dashboard JS

* Add vscode

* Save start_mark/end_mark

* Updates

* Updates

* Remove need for cv.nameable

It's a bit hacky but removes so much bloat from integrations

* Add enum helper

* Document APIs, and Improvements

* Fixes

* Fixes

* Update PULL_REQUEST_TEMPLATE.md

* Updates

* Updates

* Updates
2019-04-22 21:56:30 +02:00

42 lines
1.2 KiB
C++

#pragma once
#include "esphome/core/component.h"
#include "esphome/components/remote_base/remote_base.h"
namespace esphome {
namespace remote_transmitter {
class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, public Component {
public:
explicit RemoteTransmitterComponent(GPIOPin *pin) : remote_base::RemoteTransmitterBase(pin) {}
void setup() override;
void dump_config() override;
float get_setup_priority() const override { return setup_priority::DATA; }
void set_carrier_duty_percent(uint8_t carrier_duty_percent) { this->carrier_duty_percent_ = carrier_duty_percent; }
protected:
void send_internal(uint32_t send_times, uint32_t send_wait) override;
#ifdef ARDUINO_ARCH_ESP8266
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 space_(uint32_t usec);
#endif
#ifdef ARDUINO_ARCH_ESP32
void configure_rmt();
uint32_t current_carrier_frequency_{UINT32_MAX};
bool initialized_{false};
std::vector<rmt_item32_t> rmt_temp_;
#endif
uint8_t carrier_duty_percent_{50};
};
} // namespace remote_transmitter
} // namespace esphome