Skip to content

Commit

Permalink
Merge pull request adafruit#9641 from RetiredWizard/espsdioio2
Browse files Browse the repository at this point in the history
esp32s3: Implement sdioio
  • Loading branch information
tannewt authored Sep 20, 2024
2 parents 44ec0e6 + 8a2651a commit 340cc63
Show file tree
Hide file tree
Showing 16 changed files with 348 additions and 24 deletions.
26 changes: 15 additions & 11 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -661,12 +661,12 @@ msgid "Buffer length %d too big. It must be less than %d"
msgstr ""

#: ports/atmel-samd/common-hal/sdioio/SDCard.c
#: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c
msgid "Buffer length must be a multiple of 512"
msgstr ""

#: ports/cxd56/common-hal/sdioio/SDCard.c
#: ports/espressif/common-hal/sdioio/SDCard.c
#: ports/stm/common-hal/sdioio/SDCard.c shared-bindings/floppyio/__init__.c
msgid "Buffer must be a multiple of 512 bytes"
#: shared-module/sdcardio/SDCard.c
#, c-format
msgid "Buffer must be a multiple of %d bytes"
msgstr ""

#: shared-bindings/_bleio/PacketBuffer.c
Expand Down Expand Up @@ -1183,11 +1183,13 @@ msgstr ""
msgid "Interrupted by output function"
msgstr ""

#: ports/espressif/common-hal/_bleio/Service.c
#: ports/espressif/common-hal/espulp/ULP.c
#: ports/espressif/common-hal/microcontroller/Processor.c
#: ports/mimxrt10xx/common-hal/audiobusio/__init__.c
#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c
#: ports/raspberrypi/bindings/picodvi/Framebuffer.c
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
#: ports/raspberrypi/common-hal/picodvi/Framebuffer_RP2040.c py/argcheck.c
#: shared-bindings/digitalio/DigitalInOut.c
#: shared-bindings/epaperdisplay/EPaperDisplay.c shared-bindings/pwmio/PWMOut.c
Expand Down Expand Up @@ -1307,6 +1309,7 @@ msgid "MAC address was invalid"
msgstr ""

#: ports/espressif/common-hal/_bleio/Characteristic.c
#: ports/espressif/common-hal/_bleio/Descriptor.c
msgid "MITM security not supported"
msgstr ""

Expand Down Expand Up @@ -1539,8 +1542,9 @@ msgid "Not supported JPEG standard"
msgstr ""

#: ports/espressif/common-hal/paralleldisplaybus/ParallelBus.c
#: ports/espressif/common-hal/sdioio/SDCard.c
#, c-format
msgid "Number of data_pins must be 8 or 16, not %d"
msgid "Number of data_pins must be %d or %d, not %d"
msgstr ""

#: shared-bindings/util.c
Expand Down Expand Up @@ -1864,9 +1868,10 @@ msgstr ""
msgid "SDIO GetCardInfo Error %d"
msgstr ""

#: ports/espressif/common-hal/sdioio/SDCard.c
#: ports/stm/common-hal/sdioio/SDCard.c
#, c-format
msgid "SDIO Init Error %d"
msgid "SDIO Init Error %x"
msgstr ""

#: ports/espressif/common-hal/busio/SPI.c
Expand Down Expand Up @@ -2242,14 +2247,12 @@ msgid "Update failed"
msgstr ""

#: ports/espressif/common-hal/_bleio/Characteristic.c
#: ports/espressif/common-hal/_bleio/Descriptor.c
#: ports/nordic/common-hal/_bleio/Characteristic.c
#: ports/nordic/common-hal/_bleio/Descriptor.c
msgid "Value length != required fixed length"
msgstr ""

#: ports/espressif/common-hal/_bleio/Characteristic.c
#: ports/espressif/common-hal/_bleio/Descriptor.c
#: ports/nordic/common-hal/_bleio/Characteristic.c
#: ports/nordic/common-hal/_bleio/Descriptor.c
msgid "Value length > max_length"
Expand Down Expand Up @@ -3098,7 +3101,8 @@ msgstr ""
msgid "function missing required positional argument #%d"
msgstr ""

#: py/argcheck.c py/bc.c py/objnamedtuple.c shared-bindings/time/__init__.c
#: py/argcheck.c py/bc.c py/objnamedtuple.c shared-bindings/_eve/__init__.c
#: shared-bindings/time/__init__.c
#, c-format
msgid "function takes %d positional arguments but %d were given"
msgstr ""
Expand Down Expand Up @@ -3250,7 +3254,7 @@ msgstr ""
msgid "input must be a dense ndarray"
msgstr ""

