Skip to content

Commit

Permalink
Merge #19914 #19915
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
bors[bot] and gschorcht authored Sep 20, 2023
3 parents ec69cfd + bf981c8 + b0ec24b commit 1691dbe
Show file tree
Hide file tree
Showing 13 changed files with 517 additions and 76 deletions.
12 changes: 8 additions & 4 deletions boards/common/esp32x/include/board_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ extern "C" {
#define SPI_FLASH_DRIVE_START 0
#endif

/** Default MTD drive definition */
#define MTD_0 mtd0
#define MTD_0 mtd0 /**< Flash MTD device */
extern mtd_dev_t *mtd0; /**< Flash MTD device pointer */

/** Pointer to the default MTD drive structure */
extern mtd_dev_t *mtd0;
#if MODULE_MTD_SDCARD_DEFAULT || DOXYGEN

#define MTD_1 mtd1 /**< SD Card MTD device */
extern mtd_dev_t *mtd1; /**< SD Card MTD device pointer */

#endif /* MODULE_MTD_SDCARD_DEFAULT || DOXYGEN */

/**
* @brief MTD offset for SD Card interfaces
Expand Down
20 changes: 20 additions & 0 deletions boards/seeedstudio-gd32/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define BOARD_H

#include "board_common.h"
#include "mtd.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -67,6 +68,25 @@ extern "C" {
#define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */
/** @} */

/**
* @name MTD configuration
* @{
*/
#define MTD_0 mtd0 /**< MTD device for SD Card */
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
/** @} */

/**
* @name SD-Card interface configuration
* @{
*/
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12)
#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13)
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14)
#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15)
/** @} */

#ifdef __cplusplus
}
#endif
Expand Down
16 changes: 14 additions & 2 deletions boards/sipeed-longan-nano/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define BOARD_H

#include "board_common.h"
#include "mtd.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -62,13 +63,24 @@ extern "C" {
#define LED_BLUE_PIN LED2_PIN /**< LED2 is blue */
/** @} */

#if defined(MODULE_SDCARD_SPI)
/**
* @name MTD configuration
* @{
*/
#define MTD_0 mtd0 /**< MTD device for SD Card */
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
/** @} */

/**
* @name SD-Card interface configuration
* @{
*/
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
#define SDCARD_SPI_PARAM_CS GPIO_PIN(PORT_B, 12)
#define SDCARD_SPI_PARAM_CLK GPIO_PIN(PORT_B, 13)
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(PORT_B, 14)
#define SDCARD_SPI_PARAM_MOSI GPIO_PIN(PORT_B, 15)
#endif
/** @} */

#if defined(MODULE_ST77XX) && defined(BOARD_SIPEED_LONGAN_NANO_TFT)
#define ST77XX_PARAM_SPI SPI_DEV(1) /**< SPI device */
Expand Down
9 changes: 9 additions & 0 deletions boards/waveshare-nrf52840-eval-kit/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define BOARD_H

#include "board_common.h"
#include "mtd.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -82,6 +83,14 @@ extern "C" {
#define SDCARD_SPI_PARAM_MISO GPIO_PIN(0, 20)
/** @} */

/**
* @name MTD configuration
* @{
*/
#define MTD_0 mtd0 /**< MTD device for SD Card */
extern mtd_dev_t *mtd0; /**< MTD device pointer for SD Card */
/** @} */

#ifdef __cplusplus
}
#endif
Expand Down
39 changes: 35 additions & 4 deletions drivers/ili9341/include/ili9341_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,45 @@ extern "C" {
#define ILI9341_PARAM_OFFSET_Y 0 /**< Vertival offset */
#endif

#if MODULE_LCD_SPI || DOXYGEN
/** Default interface params if SPI serial interface is enabled */
#define ILI9341_PARAM_IF_SPI .spi = ILI9341_PARAM_SPI, \
.spi_clk = ILI9341_PARAM_SPI_CLK, \
.spi_mode = ILI9341_PARAM_SPI_MODE,
#else
#define ILI9341_PARAM_IF_SPI
#endif

#if MODULE_LCD_PARALLEL || DOXYGEN
/** Default interface params if MCU 8080 8-bit parallel interface is enabled */
#define ILI9341_PARAM_IF_PAR .d0_pin = ILI9341_PARAM_D0, \
.d1_pin = ILI9341_PARAM_D1, \
.d2_pin = ILI9341_PARAM_D2, \
.d3_pin = ILI9341_PARAM_D3, \
.d4_pin = ILI9341_PARAM_D4, \
.d5_pin = ILI9341_PARAM_D5, \
.d6_pin = ILI9341_PARAM_D6, \
.d7_pin = ILI9341_PARAM_D7, \
.wrx_pin = ILI9341_PARAM_WRX, \
.rdx_pin = ILI9341_PARAM_RDX,
#else
#define ILI9341_PARAM_IF_PAR
#endif

/**
* @brief Default params
*
* @note The default parameter set defined here can only be used if a single
* ILI9341 display and only one interface mode is used. If multiple
* ILI9341 displays are used or if multiple interface modes are enabled
* by the modules `lcd_spi`, lcd_parallel and `lcd_parallel_16bit`, a user
* defined parameter set @ref ILI9341_PARAMS has to be defined. In the
* latter case @ref lcd_params_t::spi must then be set to @ref SPI_UNDEF
* for displays with MCU 8080 8-/16-bit parallel interfaces.
*/
#ifndef ILI9341_PARAMS
#define ILI9341_PARAMS { .spi = ILI9341_PARAM_SPI, \
.spi_clk = ILI9341_PARAM_SPI_CLK, \
.spi_mode = ILI9341_PARAM_SPI_MODE, \
#define ILI9341_PARAMS { ILI9341_PARAM_IF_SPI \
ILI9341_PARAM_IF_PAR \
.cs_pin = ILI9341_PARAM_CS, \
.dcx_pin = ILI9341_PARAM_DCX, \
.rst_pin = ILI9341_PARAM_RST, \
Expand Down Expand Up @@ -124,7 +156,6 @@ static const uint8_t ili9341_screen_ids[] =
*/
#define ILI9341_SCREEN_NUMOF ARRAY_SIZE(ili9341_screen_ids)


#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit 1691dbe

Please sign in to comment.