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 */ /** @} */ 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 /** @} */ /** 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 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 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 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 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 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 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 */ /** @} */ /**