Add rmt_channel to remote_transmitter and remote_receiver (#6497)

* Add rmt_channel to remote_transmitter and remote_receiver

* Add codeowner

* Add tests
This commit is contained in:
Jesse Hills
2024-04-09 13:53:57 +12:00
committed by GitHub
parent 55c49281a2
commit c66b2c52c1
25 changed files with 383 additions and 33 deletions
@@ -15,6 +15,9 @@ RemoteRMTChannel::RemoteRMTChannel(uint8_t mem_block_num) : mem_block_num_(mem_b
next_rmt_channel = rmt_channel_t(int(next_rmt_channel) + mem_block_num);
}
RemoteRMTChannel::RemoteRMTChannel(rmt_channel_t channel, uint8_t mem_block_num)
: channel_(channel), mem_block_num_(mem_block_num) {}
void RemoteRMTChannel::config_rmt(rmt_config_t &rmt) {
if (rmt_channel_t(int(this->channel_) + this->mem_block_num_) > RMT_CHANNEL_MAX) {
this->mem_block_num_ = int(RMT_CHANNEL_MAX) - int(this->channel_);
+3 -2
View File
@@ -3,10 +3,10 @@
#pragma once
#include "esphome/components/binary_sensor/binary_sensor.h"
#include "esphome/core/automation.h"
#include "esphome/core/component.h"
#include "esphome/core/hal.h"
#include "esphome/core/automation.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
#ifdef USE_ESP32
#include <driver/rmt.h>
@@ -86,6 +86,7 @@ class RemoteComponentBase {
class RemoteRMTChannel {
public:
explicit RemoteRMTChannel(uint8_t mem_block_num = 1);
explicit RemoteRMTChannel(rmt_channel_t channel, uint8_t mem_block_num = 1);
void config_rmt(rmt_config_t &rmt);
void set_clock_divider(uint8_t clock_divider) { this->clock_divider_ = clock_divider; }