1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 08:06:13 +01:00

ESP32 RMT pin add function

This commit is contained in:
Harald Barth 2022-08-04 01:19:11 +02:00
parent fad504bc7f
commit 87fd1b887e
2 changed files with 12 additions and 0 deletions

View File

@ -210,4 +210,15 @@ void IRAM_ATTR RMTChannel::RMTinterrupt() {
if (dataRepeat > 0) // if a repeat count was specified, work on that
dataRepeat--;
}
bool RMTChannel::addPin(byte pin) {
gpio_num_t gpioNum = (gpio_num_t)(pin);
esp_err_t err;
PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[gpioNum], PIN_FUNC_GPIO);
err = gpio_set_direction(gpioNum, GPIO_MODE_OUTPUT);
if (err != ESP_OK) return false;
gpio_matrix_out(gpioNum, RMT_SIG_OUT0_IDX+channel, 0, 0);
if (err != ESP_OK) return false;
return true;
}
#endif //ESP32

View File

@ -32,6 +32,7 @@
class RMTChannel {
public:
RMTChannel(byte pin, bool isMain);
bool addPin(byte pin);
void IRAM_ATTR RMTinterrupt();
void RMTprefill();
//int RMTfillData(dccPacket packet);