Skip to content

Commit 1691dbe

Browse files
bors[bot]gschorcht
andauthored
Merge #19914 #19915
19914: boards: complete SD Card MTD definition for several bords r=benpicco a=gschorcht ### Contribution description This PR completes the MTD definition for the following boards: - `seeedstudio-gd32` - `sipeed-longan-nano` including `sipeed-longan-nano-tft` - `waveshare-nrf52840-eval-kit` - ESP32x boards that have an SPI SD Card interface and use `mtd_sdcard_default` ### Testing procedure Green CI ### Issues/PRs references#19465 Prerequisite for PR #19465 19915: drivers/lcd: support MCU 8080 8-bit parallel mode r=benpicco a=gschorcht ### Contribution description LCD driver ICs usually support - SPI serial mode, - MCU 8080 8-bit parallel mode and - MCU 8080 16-bit parallel mode. This PR extends the LCD display driver API to support the MCU 8080 8-/16-bit parallel modes and implements a GPIO-driven MCU 8080 8-bit parallel mode. The following features are already working locally and will be provided as follow-on PRs for which this PR is a prerequisite. - GPIO-driven bit-banging implementation of the 16-bit mode of the MCU 8080 parallel interface - Enabling the display on `stm32f723e-disco` and `stm32l496g-disco` using the feature above - Definition of a low-level API for the parallel modes using the LCD controller of the MCU - Using FMC for the display on `stm32f723e-disco` and `stm32l496g-disco` - Using LCD controller for the display of `esp32-wt32-sc01-plus` (PR #19917) ### Testing procedure The PR can be tested with PR #19917 on top of this PR. ``` BOARD=esp32s3-wt32-sc01-plus make -j8 -C tests/drivers/st77xx flash ``` The following video shows the test. **Please note** The test is pretty slow because the display has 480 x 320 pixels and the MCU 8080 8-bit parallel interface is realized by a GPIO-driven bit-banging implementation where each GPIO of the data bus is set separately. A follow-up PR will use the ESP32-S3 LCD controller and DMA for this board. This PR just defines the extension of the driver by the parallel interface and provides the bit-banging implementation for MCUs that don't have a LCD controller on chip. https://github.com/RIOT-OS/RIOT/assets/31932013/c1e3e3d7-05d9-4ca5-8fff-9a5eaca50fba ### Issues/PRs references Co-authored-by: Gunar Schorcht <[email protected]>
3 parents ec69cfd + bf981c8 + b0ec24b commit 1691dbe

File tree

13 files changed

+517
-76
lines changed

13 files changed

+517
-76
lines changed

boards/common/esp32x/include/board_common.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,15 @@ extern "C" {
103103
#define SPI_FLASH_DRIVE_START 0
104104
#endif
105105

106-
/** Default MTD drive definition */
107-
#define MTD_0 mtd0
106+
#define MTD_0 mtd0 /**< Flash MTD device */
107+
extern mtd_dev_t *mtd0; /**< Flash MTD device pointer */
108108

109-
/** Pointer to the default MTD drive structure */
110-
extern mtd_dev_t *mtd0;
109+
#if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN
110+
111+
#define MTD_1 mtd1 /**< SD Card MTD device */
112+
extern mtd_dev_t *mtd1; /**< SD Card MTD device pointer */
113+
114+
#endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */
111115

112116
/**
113117
* @brief MTD offset for SD Card interfaces

boards/seeedstudio-gd32/include/board.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define BOARD_H
2323

2424
#include "board_common.h"
25+
#include "mtd.h"
2526

2627
#ifdef __cplusplus
2728
extern "C" {
@@ -67,6 +68,25 @@ extern "C" {
6768
#define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */
6869
/** @} */
6970

71+
/**
72+
* @name MTD configuration
73+
* @{
74+
*/
75+
#define MTD_0 mtd0 /**< MTD device for SD Card */
76+
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
77+
/** @} */
78+
79+
/**
80+
* @name SD-Card interface configuration
81+
* @{
82+
*/
83+
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
84+
#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12)
85+
#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13)
86+
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14)
87+
#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15)
88+
/** @} */
89+
7090
#ifdef __cplusplus
7191
}
7292
#endif

boards/sipeed-longan-nano/include/board.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define BOARD_H
2222

2323
#include "board_common.h"
24+
#include "mtd.h"
2425

