mirror of
https://github.com/micropython/micropython.git
synced 2025-09-05 17:30:41 +02:00
Some checks failed
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check code size / build (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Check commit message formatting / build (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu-arm port / build_and_test (push) Has been cancelled
qemu-riscv port / build_and_test (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
The ESP-IDF default on C3 is primary UART0, secondary USB serial/jtag. Previously MicroPython configured the primary as USB Serial/JTAG and manually worked with the UART0 console. However UART0 console stopped working this way in v5.2.2. The big change is that CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is no longer set, as primary console is UART0. However CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is set and IDF provides a macro CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED which is set if either primary or secondary esp_console is USB serial/jtag. So need to use that macro instead. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
165 lines
5.5 KiB
C
165 lines
5.5 KiB
C
/*
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
*
|
|
* The MIT License (MIT)
|
|
*
|
|
* Copyright (c) 2023 Damien P. George
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*/
|
|
#ifndef MICROPY_INCLUDED_ESP32_MACHINE_PIN_H
|
|
#define MICROPY_INCLUDED_ESP32_MACHINE_PIN_H
|
|
|
|
#include "py/obj.h"
|
|
#include "hal/gpio_types.h"
|
|
|
|
// Define which pins are enabled for a given SoC and configuration.
|
|
|
|
#if CONFIG_IDF_TARGET_ESP32
|
|
|
|
#define MICROPY_HW_ENABLE_GPIO0 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO1 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO2 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO3 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO4 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO5 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO6 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO7 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO8 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO9 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO10 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO11 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO12 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO13 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO14 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO15 (1)
|
|
#if !CONFIG_ESP32_SPIRAM_SUPPORT
|
|
#define MICROPY_HW_ENABLE_GPIO16 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO17 (1)
|
|
#endif
|
|
#define MICROPY_HW_ENABLE_GPIO18 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO19 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO20 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO21 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO22 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO23 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO25 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO26 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO27 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO32 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO33 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO34 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO35 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO36 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO37 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO38 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO39 (1)
|
|
|
|
#elif CONFIG_IDF_TARGET_ESP32C3
|
|
|
|
#define MICROPY_HW_ENABLE_GPIO0 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO1 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO2 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO3 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO4 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO5 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO6 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO7 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO8 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO9 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO10 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO11 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO12 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO13 (1)
|
|
#if !CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED
|
|
#define MICROPY_HW_ENABLE_GPIO18 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO19 (1)
|
|
#endif
|
|
#define MICROPY_HW_ENABLE_GPIO20 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO21 (1)
|
|
|
|
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
|
|
|
#define MICROPY_HW_ENABLE_GPIO0 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO1 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO2 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO3 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO4 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO5 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO6 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO7 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO8 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO9 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO10 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO11 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO12 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO13 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO14 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO15 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO16 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO17 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO18 (1)
|
|
#if !CONFIG_USB_CDC_ENABLED
|
|
#define MICROPY_HW_ENABLE_GPIO19 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO20 (1)
|
|
#endif
|
|
#define MICROPY_HW_ENABLE_GPIO21 (1)
|
|
#if !CONFIG_SPIRAM
|
|
#define MICROPY_HW_ENABLE_GPIO26 (1)
|
|
#endif
|
|
#if !CONFIG_SPIRAM_MODE_OCT
|
|
#define MICROPY_HW_ENABLE_GPIO33 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO34 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO35 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO36 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO37 (1)
|
|
#endif
|
|
#define MICROPY_HW_ENABLE_GPIO38 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO39 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO40 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO41 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO42 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO43 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO44 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO45 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO46 (1)
|
|
#if CONFIG_IDF_TARGET_ESP32S3 && MICROPY_HW_ESP32S3_EXTENDED_IO
|
|
#define MICROPY_HW_ENABLE_GPIO47 (1)
|
|
#define MICROPY_HW_ENABLE_GPIO48 (1)
|
|
#endif
|
|
|
|
#endif
|
|
|
|
typedef struct _machine_pin_irq_obj_t {
|
|
mp_obj_base_t base;
|
|
} machine_pin_irq_obj_t;
|
|
|
|
typedef struct _machine_pin_obj_t {
|
|
mp_obj_base_t base;
|
|
machine_pin_irq_obj_t irq;
|
|
} machine_pin_obj_t;
|
|
|
|
extern const mp_obj_type_t machine_pin_irq_type;
|
|
|
|
extern const machine_pin_obj_t machine_pin_obj_table[GPIO_NUM_MAX];
|
|
|
|
extern const mp_obj_dict_t machine_pin_board_pins_locals_dict;
|
|
|
|
#endif // MICROPY_INCLUDED_ESP32_MACHINE_PIN_H
|