Skip to content

Commit 4ddeb3b

Browse files
committed
feat(rmt): allow legacy driver
1 parent 4a6437d commit 4ddeb3b

File tree

6 files changed

+15
-1
lines changed

6 files changed

+15
-1
lines changed

cores/esp32/esp32-hal-gpio.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ uint8_t RGB_BUILTIN_storage = 0;
151151
#endif
152152

153153
extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
154+
#ifndef NO_NEW_RMT_DRV
154155
#ifdef RGB_BUILTIN
155156
if (pin == RGB_BUILTIN) {
156157
//use RMT to set all channels on/off
@@ -159,7 +160,8 @@ extern void ARDUINO_ISR_ATTR __digitalWrite(uint8_t pin, uint8_t val) {
159160
neopixelWrite(RGB_BUILTIN, comm_val, comm_val, comm_val);
160161
return;
161162
}
162-
#endif
163+
#endif // RGB_BUILTIN
164+
#endif // NO_NEW_RMT_DRV
163165
if (perimanGetPinBus(pin, ESP32_BUS_TYPE_GPIO) != NULL) {
164166
gpio_set_level((gpio_num_t)pin, val);
165167
} else {

cores/esp32/esp32-hal-rgb-led.c

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "soc/soc_caps.h"
22

3+
#ifndef NO_NEW_RMT_DRV
4+
35
#include "esp32-hal-rgb-led.h"
46

57
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
@@ -40,3 +42,4 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue
4042
log_e("RMT is not supported on " CONFIG_IDF_TARGET);
4143
#endif /* SOC_RMT_SUPPORTED */
4244
}
45+
#endif /* NO_NEW_RMT_DRV */

cores/esp32/esp32-hal-rgb-led.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef MAIN_ESP32_HAL_RGB_LED_H_
22
#define MAIN_ESP32_HAL_RGB_LED_H_
33

4+
#ifndef NO_NEW_RMT_DRV
45
#ifdef __cplusplus
56
extern "C" {
67
#endif
@@ -18,3 +19,4 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue
1819
#endif
1920

2021
#endif /* MAIN_ESP32_HAL_RGB_LED_H_ */
22+
#endif /* NO_NEW_RMT_DRV */

cores/esp32/esp32-hal-rmt.c

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include "soc/soc_caps.h"
16+
#ifndef NO_NEW_RMT_DRV
1617

1718
#if SOC_RMT_SUPPORTED
1819
#include "esp32-hal.h"
@@ -628,3 +629,4 @@ bool rmtInit(int pin, rmt_ch_dir_t channel_direction, rmt_reserve_memsize_t mem_
628629
}
629630

630631
#endif /* SOC_RMT_SUPPORTED */
632+
#endif /* NO_NEW_RMT_DRV */

cores/esp32/esp32-hal-rmt.h

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#define MAIN_ESP32_HAL_RMT_H_
1717

1818
#include "soc/soc_caps.h"
19+
#ifndef NO_NEW_RMT_DRV
20+
1921
#if SOC_RMT_SUPPORTED
2022

2123
#ifdef __cplusplus
@@ -234,3 +236,4 @@ bool rmtDeinit(int pin);
234236

235237
#endif /* SOC_RMT_SUPPORTED */
236238
#endif /* MAIN_ESP32_HAL_RMT_H_ */
239+
#endif /* NO_NEW_RMT_DRV */

cores/esp32/io_pin_remap.h

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ int8_t gpioNumberToDigitalPin(int8_t gpioNumber);
7979
// cores/esp32/esp32-hal-rgb-led.h
8080
#define neopixelWrite(pin, red_val, green_val, blue_val) neopixelWrite(digitalPinToGPIONumber(pin), red_val, green_val, blue_val)
8181

82+
#ifndef NO_NEW_RMT_DRV
8283
// cores/esp32/esp32-hal-rmt.h
8384
#define rmtInit(pin, channel_direction, memsize, frequency_Hz) rmtInit(digitalPinToGPIONumber(pin), channel_direction, memsize, frequency_Hz)
8485
#define rmtSetEOT(pin, EOT_Level) rmtSetEOT(digitalPinToGPIONumber(pin), EOT_Level)
@@ -94,6 +95,7 @@ int8_t gpioNumberToDigitalPin(int8_t gpioNumber);
9495
rmtSetCarrier(digitalPinToGPIONumber(pin), carrier_en, carrier_level, frequency_Hz, duty_percent)
9596
#define rmtSetRxMinThreshold(pin, filter_pulse_ticks) rmtSetRxMinThreshold(digitalPinToGPIONumber(pin), filter_pulse_ticks)
9697
#define rmtDeinit(pin) rmtDeinit(digitalPinToGPIONumber(pin))
98+
#endif // NO_NEW_RMT_DRV
9799

98100
// cores/esp32/esp32-hal-sigmadelta.h
99101
#define sigmaDeltaAttach(pin, freq) sigmaDeltaAttach(digitalPinToGPIONumber(pin), freq)

0 commit comments

Comments
 (0)