mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-27 01:56:14 +01:00
ESP32 RMT pin add function
This commit is contained in:
parent
fad504bc7f
commit
87fd1b887e
11
DCCRMT.cpp
11
DCCRMT.cpp
|
@ -210,4 +210,15 @@ void IRAM_ATTR RMTChannel::RMTinterrupt() {
|
||||||
if (dataRepeat > 0) // if a repeat count was specified, work on that
|
if (dataRepeat > 0) // if a repeat count was specified, work on that
|
||||||
dataRepeat--;
|
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
|
#endif //ESP32
|
||||||
|
|
1
DCCRMT.h
1
DCCRMT.h
|
@ -32,6 +32,7 @@
|
||||||
class RMTChannel {
|
class RMTChannel {
|
||||||
public:
|
public:
|
||||||
RMTChannel(byte pin, bool isMain);
|
RMTChannel(byte pin, bool isMain);
|
||||||
|
bool addPin(byte pin);
|
||||||
void IRAM_ATTR RMTinterrupt();
|
void IRAM_ATTR RMTinterrupt();
|
||||||
void RMTprefill();
|
void RMTprefill();
|
||||||
//int RMTfillData(dccPacket packet);
|
//int RMTfillData(dccPacket packet);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user