From 093593a3bd97b87ace3545f3301df2935e2057be Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 24 Jul 2023 15:19:59 +0200 Subject: [PATCH 1/9] drivers/st77xx: add ST77XX_ROTATION macros that are more clear --- drivers/include/st77xx.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/include/st77xx.h b/drivers/include/st77xx.h index f88b711a0a..2353aca0f6 100644 --- a/drivers/include/st77xx.h +++ b/drivers/include/st77xx.h @@ -322,6 +322,34 @@ extern "C" { /** * @name ST77xx display rotation modes + * + * @note Using a rotation mode may require the definition of + * @ref ST77XX_PARAM_OFFSET_X or @ref ST77XX_PARAM_OFFSET_Y. + * + * Usually the dimension of an LCD is defined by W x H (width x height) in + * pixels, where width is the smaller dimension than height, e.g. 240 x 320 + * (W x H). The height is then used as parameter @ref ST77XX_PARAM_NUM_LINES + * and the width as parameter @ref ST77XX_PARAM_RGB_CHANNELS. So vertical + * orientation means no rotation. Vertical orientation is given when the + * connector is shown at the bottom of the display. + * + * For example, the ST7789 controller supports 320 gate outputs and 240 source + * outputs (RGB channels). A display with a size of 240 x 320 (W x H) pixels + * can be used by setting `ST77XX_PARAM_NUM_LINES=320` and + * `ST77XX_PARAM_RGB_CHANNELS=240`. + * + * However, if the ST7789 is used with a display of 240 x 240 (W x H) pixels + * and a rotation is used, an offset must be defined for X or Y because the + * origin of the image will change. For example, in the case of + * @ref ST77XX_ROTATION_90 an offset for X would have to be defined by + * `ST77XX_PARAM_OFFSET_X=80` and in the case of @ref ST77XX_ROTATION_180 + * an offset for Y would have to be defined by `ST77XX_PARAM_OFFSET_X=80`. + * + * Using the correct offset on rotation can be even more difficult if the + * display size in both dimensions is smaller than the size supported by + * the controller. In this case, the origin can deviate from 0, 0 even + * without rotation. + * * @{ */ #define ST77XX_ROTATION_VERT 0 /**< Vertical mode */ @@ -331,6 +359,14 @@ extern "C" { LCD_MADCTL_MX /**< Horizontal mode */ #define ST77XX_ROTATION_HORZ_FLIP LCD_MADCTL_MV | \ LCD_MADCTL_MY /**< Horizontal flipped */ + +#define ST77XX_ROTATION_0 0 /**< 0 deg counterclockwise */ +#define ST77XX_ROTATION_90 LCD_MADCTL_MV | \ + LCD_MADCTL_MY /**< 90 deg counterclockwise */ +#define ST77XX_ROTATION_180 LCD_MADCTL_MX | \ + LCD_MADCTL_MY /**< 180 deg counterclockwise */ +#define ST77XX_ROTATION_270 LCD_MADCTL_MV | \ + LCD_MADCTL_MX /**< 270 deg counterclockwise */ /** @} */ /** From 1f41d19c89563e74a55f14387a31cacdfb3e94f2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 24 Jul 2023 15:21:24 +0200 Subject: [PATCH 2/9] boards/adafruit-pybadge: use ST77xx rotation in degree --- boards/adafruit-pybadge/include/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/adafruit-pybadge/include/board.h b/boards/adafruit-pybadge/include/board.h index ff889e659d..11f7703210 100644 --- a/boards/adafruit-pybadge/include/board.h +++ b/boards/adafruit-pybadge/include/board.h @@ -76,7 +76,7 @@ extern "C" { #define ST77XX_PARAM_RGB_CHANNELS (128U) /**< Number of screen rgb channel (height) */ #define ST77XX_PARAM_RGB (1) /**< RGB configuration */ #define ST77XX_PARAM_INVERTED (0) /**< Inversion configuration */ -#define ST77XX_PARAM_ROTATION (ST77XX_ROTATION_HORZ_FLIP) /**< Rotation mode */ +#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_90 /**< Rotation mode */ #define LCD_SCREEN_WIDTH (ST77XX_PARAM_NUM_LINES) /**< LCD screen width */ #define LCD_SCREEN_HEIGHT (ST77XX_PARAM_RGB_CHANNELS) /**< LCD screen height */ /** @} */ From 278428850651caa119ce842c1e5fb5de35b28727 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 24 Jul 2023 15:21:50 +0200 Subject: [PATCH 3/9] boards/esp32s2-lilygo-ttgo-t8: use ST77xx rotation in degree --- boards/esp32s2-lilygo-ttgo-t8/include/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/esp32s2-lilygo-ttgo-t8/include/board.h b/boards/esp32s2-lilygo-ttgo-t8/include/board.h index c26425fce6..de7455f1d4 100644 --- a/boards/esp32s2-lilygo-ttgo-t8/include/board.h +++ b/boards/esp32s2-lilygo-ttgo-t8/include/board.h @@ -99,7 +99,7 @@ #define ST77XX_PARAM_INVERTED 1 /**< Inverted mode enable */ #define ST77XX_PARAM_NUM_LINES 240U /**< Number of lines */ #define ST77XX_PARAM_RGB_CHANNELS 135U /**< Number of columns */ -#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_HORZ /**< Rotation */ +#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_270 /**< Rotation */ #define ST77XX_PARAM_OFFSET_X 40 /**< X offset */ #define ST77XX_PARAM_OFFSET_Y 52 /**< Y offset */ #endif From a14d71ee83ec6e115e04392b871066cd9269ae5e Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 24 Jul 2023 15:22:08 +0200 Subject: [PATCH 4/9] boards/esps3-usb-otg: use ST77xx rotation in degree --- boards/esp32s3-usb-otg/include/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/esp32s3-usb-otg/include/board.h b/boards/esp32s3-usb-otg/include/board.h index 2ab1747506..2a3533b49b 100644 --- a/boards/esp32s3-usb-otg/include/board.h +++ b/boards/esp32s3-usb-otg/include/board.h @@ -159,7 +159,7 @@ #define ST77XX_PARAM_RST LCD_RST #define ST77XX_PARAM_NUM_LINES 240 #define ST77XX_PARAM_RGB_CHANNELS 240 -#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_VERT +#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_0 #define ST77XX_PARAM_INVERTED 1 #define ST77XX_PARAM_RGB 1 From af9e1207d07fe9a4ae622158dd8edb2e0d11d23c Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 24 Jul 2023 15:22:37 +0200 Subject: [PATCH 5/9] boards/sipeed-longan-nano: use ST77xx rotation in degree --- boards/sipeed-longan-nano/include/board.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/sipeed-longan-nano/include/board.h b/boards/sipeed-longan-nano/include/board.h index 85e86eb2cb..fbb971eb22 100644 --- a/boards/sipeed-longan-nano/include/board.h +++ b/boards/sipeed-longan-nano/include/board.h @@ -81,7 +81,7 @@ extern "C" { #define ST77XX_PARAM_INVERTED 1 /**< Inverted mode enable */ #define ST77XX_PARAM_NUM_LINES 160U /**< Number of lines */ #define ST77XX_PARAM_RGB_CHANNELS 80U /**< Number of columns */ -#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_HORZ /**< Rotation mode */ +#define ST77XX_PARAM_ROTATION ST77XX_ROTATION_270 /**< Rotation mode */ #define ST77XX_PARAM_OFFSET_Y 25 /**< Vertical offset */ #endif From ac52818a813036d48409b189794f30b5c3b7aed0 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 18 Sep 2023 18:24:34 +0200 Subject: [PATCH 6/9] boards/sipeed-longan-nano: fix doc for doxygen 1.9.4 --- boards/sipeed-longan-nano/doc.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/boards/sipeed-longan-nano/doc.txt b/boards/sipeed-longan-nano/doc.txt index 0d7eb442cb..705ee69913 100644 --- a/boards/sipeed-longan-nano/doc.txt +++ b/boards/sipeed-longan-nano/doc.txt @@ -16,11 +16,11 @@ on-board components: - USB Type C - TF card slot - 3 user LEDs -- 0.96" TFT display 160 x 80 pixel (optional) +- 0.96 inches TFT display 160 x 80 pixel (optional) -@image html "https://media-cdn.seeedstudio.com/media/catalog/product/cache/7f7f32ef807b8c2c2215b49801c56084/1/1/114992425_1.jpg" "Sipeed Longan Nano" width=600 +@image html "https://wiki.sipeed.com/hardware/assets/Longan/nano/Longan_nano.124.jpg" "Sipeed Longan Nano" width=600 -## Hardware: +## Hardware | MCU | GD32VF103CBT6 | Supported | |:----------- |:-------------------------------------- | --------- | @@ -173,11 +173,10 @@ BOARD=sipeed-longan-nano-tft make -C examples/hello-world flash ### Using an external debug adapter -The board can also be flashed via a JTAG interface with OpenOCD (at least [release version 0.12.0] -(https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)). +The board can also be flashed via a JTAG interface with OpenOCD (at least +[release version 0.12.0](https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)). By default, an FTDI adapter according to the configuration defined in -[`interface/openocd-usb.cfg`] -(https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg) +[`interface/openocd-usb.cfg`](https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg) is assumed. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROGRAMMER=openocd BOARD=sipeed-longan-nano make -C examples/hello-world flash From 64a95a29b0b77e7f48fd46e01632b7c7496f53ac Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 18 Sep 2023 18:24:46 +0200 Subject: [PATCH 7/9] boards/sipeed-longan-nano-tft: fix doc for doxygen 1.9.4 --- boards/sipeed-longan-nano-tft/doc.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/sipeed-longan-nano-tft/doc.txt b/boards/sipeed-longan-nano-tft/doc.txt index 623109080f..cdded78e51 100644 --- a/boards/sipeed-longan-nano-tft/doc.txt +++ b/boards/sipeed-longan-nano-tft/doc.txt @@ -12,7 +12,7 @@ that is equipped with a TFT display with the following on-board components: - USB Type C - TF card slot - 3 user LEDs -- 0.96" TFT display 160 x 80 pixel +- 0.96 inches TFT display 160 x 80 pixel @image html "https://media-cdn.seeedstudio.com/media/catalog/product/cache/7f7f32ef807b8c2c2215b49801c56084/1/1/114992425_1.jpg" "Sipeed Longan Nano" width=600 From c58d71a2ef711b5e2deff377f3ef1fb8ba19c4aa Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Mon, 18 Sep 2023 18:25:19 +0200 Subject: [PATCH 8/9] boards/seeedstudio-gd32: fix doc for doxygen 1.9.4 --- boards/seeedstudio-gd32/doc.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/boards/seeedstudio-gd32/doc.txt b/boards/seeedstudio-gd32/doc.txt index bc4a4add70..fc803b9149 100644 --- a/boards/seeedstudio-gd32/doc.txt +++ b/boards/seeedstudio-gd32/doc.txt @@ -7,8 +7,7 @@ ## Overview -The [Seedstudio GD32 RISC-V Dev Board] -(https://wiki.seeedstudio.com/SeeedStudio-GD32-RISC-V-Dev-Board/) is a +The [Seedstudio GD32 RISC-V Dev Board](https://wiki.seeedstudio.com/SeeedStudio-GD32-RISC-V-Dev-Board/) is a development board for the GigaDevice GD32VF103VBT6 MCU with the following on-board components: @@ -147,11 +146,10 @@ All other pins are either not broken out or have no special usage. ## Flashing the Device -The board is flashed via a JTAG interface with OpenOCD (at least [release version 0.12.0] -(https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)). +The board is flashed via a JTAG interface with OpenOCD (at least +[release version 0.12.0](https://github.com/openocd-org/openocd/tree/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c)). By default, an FTDI adapter according to the configuration defined in -[`interface/openocd-usb.cfg`] -(https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg) +[`interface/openocd-usb.cfg`](https://github.com/openocd-org/openocd/blob/9ea7f3d647c8ecf6b0f1424002dfc3f4504a162c/tcl/interface/ftdi/openocd-usb.cfg) is assumed. ``` BOARD=seeedstudio-gd32 make -C examples/hello-world flash From 45248805811492e17bf8d98ef1f0c865cfa0fcff Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Wed, 20 Sep 2023 10:49:40 +0200 Subject: [PATCH 9/9] boards/nucleo64: fix SPI Arduino mapping for most boards Before, the Arduino SPI mapping for all Nucleo-64 boards was incorrect. With this, the situation improves to the following: - [x] nucleo-f030r8 - [ ] nucleo-f070rb - No SPI buses provided - [x] nucleo-f072rb - [x] nucleo-f091rc - [x] nucleo-f103rb - [ ] nucleo-f302r8 - No SPI bus at D11, D12, D13 provided - [x] nucleo-f303re - [x] nucleo-f334r8 - [x] nucleo-f401re - [x] nucleo-f410rb - [x] nucleo-f411re - [x] nucleo-f446re - [x] nucleo-g070rb - [x] nucleo-g071rb - [x] nucleo-g431rb - [x] nucleo-g474re - [x] nucleo-l053r8 - [x] nucleo-l073rz - [x] nucleo-l152re - [ ] nucleo-l433rc - No SPI bus at D11, D12, D13 provided - [x] nucleo-l452re - [x] nucleo-l476rg - [x] nucleo-wl55jc The remaining offenders still need to be fixed, but that is better done one PR at a time. --- boards/common/nucleo64/include/arduino_iomap.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/boards/common/nucleo64/include/arduino_iomap.h b/boards/common/nucleo64/include/arduino_iomap.h index 4844271eee..c6debeedc3 100644 --- a/boards/common/nucleo64/include/arduino_iomap.h +++ b/boards/common/nucleo64/include/arduino_iomap.h @@ -24,6 +24,7 @@ #include "periph/gpio.h" #include "periph/adc.h" +#include "periph_conf.h" #ifdef __cplusplus extern "C" { @@ -43,7 +44,9 @@ extern "C" { /** * @brief SPI_DEV(1) is connected to D11/D12/D13 */ -#define ARDUINO_SPI_D11D12D13 SPI_DEV(1) +#if !defined(ARDUINO_SPI_D11D12D13) && defined(SPI_NUMOF) +#define ARDUINO_SPI_D11D12D13 SPI_DEV(0) +#endif /** @} */ /**