spresens: configure pin mode for i2c and spi
This commit is contained in:
parent
3cbff45f9a
commit
22ed0abf6c
@ -27,6 +27,7 @@
|
|||||||
#include <arch/chip/pin.h>
|
#include <arch/chip/pin.h>
|
||||||
#include <nuttx/i2c/i2c_master.h>
|
#include <nuttx/i2c/i2c_master.h>
|
||||||
#include <cxd56_i2c.h>
|
#include <cxd56_i2c.h>
|
||||||
|
#include <cxd56_pinconfig.h>
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#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->sda_pin = sda;
|
||||||
self->frequency = frequency;
|
self->frequency = frequency;
|
||||||
self->i2c_dev = cxd56_i2cbus_initialize(0);
|
self->i2c_dev = cxd56_i2cbus_initialize(0);
|
||||||
|
CXD56_PIN_CONFIGS(PINCONFS_I2C0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
|
void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <arch/chip/pin.h>
|
#include <arch/chip/pin.h>
|
||||||
#include <cxd56_spi.h>
|
#include <cxd56_spi.h>
|
||||||
|
#include <cxd56_pinconfig.h>
|
||||||
|
|
||||||
#include "py/runtime.h"
|
#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) &&
|
(mosi == NULL || mosi->number == PIN_SPI4_MOSI) &&
|
||||||
(miso == NULL || miso->number == PIN_SPI4_MISO)) {
|
(miso == NULL || miso->number == PIN_SPI4_MISO)) {
|
||||||
port = 4;
|
port = 4;
|
||||||
|
CXD56_PIN_CONFIGS(PINCONFS_SPI4);
|
||||||
} else if (clock->number == PIN_EMMC_CLK &&
|
} else if (clock->number == PIN_EMMC_CLK &&
|
||||||
(mosi == NULL || mosi->number == PIN_EMMC_DATA0) &&
|
(mosi == NULL || mosi->number == PIN_EMMC_DATA0) &&
|
||||||
(miso == NULL || miso->number == PIN_EMMC_DATA1)) {
|
(miso == NULL || miso->number == PIN_EMMC_DATA1)) {
|
||||||
port = 5;
|
port = 5;
|
||||||
|
CXD56_PIN_CONFIGS(PINCONFS_EMMCA_SPI5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port < 0) {
|
if (port < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user