Merge pull request #13161 from bergzand/pr/pinetime/mtd
pinetime: add MTD configuration
This commit is contained in:
commit
a8231f2079
@ -1,5 +1,9 @@
|
|||||||
DEFAULT_MODULE += stdio_rtt
|
DEFAULT_MODULE += stdio_rtt
|
||||||
|
|
||||||
|
ifneq (,$(filter mtd,$(USEMODULE)))
|
||||||
|
USEMODULE += mtd_spi_nor
|
||||||
|
endif
|
||||||
|
|
||||||
# include common nrf52 dependencies
|
# include common nrf52 dependencies
|
||||||
include $(RIOTBOARD)/common/nrf52/nrf52832/Makefile.dep
|
include $(RIOTBOARD)/common/nrf52/nrf52832/Makefile.dep
|
||||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||||
|
|||||||
@ -23,7 +23,30 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
#include "mtd.h"
|
||||||
|
#include "mtd_spi_nor.h"
|
||||||
#include "periph/gpio.h"
|
#include "periph/gpio.h"
|
||||||
|
#include "periph/spi.h"
|
||||||
|
|
||||||
|
#ifdef MODULE_MTD
|
||||||
|
static mtd_spi_nor_t pinetime_nor_dev = {
|
||||||
|
.base = {
|
||||||
|
.driver = &mtd_spi_nor_driver,
|
||||||
|
.page_size = PINETIME_NOR_PAGE_SIZE,
|
||||||
|
.pages_per_sector = PINETIME_NOR_PAGES_PER_SECTOR,
|
||||||
|
.sector_count = PINETIME_NOR_SECTOR_COUNT,
|
||||||
|
},
|
||||||
|
.flag = PINETIME_NOR_FLAGS,
|
||||||
|
.opcode = &mtd_spi_nor_opcode_default,
|
||||||
|
.spi = PINETIME_NOR_SPI_DEV,
|
||||||
|
.cs = PINETIME_NOR_SPI_CS,
|
||||||
|
.addr_width = 3,
|
||||||
|
.mode = PINETIME_NOR_SPI_MODE,
|
||||||
|
.clk = PINETIME_NOR_SPI_CLK,
|
||||||
|
};
|
||||||
|
|
||||||
|
mtd_dev_t *mtd0 = (mtd_dev_t *)&pinetime_nor_dev;
|
||||||
|
#endif /* MODULE_MTD */
|
||||||
|
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "board_common.h"
|
#include "board_common.h"
|
||||||
|
#include "mtd.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -66,6 +67,28 @@ extern "C" {
|
|||||||
#define ILI9341_PARAM_NUM_LINES 240U
|
#define ILI9341_PARAM_NUM_LINES 240U
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name PineTime NOR flash hardware configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define PINETIME_NOR_PAGE_SIZE (256)
|
||||||
|
#define PINETIME_NOR_PAGES_PER_SECTOR (16)
|
||||||
|
#define PINETIME_NOR_SECTOR_COUNT (2048)
|
||||||
|
#define PINETIME_NOR_FLAGS (SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K)
|
||||||
|
#define PINETIME_NOR_SPI_DEV SPI_DEV(0)
|
||||||
|
#define PINETIME_NOR_SPI_CLK SPI_CLK_10MHZ
|
||||||
|
#define PINETIME_NOR_SPI_CS GPIO_PIN(0, 5)
|
||||||
|
#define PINETIME_NOR_SPI_MODE SPI_MODE_3
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name MTD configuration
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
extern mtd_dev_t *mtd0;
|
||||||
|
#define MTD_0 mtd0
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user