diff options
author | Damien George <damien.p.george@gmail.com> | 2018-03-09 17:32:28 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-03-10 00:59:43 +1100 |
commit | a739b35a9618c2dd2d25c9ef4d076eeffddbb399 (patch) | |
tree | 5dc151563b57bf0973fc30fac9c84a945f4f3995 /drivers/memory | |
parent | 58ebeca6a9a172a35b9298a911d450722797c409 (diff) | |
download | micropython-a739b35a9618c2dd2d25c9ef4d076eeffddbb399.tar.gz micropython-a739b35a9618c2dd2d25c9ef4d076eeffddbb399.zip |
drivers/memory/spiflash: Change to use low-level SPI object not uPy one.
This patch alters the SPI-flash memory driver so that it uses the new
low-level C SPI protocol (from drivers/bus/spi.h) instead of the uPy SPI
protocol (from extmod/machine_spi.h). This allows the SPI-flash driver to
be used independently from the uPy runtime.
Diffstat (limited to 'drivers/memory')
-rw-r--r-- | drivers/memory/spiflash.c | 2 | ||||
-rw-r--r-- | drivers/memory/spiflash.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/memory/spiflash.c b/drivers/memory/spiflash.c index ea0fef8052..ad451f2c5d 100644 --- a/drivers/memory/spiflash.c +++ b/drivers/memory/spiflash.c @@ -162,7 +162,7 @@ void mp_spiflash_init(mp_spiflash_t *self) { if (self->config->bus_kind == MP_SPIFLASH_BUS_SPI) { mp_hal_pin_write(self->config->bus.u_spi.cs, 1); mp_hal_pin_output(self->config->bus.u_spi.cs); - self->config->bus.u_spi.proto->init(self->config->bus.u_spi.data, 0, NULL, (mp_map_t*)&mp_const_empty_map); + self->config->bus.u_spi.proto->ioctl(self->config->bus.u_spi.data, MP_SPI_IOCTL_INIT); } else { self->config->bus.u_qspi.proto->ioctl(self->config->bus.u_qspi.data, MP_QSPI_IOCTL_INIT); } diff --git a/drivers/memory/spiflash.h b/drivers/memory/spiflash.h index 79ba5490b1..03bad5296a 100644 --- a/drivers/memory/spiflash.h +++ b/drivers/memory/spiflash.h @@ -26,8 +26,8 @@ #ifndef MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H #define MICROPY_INCLUDED_DRIVERS_MEMORY_SPIFLASH_H +#include "drivers/bus/spi.h" #include "drivers/bus/qspi.h" -#include "extmod/machine_spi.h" enum { MP_SPIFLASH_BUS_SPI, @@ -40,7 +40,7 @@ typedef struct _mp_spiflash_config_t { struct { mp_hal_pin_obj_t cs; void *data; - const mp_machine_spi_p_t *proto; + const mp_spi_proto_t *proto; } u_spi; struct { void *data; |