2018-03-09 08:55:06 -05:00
|
|
|
#include "storage.h"
|
|
|
|
|
|
|
|
// External SPI flash uses standard SPI interface
|
|
|
|
|
2018-06-07 00:15:10 -04:00
|
|
|
STATIC const mp_soft_spi_obj_t soft_spi_bus = {
|
2018-03-09 08:55:06 -05:00
|
|
|
.delay_half = MICROPY_HW_SOFTSPI_MIN_DELAY,
|
|
|
|
.polarity = 0,
|
|
|
|
.phase = 0,
|
2018-03-28 01:22:43 -04:00
|
|
|
.sck = MICROPY_HW_SPIFLASH_SCK,
|
|
|
|
.mosi = MICROPY_HW_SPIFLASH_MOSI,
|
|
|
|
.miso = MICROPY_HW_SPIFLASH_MISO,
|
2018-03-09 08:55:06 -05:00
|
|
|
};
|
|
|
|
|
2018-06-07 00:15:10 -04:00
|
|
|
STATIC mp_spiflash_cache_t spi_bdev_cache;
|
|
|
|
|
2018-03-09 08:55:06 -05:00
|
|
|
const mp_spiflash_config_t spiflash_config = {
|
|
|
|
.bus_kind = MP_SPIFLASH_BUS_SPI,
|
2018-03-28 01:22:43 -04:00
|
|
|
.bus.u_spi.cs = MICROPY_HW_SPIFLASH_CS,
|
2018-03-09 08:55:06 -05:00
|
|
|
.bus.u_spi.data = (void *)&soft_spi_bus,
|
|
|
|
.bus.u_spi.proto = &mp_soft_spi_proto,
|
2018-06-07 00:15:10 -04:00
|
|
|
.cache = &spi_bdev_cache,
|
2018-03-09 08:55:06 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
spi_bdev_t spi_bdev;
|