#: extmod/ulab/code/user/user.c
#: extmod/ulab/code/user/user.c shared-bindings/_eve/__init__.c
msgid "input must be an ndarray"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/sdioio/SDCard.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static void check_for_deinit(sdioio_sdcard_obj_t *self) {

static void check_whole_block(mp_buffer_info_t *bufinfo) {
if (bufinfo->len % 512) {
mp_raise_ValueError(MP_ERROR_TEXT("Buffer length must be a multiple of 512"));
mp_raise_ValueError_varg(MP_ERROR_TEXT("Buffer must be a multiple of %d bytes"), 512);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ports/cxd56/common-hal/sdioio/SDCard.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ uint32_t common_hal_sdioio_sdcard_get_count(sdioio_sdcard_obj_t *self) {

static void check_whole_block(mp_buffer_info_t *bufinfo) {
if (bufinfo->len % 512) {
mp_raise_ValueError(MP_ERROR_TEXT("Buffer length must be a multiple of 512"));
mp_raise_ValueError_varg(MP_ERROR_TEXT("Buffer must be a multiple of %d bytes"), 512);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ports/espressif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.16)
set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf)

# The component list here determines what options we get in menuconfig and what the ninja file can build.
set(COMPONENTS bt driver esp_driver_dac esp_driver_gpio esp_driver_gptimer esp_driver_i2s esp_driver_ledc esp_driver_pcnt esp_driver_rmt esp_driver_spi esp_driver_tsens esp_driver_uart esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd vfs esp_vfs_console)
set(COMPONENTS bt driver esp_driver_dac esp_driver_gpio esp_driver_gptimer esp_driver_i2s esp_driver_ledc esp_driver_pcnt esp_driver_rmt esp_driver_spi esp_driver_tsens esp_driver_uart esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd vfs esp_vfs_console sdmmc)
set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp-camera")

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
Expand Down
7 changes: 7 additions & 0 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ INC += \
-isystem esp-idf/components/esp_driver_ledc/include \
-isystem esp-idf/components/esp_driver_pcnt/include \
-isystem esp-idf/components/esp_driver_rmt/include \
-isystem esp-idf/components/esp_driver_sdio/include \
-isystem esp-idf/components/esp_driver_sdmmc/include \
-isystem esp-idf/components/esp_driver_spi/include \
-isystem esp-idf/components/esp_driver_tsens/include \
-isystem esp-idf/components/esp_driver_uart/include \
Expand Down Expand Up @@ -128,6 +130,8 @@ INC += \
-isystem esp-idf/components/mbedtls/port/include \
-isystem esp-idf/components/newlib/platform_include \
-isystem esp-idf/components/nvs_flash/include \
-isystem esp-idf/components/sdio/include \
-isystem esp-idf/components/sdmmc/include \
-isystem esp-idf/components/soc/include \
-isystem esp-idf/components/soc/$(IDF_TARGET)/include \
-isystem esp-idf/components/spi_flash/include \
Expand Down Expand Up @@ -660,6 +664,9 @@ endif
ifneq ($(CIRCUITPY_USB_DEVICE),0)
ESP_IDF_COMPONENTS_LINK += usb
endif
ifneq ($(CIRCUITPY_SDIOIO),0)
ESP_IDF_COMPONENTS_LINK += sdmmc esp_driver_sdmmc
endif

ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)

Expand Down
7 changes: 3 additions & 4 deletions ports/espressif/boards/makerfabs_tft7/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,9 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {

// IO10 <> SD_CS is cut at factory (non-placed resistor position R34) and pulled up.
// Permanent SDIO 1-bit mode?
// Until SDIO 1-bit mode is support on Espressif ports these pins aren't useful
// { MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO11) },
// { MP_ROM_QSTR(MP_QSTR_SDIO_D0), MP_ROM_PTR(&pin_GPIO13) },
// { MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_SDIO_D0), MP_ROM_PTR(&pin_GPIO13) },

{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void common_hal_paralleldisplaybus_parallelbus_construct_nonsequential(paralleld
const mcu_pin_obj_t *write, const mcu_pin_obj_t *read, const mcu_pin_obj_t *reset, uint32_t frequency) {

if (n_pins != 8 && n_pins != 16) {
mp_raise_ValueError_varg(MP_ERROR_TEXT("Number of data_pins must be 8 or 16, not %d"), n_pins);
mp_raise_ValueError_varg(MP_ERROR_TEXT("Number of data_pins must be %d or %d, not %d"), 8, 16, n_pins);
}

for (uint8_t i = 0; i < n_pins; i++) {
Expand Down
Loading

0 comments on commit 340cc63

Please sign in to comment.