From 22ed0abf6c2966d11fc2bbbbaa14a2e9f8a48ac7 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Mon, 15 Mar 2021 16:11:28 +0100 Subject: [PATCH] spresens: configure pin mode for i2c and spi --- ports/cxd56/common-hal/busio/I2C.c | 2 ++ ports/cxd56/common-hal/busio/SPI.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ports/cxd56/common-hal/busio/I2C.c b/ports/cxd56/common-hal/busio/I2C.c index 5579bedeb1..b726552cc0 100644 --- a/ports/cxd56/common-hal/busio/I2C.c +++ b/ports/cxd56/common-hal/busio/I2C.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "py/runtime.h" @@ -49,6 +50,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t * self->sda_pin = sda; self->frequency = frequency; self->i2c_dev = cxd56_i2cbus_initialize(0); + CXD56_PIN_CONFIGS(PINCONFS_I2C0); } void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { diff --git a/ports/cxd56/common-hal/busio/SPI.c b/ports/cxd56/common-hal/busio/SPI.c index 56ab0758d4..f9495b7a86 100644 --- a/ports/cxd56/common-hal/busio/SPI.c +++ b/ports/cxd56/common-hal/busio/SPI.c @@ -26,6 +26,7 @@ #include #include +#include #include "py/runtime.h" @@ -39,10 +40,12 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * (mosi == NULL || mosi->number == PIN_SPI4_MOSI) && (miso == NULL || miso->number == PIN_SPI4_MISO)) { port = 4; + CXD56_PIN_CONFIGS(PINCONFS_SPI4); } else if (clock->number == PIN_EMMC_CLK && (mosi == NULL || mosi->number == PIN_EMMC_DATA0) && (miso == NULL || miso->number == PIN_EMMC_DATA1)) { port = 5; + CXD56_PIN_CONFIGS(PINCONFS_EMMCA_SPI5); } if (port < 0) {