2526
#ifdef __cplusplus
2627
extern "C" {
@@ -62,13 +63,24 @@ extern "C" {
6263
#define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */
6364
/** @} */
6465

65-
#if defined(MODULE_SDCARD_SPI)
66+
/**
67+
* @name MTD configuration
68+
* @{
69+
*/
70+
#define MTD_0 mtd0 /**< MTD device for SD Card */
71+
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
72+
/** @} */
73+
74+
/**
75+
* @name SD-Card interface configuration
76+
* @{
77+
*/
6678
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
6779
#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12)
6880
#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13)
6981
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14)
7082
#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15)
71-
#endif
83+
/** @} */
7284

7385
#if defined(MODULE_ST77XX) && defined(BOARD_SIPEED_LONGAN_NANO_TFT)
7486
#define ST77XX_PARAM_SPI SPI_DEV(1) /**< SPI device */

boards/waveshare-nrf52840-eval-kit/include/board.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#define BOARD_H
2121

2222
#include "board_common.h"
23+
#include "mtd.h"
2324

2425
#ifdef __cplusplus
2526
extern "C" {
@@ -82,6 +83,14 @@ extern "C" {
8283
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(0, 20)
8384
/** @} */
8485

86+
/**
87+
* @name MTD configuration
88+
* @{
89+
*/
90+
#define MTD_0 mtd0 /**< MTD device for SD Card */
91+
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
92+
/** @} */
93+
8594
#ifdef __cplusplus
8695
}
8796
#endif

drivers/ili9341/include/ili9341_params.h

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,45 @@ extern "C" {
7171
#define ILI9341_PARAM_OFFSET_Y 0 /**< Vertival offset */
7272
#endif
7373

74+
#if MODULE_LCD_SPI || DOXYGEN
75+
/** Default interface params if SPI serial interface is enabled */
76+
#define ILI9341_PARAM_IF_SPI .spi = ILI9341_PARAM_SPI, \
77+
.spi_clk = ILI9341_PARAM_SPI_CLK, \
78+
.spi_mode = ILI9341_PARAM_SPI_MODE,
79+
#else
80+
#define ILI9341_PARAM_IF_SPI
81+
#endif
82+
83+
#if MODULE_LCD_PARALLEL || DOXYGEN
84+
/** Default interface params if MCU 8080 8-bit parallel interface is enabled */
85+
#define ILI9341_PARAM_IF_PAR .d0_pin = ILI9341_PARAM_D0, \
86+
.d1_pin = ILI9341_PARAM_D1, \
87+
.d2_pin = ILI9341_PARAM_D2, \
88+
.d3_pin = ILI9341_PARAM_D3, \
89+
.d4_pin = ILI9341_PARAM_D4, \
90+
.d5_pin = ILI9341_PARAM_D5, \
91+
.d6_pin = ILI9341_PARAM_D6, \
92+
.d7_pin = ILI9341_PARAM_D7, \
93+
.wrx_pin = ILI9341_PARAM_WRX, \
94+
.rdx_pin = ILI9341_PARAM_RDX,
95+
#else
96+
#define ILI9341_PARAM_IF_PAR
97+
#endif
98+
7499
/**
75100
* @brief Default params
101+
*
102+
* @note The default parameter set defined here can only be used if a single
103+
* ILI9341 display and only one interface mode is used. If multiple
104+
* ILI9341 displays are used or if multiple interface modes are enabled
105+
* by the modules `lcd_spi`, lcd_parallel and `lcd_parallel_16bit`, a user
106+
* defined parameter set @ref ILI9341_PARAMS has to be defined. In the
107+
* latter case @ref lcd_params_t::spi must then be set to @ref SPI_UNDEF
108+
* for displays with MCU 8080 8-/16-bit parallel interfaces.
76109
*/
77110
#ifndef ILI9341_PARAMS
78-
#define ILI9341_PARAMS { .spi = ILI9341_PARAM_SPI, \
79-
.spi_clk = ILI9341_PARAM_SPI_CLK, \
80-
.spi_mode = ILI9341_PARAM_SPI_MODE, \
111+
#define ILI9341_PARAMS { ILI9341_PARAM_IF_SPI \
112+
ILI9341_PARAM_IF_PAR \
81113
.cs_pin = ILI9341_PARAM_CS, \
82114
.dcx_pin = ILI9341_PARAM_DCX, \
83115
.rst_pin = ILI9341_PARAM_RST, \
@@ -124,7 +156,6 @@ static const uint8_t ili9341_screen_ids[] =
124156
*/
125157
#define ILI9341_SCREEN_NUMOF ARRAY_SIZE(ili9341_screen_ids)
126158

127-
128159
#ifdef __cplusplus
129160
}
130161
#endif

0 commit comments

Comments
 (0)