mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-03 03:18:28 +02:00
esp32 remote: make RMT memory blocks configureable (#1002)
This commit is contained in:
@@ -6,7 +6,13 @@
|
||||
namespace esphome {
|
||||
namespace remote_transmitter {
|
||||
|
||||
class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, public Component {
|
||||
class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase,
|
||||
public Component
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
,
|
||||
public remote_base::RemoteRMTChannel
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
explicit RemoteTransmitterComponent(GPIOPin *pin) : remote_base::RemoteTransmitterBase(pin) {}
|
||||
|
||||
@@ -34,6 +40,7 @@ class RemoteTransmitterComponent : public remote_base::RemoteTransmitterBase, pu
|
||||
uint32_t current_carrier_frequency_{UINT32_MAX};
|
||||
bool initialized_{false};
|
||||
std::vector<rmt_item32_t> rmt_temp_;
|
||||
esp_err_t error_code_{ESP_OK};
|
||||
#endif
|
||||
uint8_t carrier_duty_percent_{50};
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ void RemoteTransmitterComponent::setup() {}
|
||||
void RemoteTransmitterComponent::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Remote Transmitter...");
|
||||
ESP_LOGCONFIG(TAG, " Channel: %d", this->channel_);
|
||||
ESP_LOGCONFIG(TAG, " RMT memory blocks: %d", this->mem_block_num_);
|
||||
ESP_LOGCONFIG(TAG, " Clock divider: %u", this->clock_divider_);
|
||||
LOG_PIN(" Pin: ", this->pin_);
|
||||
|
||||
@@ -29,11 +30,9 @@ void RemoteTransmitterComponent::dump_config() {
|
||||
void RemoteTransmitterComponent::configure_rmt() {
|
||||
rmt_config_t c{};
|
||||
|
||||
this->config_rmt(c);
|
||||
c.rmt_mode = RMT_MODE_TX;
|
||||
c.channel = this->channel_;
|
||||
c.clk_div = this->clock_divider_;
|
||||
c.gpio_num = gpio_num_t(this->pin_->get_pin());
|
||||
c.mem_block_num = 1;
|
||||
c.tx_config.loop_en = false;
|
||||
|
||||
if (this->current_carrier_frequency_ == 0 || this->carrier_duty_percent_ == 100) {
|
||||
|
||||
Reference in New Issue
Block a user