mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/st77xx: add ST77XX_ROTATION macros that are more clear
This commit is contained in:
parent
a102560e53
commit
093593a3bd
@ -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 */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user