Skip to content

Commit e97a519

Browse files
authored
fix: pin_remap: make periman APIs private and non-remapped (#8940)
Turns out that disabling the periman APIs from remap has a negligible effect on the source: the core is already excluded from remapping, as are most of the libraries. It's also expected to be a private API not exposed by default. This patch removes it from both esp32-hal.h and io_pin_remap.h, adjusting the relevant libraries.
1 parent 8c150e2 commit e97a519

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

cores/esp32/esp32-hal.h

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ void yield(void);
8686
#include "esp32-hal-psram.h"
8787
#include "esp32-hal-rgb-led.h"
8888
#include "esp32-hal-cpu.h"
89-
#include "esp32-hal-periman.h"
9089

9190
void analogWrite(uint8_t pin, int value);
9291
void analogWriteFrequency(uint8_t pin, uint32_t freq);

cores/esp32/io_pin_remap.h

-10
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,6 @@ int8_t gpioNumberToDigitalPin(int8_t gpioNumber);
7171
#define pinMatrixOutAttach(pin, function, invertOut, invertEnable) pinMatrixOutAttach(digitalPinToGPIONumber(pin), function, invertOut, invertEnable)
7272
#define pinMatrixOutDetach(pin, invertOut, invertEnable) pinMatrixOutDetach(digitalPinToGPIONumber(pin), invertOut, invertEnable)
7373

74-
// cores/esp32/esp32-hal-periman.h
75-
#define perimanSetPinBus(pin, type, bus, bus_num, bus_channel) perimanSetPinBus(digitalPinToGPIONumber(pin), type, bus, bus_num, bus_channel)
76-
#define perimanGetPinBus(pin, type) perimanGetPinBus(digitalPinToGPIONumber(pin), type)
77-
#define perimanGetPinBusType(pin) perimanGetPinBusType(digitalPinToGPIONumber(pin))
78-
#define perimanGetPinBusNum(pin) perimanGetPinBusNum(digitalPinToGPIONumber(pin))
79-
#define perimanGetPinBusChannel(pin) perimanGetPinBusChannel(digitalPinToGPIONumber(pin))
80-
#define perimanPinIsValid(pin) perimanPinIsValid(digitalPinToGPIONumber(pin))
81-
#define perimanSetPinBusExtraType(pin, extra_type) perimanSetPinBusExtraType(digitalPinToGPIONumber(pin), extra_type)
82-
#define perimanGetPinBusExtraType(pin) perimanGetPinBusExtraType(digitalPinToGPIONumber(pin))
83-
8474
// cores/esp32/esp32-hal-rgb-led.h
8575
#define neopixelWrite(pin, red_val, green_val, blue_val) neopixelWrite(digitalPinToGPIONumber(pin), red_val, green_val, blue_val)
8676

libraries/SD/src/sd_diskio.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
15+
// Disable the automatic pin remapping of the API calls in this file
16+
#define ARDUINO_CORE_BUILD
17+
1418
#include "sd_diskio.h"
1519
#include "esp_system.h"
1620
#include "esp32-hal-periman.h"
@@ -742,7 +746,7 @@ uint8_t sdcard_init(uint8_t cs, SPIClass * spi, int hz)
742746
card->base_path = NULL;
743747
card->frequency = hz;
744748
card->spi = spi;
745-
card->ssPin = cs;
749+
card->ssPin = digitalPinToGPIONumber(cs);
746750

747751
card->supports_crc = true;
748752
card->type = CARD_NONE;

0 commit comments

Comments
 (0)