1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #13161 from bergzand/pr/pinetime/mtd

pinetime: add MTD configuration
This commit is contained in:
Koen Zandberg 2020-02-25 20:44:59 +01:00 committed by GitHub
commit a8231f2079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 0 deletions

View File

@ -1,5 +1,9 @@
DEFAULT_MODULE += stdio_rtt
ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += mtd_spi_nor
endif
# include common nrf52 dependencies
include $(RIOTBOARD)/common/nrf52/nrf52832/Makefile.dep
include $(RIOTBOARD)/common/nrf52/Makefile.dep

View File

@ -23,7 +23,30 @@
#include "cpu.h"
#include "board.h"
#include "mtd.h"
#include "mtd_spi_nor.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)
{

View File

@ -23,6 +23,7 @@
#include "cpu.h"
#include "board_common.h"
#include "mtd.h"
#ifdef __cplusplus
extern "C" {
@ -66,6 +67,28 @@ extern "C" {
#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
}
#endif