@@ -27,6 +27,16 @@ extern "C" {
27
27
#include "esp32-hal.h"
28
28
#include "soc/gpio_caps.h"
29
29
30
+ #if (CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 )
31
+ #define NUM_OUPUT_PINS 45
32
+ #define PIN_DAC1 17
33
+ #define PIN_DAC2 18
34
+ #else
35
+ #define NUM_OUPUT_PINS 34
36
+ #define PIN_DAC1 25
37
+ #define PIN_DAC2 26
38
+ #endif
39
+
30
40
#define LOW 0x0
31
41
#define HIGH 0x1
32
42
@@ -68,12 +78,12 @@ typedef struct {
68
78
extern const esp32_gpioMux_t esp32_gpioMux [GPIO_PIN_COUNT ];
69
79
extern const int8_t esp32_adc2gpio [20 ];
70
80
71
- #define digitalPinIsValid (pin ) ((pin) < 40 && esp32_gpioMux[(pin)].reg)
72
- #define digitalPinCanOutput (pin ) ((pin) < 34 && esp32_gpioMux[(pin)].reg)
73
- #define digitalPinToRtcPin (pin ) (((pin) < 40 )?esp32_gpioMux[(pin)].rtc:-1)
74
- #define digitalPinToAnalogChannel (pin ) (((pin) < 40 )?esp32_gpioMux[(pin)].adc:-1)
75
- #define digitalPinToTouchChannel (pin ) (((pin) < 40 )?esp32_gpioMux[(pin)].touch:-1)
76
- #define digitalPinToDacChannel (pin ) (((pin) == 25 )?0:((pin) == 26 )?1:-1)
81
+ #define digitalPinIsValid (pin ) ((pin) < GPIO_PIN_COUNT && esp32_gpioMux[(pin)].reg)
82
+ #define digitalPinCanOutput (pin ) ((pin) < NUM_OUPUT_PINS && esp32_gpioMux[(pin)].reg)
83
+ #define digitalPinToRtcPin (pin ) (((pin) < GPIO_PIN_COUNT )?esp32_gpioMux[(pin)].rtc:-1)
84
+ #define digitalPinToAnalogChannel (pin ) (((pin) < GPIO_PIN_COUNT )?esp32_gpioMux[(pin)].adc:-1)
85
+ #define digitalPinToTouchChannel (pin ) (((pin) < GPIO_PIN_COUNT )?esp32_gpioMux[(pin)].touch:-1)
86
+ #define digitalPinToDacChannel (pin ) (((pin) == PIN_DAC1 )?0:((pin) == PIN_DAC2 )?1:-1)
77
87
78
88
void pinMode (uint8_t pin , uint8_t mode );
79
89
void digitalWrite (uint8_t pin , uint8_t val );
0 commit comments