Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
7eec41dc
Unverified
Commit
7eec41dc
authored
Feb 05, 2022
by
Rodrigo Garcia
Committed by
GitHub
Feb 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes Touch Sensor for ESP32-S3 and any future SoC (#6234)
* Fixes digitalPinToTouchChannel() for ESP32-S3
parent
9dbc9087
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
cores/esp32/esp32-hal-gpio.c
cores/esp32/esp32-hal-gpio.c
+26
-0
cores/esp32/esp32-hal-gpio.h
cores/esp32/esp32-hal-gpio.h
+2
-1
No files found.
cores/esp32/esp32-hal-gpio.c
View file @
7eec41dc
...
...
@@ -52,6 +52,32 @@
#include "esp_intr.h"
#endif
#include "soc/soc_caps.h"
// It fixes lack of pin definition for S3 and for any future SoC
// this function works for ESP32, ESP32-S2 and ESP32-S3 - including the C3, it will return -1 for any pin
#if SOC_TOUCH_SENSOR_NUM > 0
#include "soc/touch_sensor_periph.h"
int8_t
digitalPinToTouchChannel
(
uint8_t
pin
)
{
int8_t
ret
=
-
1
;
if
(
pin
<
SOC_GPIO_PIN_COUNT
)
{
for
(
uint8_t
i
=
0
;
i
<
SOC_TOUCH_SENSOR_NUM
;
i
++
)
{
if
(
touch_sensor_channel_io_map
[
i
]
==
pin
)
{
ret
=
i
;
break
;
}
}
}
return
ret
;
}
#else
// No Touch Sensor available
int8_t
digitalPinToTouchChannel
(
uint8_t
pin
)
{
return
-
1
;
}
#endif
#if CONFIG_IDF_TARGET_ESP32
const
int8_t
esp32_adc2gpio
[
20
]
=
{
36
,
37
,
38
,
39
,
32
,
33
,
34
,
35
,
-
1
,
-
1
,
4
,
0
,
2
,
15
,
13
,
12
,
14
,
27
,
25
,
26
};
#elif CONFIG_IDF_TARGET_ESP32S2
...
...
cores/esp32/esp32-hal-gpio.h
View file @
7eec41dc
...
...
@@ -82,7 +82,6 @@ extern const int8_t esp32_adc2gpio[20];
#define digitalPinCanOutput(pin) ((pin) < NUM_OUPUT_PINS && esp32_gpioMux[(pin)].reg)
#define digitalPinToRtcPin(pin) (((pin) < SOC_GPIO_PIN_COUNT)?esp32_gpioMux[(pin)].rtc:-1)
#define digitalPinToAnalogChannel(pin) (((pin) < SOC_GPIO_PIN_COUNT)?esp32_gpioMux[(pin)].adc:-1)
#define digitalPinToTouchChannel(pin) (((pin) < SOC_GPIO_PIN_COUNT)?esp32_gpioMux[(pin)].touch:-1)
#define digitalPinToDacChannel(pin) (((pin) == PIN_DAC1)?0:((pin) == PIN_DAC2)?1:-1)
void
pinMode
(
uint8_t
pin
,
uint8_t
mode
);
...
...
@@ -93,6 +92,8 @@ void attachInterrupt(uint8_t pin, void (*)(void), int mode);
void
attachInterruptArg
(
uint8_t
pin
,
void
(
*
)(
void
*
),
void
*
arg
,
int
mode
);
void
detachInterrupt
(
uint8_t
pin
);
int8_t
digitalPinToTouchChannel
(
uint8_t
pin
);
#ifdef __cplusplus
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment