F203/Core/Inc/stm32756g_eval_lcd.h

376 lines
15 KiB
C
Raw Normal View History

2023-12-13 16:59:07 +03:00
/**
******************************************************************************
* @file stm32756g_eval_lcd.h
* @author MCD Application Team
* @brief This file contains the common defines and functions prototypes for
* the stm32756g_eval_lcd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32756G_EVAL_LCD_H
#define __STM32756G_EVAL_LCD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "fonts.h"
#include "GUI_TypeDef.h"
#include "stm32f7xx.h"
/* Include LCD component Driver */
/* LCD integrated within MB1063 */
/** @addtogroup BSP
* @{
*/
/** @addtogroup STM32756G_EVAL
* @{
*/
/** @addtogroup STM32756G_EVAL_LCD
* @{
*/
/** @defgroup STM32756G_EVAL_LCD_Exported_Types LCD Exported Types
* @{
*/
typedef struct
{
uint32_t TextColor;
uint32_t BackColor;
sFONT *pFont;
}LCD_DrawPropTypeDef;
typedef struct
{
int16_t X;
int16_t Y;
}Point, * pPoint;
/**
* @brief Line mode structures definition
*/
typedef enum
{
CENTER_MODE = 0x01, /* Center mode */
RIGHT_MODE = 0x02, /* Right mode */
LEFT_MODE = 0x03 /* Left mode */
}Text_AlignModeTypdef;
/**
* @}
*/
#define MAX_LAYER_NUMBER ((uint32_t) 2)
#define LCD_LayerCfgTypeDef LTDC_LayerCfgTypeDef
#define LTDC_ACTIVE_LAYER ((uint32_t) 1)
#define LCD_OK ((uint8_t) 0x00)
#define LCD_ERROR ((uint8_t) 0x01)
#define LCD_TIMEOUT ((uint8_t) 0x02)
//#define LCD_FB_START_ADDRESS ((uint32_t) 0x64030000)
/* The programmed LTDC pixel clock depends on the vertical refresh rate of the panel 60Hz => 25.16MHz and
the LCD/SDRAM bandwidth affected by the several access on the bus and the number of used layers.
when only one layer is enabled "LCD_MAX_PCLK" can be used and when two layers are enabled simultaneously
or/and there is several access on the bus "LCD_MIN_PCLK" parameter is recommended */
#define LCD_MAX_PCLK ((uint8_t) 0x00)
#define LCD_MIN_PCLK ((uint8_t) 0x01)
#define CHECKBOX_LINE_5 93
#define CHECKBOX_LINE_6 109
#define CHECKBOX_LINE_7 125
#define CHECKBOX_LINE_8 141
#define CHECKBOX_LINE_9 157
#define CHECKBOX_LINE_10 173
#define CHECKBOX_LINE_11 189
#define CHECKBOX_LINE_12 205
#define CHECKBOX_LINE_13 221
/**
* @brief LCD color
*/
#define LINE(x) ((x) * 16)
#define LCD_LINE_0 LINE(0)
#define LCD_LINE_1 LINE(1)
#define LCD_LINE_2 (7 + LINE(2))
#define LCD_LINE_3 (10 + LINE(3))
#define LCD_LINE_4 (10 + LINE(4))
#define LCD_LINE_5 (10 + LINE(5))
#define LCD_LINE_6 (10 + LINE(6))
#define LCD_LINE_7 (10 + LINE(7))
#define LCD_LINE_8 (10 + LINE(8))
#define LCD_LINE_9 (10 + LINE(9))
#define LCD_LINE_10 (10 + LINE(10))
#define LCD_LINE_11 (10 + LINE(11))
#define LCD_LINE_12 (10 + LINE(12))
#define LCD_LINE_13 (10 + LINE(13))
#define LCD_LINE_14 (10 + LINE(14))
#define LCD_LINE_15 (10 + LINE(15))
#define LCD_LINE_16 (10 + LINE(16))
#define LCD_LINE_17 LINE(17)
#define LCD_LINE_18 LINE(18)
#define LCD_LINE_19 LINE(19)
#define LCD_LINE_20 LINE(20)
#define LCD_LINE_21 LINE(21)
#define LCD_LINE_22 LINE(22)
#define LCD_LINE_23 LINE(23)
#define LCD_LINE_24 LINE(24)
#define LCD_LINE_25 LINE(25)
#define LCD_LINE_26 LINE(26)
#define LCD_LINE_27 LINE(27)
#define LCD_LINE_28 LINE(28)
#define LCD_LINE_29 LINE(29)
#define LCD_LINE_30 LINE(30)
static const uint16_t POS_Y_17[] = { LCD_LINE_5, LCD_LINE_6, LCD_LINE_7, LCD_LINE_8, LCD_LINE_9, LCD_LINE_10, LCD_LINE_11 , LCD_LINE_12};
#define LINE12(x) ((x) * 12)
#define LCD_LINE12_0 LINE12(0)
#define LCD_LINE12_1 LINE12(1)
#define LCD_LINE12_2 LINE12(2)
#define LCD_LINE12_3 LINE12(3)
#define LCD_LINE12_4 LINE12(4)
#define LCD_LINE12_5 (34 + LINE12(5))
#define LCD_LINE12_6 (34 + LINE12(6))
#define LCD_LINE12_7 (34 + LINE12(7))
#define LCD_LINE12_8 (34 + LINE12(8))
#define LCD_LINE12_9 (34 + LINE12(9))
#define LCD_LINE12_10 (34 + LINE12(10))
#define LCD_LINE12_11 (34 + LINE12(11))
#define LCD_LINE12_12 (34 + LINE12(12))
#define LCD_LINE12_13 (34 + LINE12(13))
#define LCD_LINE12_14 (34 + LINE12(14))
#define LCD_LINE12_15 (34 + LINE12(15))
#define LCD_LINE12_16 (34 + LINE12(16))
#define LCD_LINE12_17 (34 + LINE12(17))
#define LCD_LINE12_18 (34 + LINE12(18))
#define LCD_LINE12_19 (34 + LINE12(19))
#define LCD_LINE12_20 (34 + LINE12(20))
#define LCD_LINE12_21 (34 + LINE12(21))
#define LCD_LINE12_22 (34 + LINE12(22))
#define LCD_LINE12_23 (34 + LINE12(23))
#define LCD_LINE12_24 (34 + LINE12(24))
static const uint16_t POS_Y_12[15] = {
LCD_LINE12_5, LCD_LINE12_6, LCD_LINE12_7, LCD_LINE12_8, LCD_LINE12_9, LCD_LINE12_10, LCD_LINE12_11, LCD_LINE12_12,
LCD_LINE12_13, LCD_LINE12_14, LCD_LINE12_15, LCD_LINE12_16, LCD_LINE12_17, LCD_LINE12_18, LCD_LINE12_19
};
#define LCD_COLOR_CLEAR ((uint32_t)0xFF0A0F1F)//((uint32_t)0xFF131C3D)
#define LCD_COLOR_BLUE ((uint32_t)0xFF0000FF)
#define LCD_COLOR_GREEN ((uint32_t)0xFF00FF00)
#define LCD_COLOR_RED ((uint32_t)0xFFFF0000)
#define LCD_COLOR_CYAN ((uint32_t)0xFF00FFFF)
#define LCD_COLOR_MAGENTA ((uint32_t)0xFFFF00FF)
#define LCD_COLOR_YELLOW ((uint32_t)0xFFFFFF00)
#define LCD_COLOR_LIGHTBLUE ((uint32_t)0xFF8080FF)
#define LCD_COLOR_LIGHTGREEN ((uint32_t)0xFF80FF80)
#define LCD_COLOR_LIGHTRED ((uint32_t)0xFFFF8080)
#define LCD_COLOR_LIGHTCYAN ((uint32_t)0xFF80FFFF)
#define LCD_COLOR_LIGHTMAGENTA ((uint32_t)0xFFFF80FF)
#define LCD_COLOR_LIGHTYELLOW ((uint32_t)0xFFFFFF80)
#define LCD_COLOR_NUMGREEN ((uint32_t)0xFFB8E828)
//#define LCD_COLOR_BORDER ((uint32_t)0xFFFFFF80)
#define LCD_COLOR_VIBGREEN ((uint32_t)0xFF29EB19)
//#define LCD_COLOR_MY_YELLOW ((uint32_t)0xFFD0D000)
#define LCD_COLOR_MY_YELLOW ((uint32_t)0xFFD8AA57)//((uint32_t)0xFFFFA46C)
#define LCD_COLOR_DARKBLUE ((uint32_t)0xFF000080)
#define LCD_COLOR_DARKGREEN ((uint32_t)0xFF008000)
#define LCD_COLOR_DARKYELLOW ((uint32_t)0xFF808000)
#define LCD_COLOR_DARKRED ((uint32_t)0xFF800000)
#define MY_LCD_COLOR_DARKGREEN ((uint32_t)0xFF004000)
#define MY_LCD_COLOR_DARKYELLOW ((uint32_t)0xFF404000)
#define MY_LCD_COLOR_DARKRED ((uint32_t)0xFF400000)
#define LCD_COLOR_DARKCYAN ((uint32_t)0xFF008080)
#define LCD_COLOR_DARKMAGENTA ((uint32_t)0xFF800080)
#define LCD_COLOR_WHITE ((uint32_t)0xFFFFFFFF)
#define LCD_COLOR_LIGHTGRAY ((uint32_t)0xFFD3D3D3)
#define LCD_COLOR_GRAY ((uint32_t)0xFF808080)
#define LCD_COLOR_DARKGRAY ((uint32_t)0xFF404040)
#define LCD_COLOR_BLACK ((uint32_t)0xFF000000)
#define LCD_COLOR_BROWN ((uint32_t)0xFFA52A2A)
#define LCD_COLOR_ORANGE ((uint32_t)0xFFFFA500)
#define LCD_COLOR_TRANSPARENT ((uint32_t)0xFF000000)
#define LCD_COLOR_MYBROWN ((uint32_t)0xFFD3B36E)
//0xB724
#define LCD_COLOR_MYGREEN ((uint32_t)0xFF26A01F)
#define LCD_COLOR_FVR ((uint32_t)0xFF66A6D3)
#define LCD_COLOR_FN ((uint32_t)0xFF800080)
#define LCD_COLOR_FV ((uint32_t)0xFFA52A2A)
#define LCD_COLOR_FTK ((uint32_t)0xFFB700EB)
#define LCD_COLOR_FC ((uint32_t)0xFFAFFF9C)
//#define LCD_COLOR_CURSOR ((uint32_t)0xFF8993a2)
#define LCD_COLOR_CURSOR ((uint32_t)0xFF606060)//LCD_COLOR_GRAY
#define R5(rgb565) ( (uint32_t) (((rgb565) & 0xF800) >> 11) )
#define G6(rgb565) ( (uint32_t) (((rgb565) & 0x07E0) >> 5) )
#define B5(rgb565) ( (uint32_t) ((rgb565) & 0x001F) )
#define COLOR24TO16(X) ((uint16_t) ((((((X) >> 16) & 0xF8) << 8) | ((((X) >> 8) & 0xFC) << 3) | (((X) & 0xF8) >> 3))))
#define ASSEMBLE_RGB(R,G,B) ((((R)& 0xF8) << 8) | (((G) & 0xFC) << 3) | (((B) & 0xF8) >> 3))
#define LCD_DEFAULT_FONT Font24
#define LCD_RELOAD_IMMEDIATE ((uint32_t) LTDC_SRCR_IMR)
#define LCD_RELOAD_VERTICAL_BLANKING ((uint32_t) LTDC_SRCR_VBR)
/**
* @}
*/
/** @defgroup STM32756G_EVAL_LCD_Exported_Functions LCD Exported Functions
* @{
*/
uint8_t BSP_LCD_Init(void);
uint8_t BSP_LCD_InitEx(uint32_t PclkConfig);
uint8_t BSP_LCD_DeInit(void);
uint32_t BSP_LCD_GetXSize(void);
uint32_t BSP_LCD_GetYSize(void);
void BSP_LCD_SetXSize(uint32_t imageWidthPixels);
void BSP_LCD_SetYSize(uint32_t imageHeightPixels);
/* Functions using the LTDC controller */
void BSP_LCD_LayerDefaultInit(uint16_t LayerIndex, uint32_t FrameBuffer);
void BSP_LCD_SetTransparency(uint32_t LayerIndex, uint8_t Transparency);
void BSP_LCD_SetTransparency_NoReload(uint32_t LayerIndex, uint8_t Transparency);
void BSP_LCD_SetLayerAddress(uint32_t LayerIndex, uint32_t Address);
void BSP_LCD_SetLayerAddress_NoReload(uint32_t LayerIndex, uint32_t Address);
void BSP_LCD_SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue);
void BSP_LCD_SetColorKeying_NoReload(uint32_t LayerIndex, uint32_t RGBValue);
void BSP_LCD_ResetColorKeying(uint32_t LayerIndex);
void BSP_LCD_ResetColorKeying_NoReload(uint32_t LayerIndex);
void BSP_LCD_SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
void BSP_LCD_SetLayerWindow_NoReload(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
void BSP_LCD_SelectLayer(uint32_t LayerIndex);
void BSP_LCD_SetLayerVisible(uint32_t LayerIndex, FunctionalState State);
void BSP_LCD_SetLayerVisible_NoReload(uint32_t LayerIndex, FunctionalState State);
void BSP_LCD_Relaod(uint32_t ReloadType);
void BSP_LCD_SetTextColor(uint32_t Color);
uint32_t BSP_LCD_GetTextColor(void);
void BSP_LCD_SetBackColor(uint32_t Color);
uint32_t BSP_LCD_GetBackColor(void);
void BSP_LCD_SetFont(sFONT *fonts);
sFONT *BSP_LCD_GetFont(void);
uint32_t BSP_LCD_ReadPixel(uint16_t Xpos, uint16_t Ypos);
void BSP_LCD_DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t pixel);
void BSP_LCD_Clear(uint32_t Color);
void BSP_LCD_ClearStringLine(uint32_t Line);
void BSP_LCD_DisplayStringAtLine(uint16_t Line, char *ptr);
void BSP_LCD_DisplayStringAt(uint16_t Xpos, uint16_t Ypos, char *Text, Text_AlignModeTypdef Mode);
void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii);
void BSP_LCD_DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void BSP_LCD_DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length);
void BSP_LCD_DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
void BSP_LCD_DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
void BSP_LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
void BSP_LCD_DrawPolygon(pPoint Points, uint16_t PointCount);
void BSP_LCD_DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
void BSP_LCD_DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp);
void BSP_LCD_FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
void BSP_LCD_FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius);
void BSP_LCD_FillPolygon(pPoint Points, uint16_t PointCount);
void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3);
void BSP_LCD_FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius);
void BSP_LCD_DisplayOff(void);
void BSP_LCD_DisplayOn(void);
uint32_t RGB565_TO_RGB888(uint16_t rgb565);
uint16_t SWAP_BITS(uint16_t a);
void LCD_DisplayChar(uint16_t Line, uint16_t Column, uint8_t Ascii);
void LCD_DisplayString(uint16_t X, uint16_t Line, char *ptr);
void LCD_DisplayStringC(uint16_t X, uint16_t Line, char *ptr);
void LCD_DisplayStringR(uint16_t X, uint16_t Line, char *ptr);
void BSP_LCD_DrawVLineThick(uint16_t Xpos, uint16_t Ypos, uint16_t Length, uint16_t Thick);
void DrawImage(const GUI_BITMAP * pBM, uint16_t x0, uint16_t y0);
//void DrawAlphaImage(const GUI_BITMAP * pBM_1, const GUI_BITMAP * pBM_2, uint16_t x0, uint16_t y0);
void LCD_SetColors(uint32_t ColorUp, uint32_t ColorDn);
void LCD_Refresh(void);
/* These functions can be modified in case the current settings
need to be changed for specific application needs */
//void BSP_LCD_MspInit(LTDC_HandleTypeDef *hltdc, void *Params);
//void BSP_LCD_MspDeInit(LTDC_HandleTypeDef *hltdc, void *Params);
//void BSP_LCD_ClockConfig(LTDC_HandleTypeDef *hltdc, void *Params);
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32756G_EVAL_LCD_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/