add P4 & P5
This commit is contained in:
92
P5_SETR2/Components/hx8347g/Release_Notes.html
Normal file
92
P5_SETR2/Components/hx8347g/Release_Notes.html
Normal file
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>Release Notes for HX8347G Component Drivers</title>
|
||||
<style type="text/css">
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
span.underline{text-decoration: underline;}
|
||||
div.column{display: inline-block; vertical-align: top; width: 50%;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="../../../../_htmresc/mini-st.css" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-4">
|
||||
<div class="card fluid">
|
||||
<div class="sectione dark">
|
||||
<center>
|
||||
<h1 id="release-notes-for-hx8347g-component-drivers"><small>Release Notes for</small> <mark>HX8347G Component Drivers</mark></h1>
|
||||
<p>Copyright © 2016 STMicroelectronics<br />
|
||||
</p>
|
||||
<a href="https://www.st.com" class="logo"><img src="../../../../_htmresc/st_logo.png" alt="ST logo" /></a>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
<h1 id="license">License</h1>
|
||||
<p>Licensed by ST under BSD 3-Clause license (the "License"). You may not use this package except in compliance with the License. You may obtain a copy of the License at:</p>
|
||||
<p><a href="https://opensource.org/licenses/BSD-3-Clause">https://opensource.org/licenses/BSD-3-Clause</a></p>
|
||||
<h1 id="purpose">Purpose</h1>
|
||||
<p>This directory contains the HX8347G component drivers.</p>
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-8">
|
||||
<h1 id="update-history">Update History</h1>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section22" checked aria-hidden="true"> <label for="collapse-section22" aria-hidden="true">V1.1.2 / 03-April-2019</label>
|
||||
<div>
|
||||
<h2 id="main-changes">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Update release notes format</li>
|
||||
<li>Reformat the BSD 3-Clause license declaration in the files header (replace license terms by a web reference to OSI website where those terms lie)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section19" aria-hidden="true"> <label for="collapse-section19" aria-hidden="true">V1.1.1 / 16-February-2016</label>
|
||||
<div>
|
||||
<h2 id="main-changes-1">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Fix hx8347g_ReadReg() to write Index in Index Register (IR)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section18" aria-hidden="true"> <label for="collapse-section18" aria-hidden="true">V1.1.0 / 10-February-2015</label>
|
||||
<div>
|
||||
<h2 id="main-changes-2">Main Changes</h2>
|
||||
<ul>
|
||||
<li>Harmonize all LCD controllers Link usage (Change LCD_IO_WriteData to LCD_IO_WriteMultipleData)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section185" aria-hidden="true"> <label for="collapse-section185" aria-hidden="true">V1.0.1 / 02-December-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-3">Main Changes</h2>
|
||||
<ul>
|
||||
<li>hx8347g.h: change “\” by “/” in the include path to fix compilation issue under Linux</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="collapse">
|
||||
<input type="checkbox" id="collapse-section17" aria-hidden="true"> <label for="collapse-section17" aria-hidden="true">V1.0.0 / 06-May-2014</label>
|
||||
<div>
|
||||
<h2 id="main-changes-4">Main Changes</h2>
|
||||
<ul>
|
||||
<li>First official release of HX8347G LCD component driver</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="sticky">
|
||||
For complete documentation on <mark>STM32 Microcontrollers</mark> , visit: <a href="http://www.st.com/STM32">http://www.st.com/STM32</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
473
P5_SETR2/Components/hx8347g/hx8347g.c
Normal file
473
P5_SETR2/Components/hx8347g/hx8347g.c
Normal file
@@ -0,0 +1,473 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file hx8347g.c
|
||||
* @author MCD Application Team
|
||||
* @brief This file includes the LCD driver for HX8347G LCD.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "hx8347g.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup HX8347G
|
||||
* @brief This file provides a set of functions needed to drive the
|
||||
* HX8347G LCD.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
LCD_DrvTypeDef hx8347g_drv =
|
||||
{
|
||||
hx8347g_Init,
|
||||
hx8347g_ReadID,
|
||||
hx8347g_DisplayOn,
|
||||
hx8347g_DisplayOff,
|
||||
hx8347g_SetCursor,
|
||||
hx8347g_WritePixel,
|
||||
hx8347g_ReadPixel,
|
||||
hx8347g_SetDisplayWindow,
|
||||
hx8347g_DrawHLine,
|
||||
hx8347g_DrawVLine,
|
||||
hx8347g_GetLcdPixelWidth,
|
||||
hx8347g_GetLcdPixelHeight,
|
||||
hx8347g_DrawBitmap,
|
||||
};
|
||||
|
||||
static uint8_t Is_hx8347g_Initialized = 0;
|
||||
static uint16_t ArrayRGB[320] = {0};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initialise the HX8347G LCD Component.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_Init(void)
|
||||
{
|
||||
if(Is_hx8347g_Initialized == 0)
|
||||
{
|
||||
Is_hx8347g_Initialized = 1;
|
||||
|
||||
/* Initialise HX8347G low level bus layer --------------------------------*/
|
||||
LCD_IO_Init();
|
||||
|
||||
/* HX8347G requests 120ms (worst case) after reset */
|
||||
LCD_Delay(120);
|
||||
|
||||
/* Driving ability setting */
|
||||
hx8347g_WriteReg(LCD_REG_234, 0x00);
|
||||
hx8347g_WriteReg(LCD_REG_235, 0x20);
|
||||
hx8347g_WriteReg(LCD_REG_236, 0x0C);
|
||||
hx8347g_WriteReg(LCD_REG_237, 0xC4);
|
||||
hx8347g_WriteReg(LCD_REG_232, 0x40);
|
||||
hx8347g_WriteReg(LCD_REG_233, 0x38);
|
||||
hx8347g_WriteReg(LCD_REG_241, 0x01);
|
||||
hx8347g_WriteReg(LCD_REG_242, 0x10);
|
||||
hx8347g_WriteReg(LCD_REG_39, 0xA3);
|
||||
|
||||
/* Adjust the Gamma Curve */
|
||||
hx8347g_WriteReg(LCD_REG_64, 0x01);
|
||||
hx8347g_WriteReg(LCD_REG_65, 0x00);
|
||||
hx8347g_WriteReg(LCD_REG_66, 0x00);
|
||||
hx8347g_WriteReg(LCD_REG_67, 0x10);
|
||||
hx8347g_WriteReg(LCD_REG_68, 0x0E);
|
||||
hx8347g_WriteReg(LCD_REG_69, 0x24);
|
||||
hx8347g_WriteReg(LCD_REG_70, 0x04);
|
||||
hx8347g_WriteReg(LCD_REG_71, 0x50);
|
||||
hx8347g_WriteReg(LCD_REG_72, 0x02);
|
||||
hx8347g_WriteReg(LCD_REG_73, 0x13);
|
||||
hx8347g_WriteReg(LCD_REG_74, 0x19);
|
||||
hx8347g_WriteReg(LCD_REG_75, 0x19);
|
||||
hx8347g_WriteReg(LCD_REG_76, 0x16);
|
||||
hx8347g_WriteReg(LCD_REG_80, 0x1B);
|
||||
hx8347g_WriteReg(LCD_REG_81, 0x31);
|
||||
hx8347g_WriteReg(LCD_REG_82, 0x2F);
|
||||
hx8347g_WriteReg(LCD_REG_83, 0x3F);
|
||||
hx8347g_WriteReg(LCD_REG_84, 0x3F);
|
||||
hx8347g_WriteReg(LCD_REG_85, 0x3E);
|
||||
hx8347g_WriteReg(LCD_REG_86, 0x2F);
|
||||
hx8347g_WriteReg(LCD_REG_87, 0x7B);
|
||||
hx8347g_WriteReg(LCD_REG_88, 0x09);
|
||||
hx8347g_WriteReg(LCD_REG_89, 0x06);
|
||||
hx8347g_WriteReg(LCD_REG_90, 0x06);
|
||||
hx8347g_WriteReg(LCD_REG_91, 0x0C);
|
||||
hx8347g_WriteReg(LCD_REG_92, 0x1D);
|
||||
hx8347g_WriteReg(LCD_REG_93, 0xCC);
|
||||
|
||||
/* Power voltage setting */
|
||||
hx8347g_WriteReg(LCD_REG_27, 0x1B);
|
||||
hx8347g_WriteReg(LCD_REG_26, 0x01);
|
||||
hx8347g_WriteReg(LCD_REG_36, 0x2F);
|
||||
hx8347g_WriteReg(LCD_REG_37, 0x57);
|
||||
/*****VCOM offset ****/
|
||||
hx8347g_WriteReg(LCD_REG_35, 0x86);
|
||||
|
||||
hx8347g_DisplayOn();
|
||||
|
||||
/* Set GRAM Area - Partial Display Control */
|
||||
hx8347g_WriteReg(LCD_REG_1, 0x00); /* DP_STB = 0, DP_STB_S = 0, SCROLL = 0, */
|
||||
hx8347g_SetDisplayWindow(0, 0, hx8347g_GetLcdPixelWidth(), hx8347g_GetLcdPixelHeight());
|
||||
hx8347g_WriteReg(LCD_REG_22, 0xA0); /* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
|
||||
}
|
||||
|
||||
/* Set the Cursor */
|
||||
hx8347g_SetCursor(0, 0);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_DisplayOn(void)
|
||||
{
|
||||
/* Power On sequence ---------------------------------------------------------*/
|
||||
hx8347g_WriteReg(LCD_REG_24, 0x36); /* Display frame rate = 70Hz RADJ = '0110' */
|
||||
hx8347g_WriteReg(LCD_REG_25, 0x01); /* OSC_EN = 1 */
|
||||
hx8347g_WriteReg(LCD_REG_28, 0x06); /* AP[2:0] = 111 */
|
||||
hx8347g_WriteReg(LCD_REG_31, 0x90); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
|
||||
LCD_Delay(10);
|
||||
/* 262k/65k color selection */
|
||||
hx8347g_WriteReg(LCD_REG_23, 0x05); /* default 0x06 262k color, 0x05 65k color */
|
||||
/* SET PANEL */
|
||||
hx8347g_WriteReg(LCD_REG_54, 0x09); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
|
||||
|
||||
/* Display On */
|
||||
hx8347g_WriteReg(LCD_REG_40, 0x38);
|
||||
LCD_Delay(60);
|
||||
hx8347g_WriteReg(LCD_REG_40, 0x3C);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables the Display.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_DisplayOff(void)
|
||||
{
|
||||
/* Display Off */
|
||||
hx8347g_WriteReg(LCD_REG_40, 0x38);
|
||||
LCD_Delay(60);
|
||||
hx8347g_WriteReg(LCD_REG_40, 0x04);
|
||||
|
||||
/* Power Off sequence ---------------------------------------------------------*/
|
||||
hx8347g_WriteReg(LCD_REG_23, 0x0000); /* default 0x06 262k color, 0x05 65k color */
|
||||
hx8347g_WriteReg(LCD_REG_24, 0x0000); /* Display frame rate = 70Hz RADJ = '0110' */
|
||||
hx8347g_WriteReg(LCD_REG_25, 0x0000); /* OSC_EN = 1 */
|
||||
hx8347g_WriteReg(LCD_REG_28, 0x0000); /* AP[2:0] = 111 */
|
||||
hx8347g_WriteReg(LCD_REG_31, 0x0000); /* GAS=1, VOMG=00, PON=1, DK=0, XDK=0, DVDH_TRI=0, STB=0*/
|
||||
hx8347g_WriteReg(LCD_REG_54, 0x0000); /* SS_PANEL = 1, GS_PANEL = 0,REV_PANEL = 0, BGR_PANEL = 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the LCD pixel Width.
|
||||
* @param None
|
||||
* @retval The Lcd Pixel Width
|
||||
*/
|
||||
uint16_t hx8347g_GetLcdPixelWidth(void)
|
||||
{
|
||||
return (uint16_t)HX8347G_LCD_PIXEL_WIDTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the LCD pixel Height.
|
||||
* @param None
|
||||
* @retval The Lcd Pixel Height
|
||||
*/
|
||||
uint16_t hx8347g_GetLcdPixelHeight(void)
|
||||
{
|
||||
return (uint16_t)HX8347G_LCD_PIXEL_HEIGHT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the HX8347G ID.
|
||||
* @param None
|
||||
* @retval The HX8347G ID
|
||||
*/
|
||||
uint16_t hx8347g_ReadID(void)
|
||||
{
|
||||
if(Is_hx8347g_Initialized == 0)
|
||||
{
|
||||
LCD_IO_Init();
|
||||
|
||||
/* HX8347G requests 120ms (worst case) after reset */
|
||||
LCD_Delay(120);
|
||||
}
|
||||
return (hx8347g_ReadReg(0x00));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set Cursor position.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_SetCursor(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
hx8347g_WriteReg(LCD_REG_6, 0x00);
|
||||
hx8347g_WriteReg(LCD_REG_7, Xpos);
|
||||
hx8347g_WriteReg(LCD_REG_2, Ypos >> 8);
|
||||
hx8347g_WriteReg(LCD_REG_3, Ypos & 0xFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Write pixel.
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param RGBCode: the RGB pixel color
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode)
|
||||
{
|
||||
/* Set Cursor */
|
||||
hx8347g_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
/* Write 16-bit GRAM Reg */
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&RGBCode, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read pixel.
|
||||
* @param None
|
||||
* @retval the RGB pixel color
|
||||
*/
|
||||
uint16_t hx8347g_ReadPixel(uint16_t Xpos, uint16_t Ypos)
|
||||
{
|
||||
/* Set Cursor */
|
||||
hx8347g_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Dummy read */
|
||||
LCD_IO_ReadData(LCD_REG_34);
|
||||
|
||||
/* Read 16-bit Reg */
|
||||
return (LCD_IO_ReadData(LCD_REG_34));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes to the selected LCD register.
|
||||
* @param LCDReg: address of the selected register.
|
||||
* @param LCDRegValue: value to write to the selected register.
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue)
|
||||
{
|
||||
LCD_IO_WriteReg(LCDReg);
|
||||
|
||||
/* Write 16-bit GRAM Reg */
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&LCDRegValue, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the selected LCD Register.
|
||||
* @param LCDReg: address of the selected register.
|
||||
* @retval LCD Register Value.
|
||||
*/
|
||||
uint16_t hx8347g_ReadReg(uint8_t LCDReg)
|
||||
{
|
||||
/* Write 16-bit Index (then Read Reg) */
|
||||
LCD_IO_WriteReg(LCDReg);
|
||||
|
||||
/* Read 16-bit Reg */
|
||||
return (LCD_IO_ReadData(LCDReg));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets a display window
|
||||
* @param Xpos: specifies the X bottom left position.
|
||||
* @param Ypos: specifies the Y bottom left position.
|
||||
* @param Height: display window height.
|
||||
* @param Width: display window width.
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
|
||||
{
|
||||
/* Horizontal GRAM Start Address */
|
||||
hx8347g_WriteReg(LCD_REG_6, (Xpos) >> 8); /* SP */
|
||||
hx8347g_WriteReg(LCD_REG_7, (Xpos) & 0xFF); /* SP */
|
||||
|
||||
/* Horizontal GRAM End Address */
|
||||
hx8347g_WriteReg(LCD_REG_8, (Xpos + Height - 1) >> 8); /* EP */
|
||||
hx8347g_WriteReg(LCD_REG_9, (Xpos + Height - 1) & 0xFF); /* EP */
|
||||
|
||||
/* Vertical GRAM Start Address */
|
||||
hx8347g_WriteReg(LCD_REG_2, (Ypos) >> 8); /* SC */
|
||||
hx8347g_WriteReg(LCD_REG_3, (Ypos) & 0xFF); /* SC */
|
||||
|
||||
/* Vertical GRAM End Address */
|
||||
hx8347g_WriteReg(LCD_REG_4, (Ypos + Width - 1) >> 8); /* EC */
|
||||
hx8347g_WriteReg(LCD_REG_5, (Ypos + Width - 1) & 0xFF); /* EC */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw vertical line.
|
||||
* @param RGBCode: Specifies the RGB color
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param Length: specifies the Line length.
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
|
||||
/* Set Cursor */
|
||||
hx8347g_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
/* Sent a complete line */
|
||||
for(i = 0; i < Length; i++)
|
||||
{
|
||||
ArrayRGB[i] = RGBCode;
|
||||
}
|
||||
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw vertical line.
|
||||
* @param RGBCode: Specifies the RGB color
|
||||
* @param Xpos: specifies the X position.
|
||||
* @param Ypos: specifies the Y position.
|
||||
* @param Length: specifies the Line length.
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length)
|
||||
{
|
||||
uint16_t counter = 0;
|
||||
|
||||
/* Set Cursor */
|
||||
hx8347g_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
/* Fill a complete vertical line */
|
||||
for(counter = 0; counter < Length; counter++)
|
||||
{
|
||||
ArrayRGB[counter] = RGBCode;
|
||||
}
|
||||
|
||||
/* Write 16-bit GRAM Reg */
|
||||
LCD_IO_WriteMultipleData((uint8_t*)&ArrayRGB[0], Length * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Displays a bitmap picture loaded in the internal Flash.
|
||||
* @param BmpAddress: Bmp picture address in the internal Flash.
|
||||
* @retval None
|
||||
*/
|
||||
void hx8347g_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp)
|
||||
{
|
||||
uint32_t index = 0, size = 0;
|
||||
|
||||
/* Read bitmap size */
|
||||
size = *(volatile uint16_t *) (pbmp + 2);
|
||||
size |= (*(volatile uint16_t *) (pbmp + 4)) << 16;
|
||||
/* Get bitmap data address offset */
|
||||
index = *(volatile uint16_t *) (pbmp + 10);
|
||||
index |= (*(volatile uint16_t *) (pbmp + 12)) << 16;
|
||||
size = (size - index)/2;
|
||||
pbmp += index;
|
||||
|
||||
/* Set GRAM write direction and BGR = 0 */
|
||||
/* Memory access control: MY = 1, MX = 0, MV = 1, ML = 0 */
|
||||
hx8347g_WriteReg(LCD_REG_22, 0xE0);
|
||||
|
||||
/* Set Cursor */
|
||||
hx8347g_SetCursor(Xpos, Ypos);
|
||||
|
||||
/* Prepare to write GRAM */
|
||||
LCD_IO_WriteReg(LCD_REG_34);
|
||||
|
||||
LCD_IO_WriteMultipleData((uint8_t*)pbmp, size*2);
|
||||
|
||||
/* Set GRAM write direction and BGR = 0 */
|
||||
/* Memory access control: MY = 1, MX = 1, MV = 1, ML = 0 */
|
||||
hx8347g_WriteReg(LCD_REG_22, 0xA0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
256
P5_SETR2/Components/hx8347g/hx8347g.h
Normal file
256
P5_SETR2/Components/hx8347g/hx8347g.h
Normal file
@@ -0,0 +1,256 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file hx8347g.h
|
||||
* @author MCD Application Team
|
||||
* @brief This file contains all the functions prototypes for the hx8347g.c
|
||||
* driver.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __HX8347G_H
|
||||
#define __HX8347G_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "../Common/lcd.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup Components
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup hx8347g
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief HX8347G ID
|
||||
*/
|
||||
#define HX8347G_ID 0x0075
|
||||
|
||||
/**
|
||||
* @brief HX8347G Size
|
||||
*/
|
||||
#define HX8347G_LCD_PIXEL_WIDTH ((uint16_t)320)
|
||||
#define HX8347G_LCD_PIXEL_HEIGHT ((uint16_t)240)
|
||||
|
||||
/**
|
||||
* @brief HX8347G Registers
|
||||
*/
|
||||
#define LCD_REG_0 0x00
|
||||
#define LCD_REG_1 0x01
|
||||
#define LCD_REG_2 0x02
|
||||
#define LCD_REG_3 0x03
|
||||
#define LCD_REG_4 0x04
|
||||
#define LCD_REG_5 0x05
|
||||
#define LCD_REG_6 0x06
|
||||
#define LCD_REG_7 0x07
|
||||
#define LCD_REG_8 0x08
|
||||
#define LCD_REG_9 0x09
|
||||
#define LCD_REG_10 0x0A
|
||||
#define LCD_REG_11 0x0B
|
||||
#define LCD_REG_12 0x0C
|
||||
#define LCD_REG_13 0x0D
|
||||
#define LCD_REG_14 0x0E
|
||||
#define LCD_REG_15 0x0F
|
||||
#define LCD_REG_16 0x10
|
||||
#define LCD_REG_17 0x11
|
||||
#define LCD_REG_18 0x12
|
||||
#define LCD_REG_19 0x13
|
||||
#define LCD_REG_20 0x14
|
||||
#define LCD_REG_21 0x15
|
||||
#define LCD_REG_22 0x16
|
||||
#define LCD_REG_23 0x17
|
||||
#define LCD_REG_24 0x18
|
||||
#define LCD_REG_25 0x19
|
||||
#define LCD_REG_26 0x1A
|
||||
#define LCD_REG_27 0x1B
|
||||
#define LCD_REG_28 0x1C
|
||||
#define LCD_REG_29 0x1D
|
||||
#define LCD_REG_30 0x1E
|
||||
#define LCD_REG_31 0x1F
|
||||
#define LCD_REG_32 0x20
|
||||
#define LCD_REG_33 0x21
|
||||
#define LCD_REG_34 0x22
|
||||
#define LCD_REG_35 0x23
|
||||
#define LCD_REG_36 0x24
|
||||
#define LCD_REG_37 0x25
|
||||
#define LCD_REG_38 0x26
|
||||
#define LCD_REG_39 0x27
|
||||
#define LCD_REG_40 0x28
|
||||
#define LCD_REG_41 0x29
|
||||
#define LCD_REG_42 0x2A
|
||||
#define LCD_REG_43 0x2B
|
||||
#define LCD_REG_44 0x2C
|
||||
#define LCD_REG_45 0x2D
|
||||
#define LCD_REG_46 0x2E
|
||||
#define LCD_REG_47 0x2F
|
||||
#define LCD_REG_48 0x30
|
||||
#define LCD_REG_49 0x31
|
||||
#define LCD_REG_50 0x32
|
||||
#define LCD_REG_51 0x33
|
||||
#define LCD_REG_52 0x34
|
||||
#define LCD_REG_53 0x35
|
||||
#define LCD_REG_54 0x36
|
||||
#define LCD_REG_55 0x37
|
||||
#define LCD_REG_56 0x38
|
||||
#define LCD_REG_57 0x39
|
||||
#define LCD_REG_58 0x3A
|
||||
#define LCD_REG_59 0x3B
|
||||
#define LCD_REG_60 0x3C
|
||||
#define LCD_REG_61 0x3D
|
||||
#define LCD_REG_62 0x3E
|
||||
#define LCD_REG_63 0x3F
|
||||
#define LCD_REG_64 0x40
|
||||
#define LCD_REG_65 0x41
|
||||
#define LCD_REG_66 0x42
|
||||
#define LCD_REG_67 0x43
|
||||
#define LCD_REG_68 0x44
|
||||
#define LCD_REG_69 0x45
|
||||
#define LCD_REG_70 0x46
|
||||
#define LCD_REG_71 0x47
|
||||
#define LCD_REG_72 0x48
|
||||
#define LCD_REG_73 0x49
|
||||
#define LCD_REG_74 0x4A
|
||||
#define LCD_REG_75 0x4B
|
||||
#define LCD_REG_76 0x4C
|
||||
#define LCD_REG_77 0x4D
|
||||
#define LCD_REG_78 0x4E
|
||||
#define LCD_REG_79 0x4F
|
||||
#define LCD_REG_80 0x50
|
||||
#define LCD_REG_81 0x51
|
||||
#define LCD_REG_82 0x52
|
||||
#define LCD_REG_83 0x53
|
||||
#define LCD_REG_84 0x54
|
||||
#define LCD_REG_85 0x55
|
||||
#define LCD_REG_86 0x56
|
||||
#define LCD_REG_87 0x57
|
||||
#define LCD_REG_88 0x58
|
||||
#define LCD_REG_89 0x59
|
||||
#define LCD_REG_90 0x5A
|
||||
#define LCD_REG_91 0x5B
|
||||
#define LCD_REG_92 0x5C
|
||||
#define LCD_REG_93 0x5D
|
||||
#define LCD_REG_94 0x5E
|
||||
#define LCD_REG_95 0x5F
|
||||
#define LCD_REG_96 0x60
|
||||
#define LCD_REG_97 0x61
|
||||
#define LCD_REG_98 0x62
|
||||
#define LCD_REG_99 0x63
|
||||
#define LCD_REG_104 0x68
|
||||
#define LCD_REG_105 0x69
|
||||
#define LCD_REG_112 0x70
|
||||
#define LCD_REG_113 0x71
|
||||
#define LCD_REG_132 0x84
|
||||
#define LCD_REG_133 0x85
|
||||
#define LCD_REG_195 0xC3
|
||||
#define LCD_REG_197 0xC5
|
||||
#define LCD_REG_199 0xC7
|
||||
#define LCD_REG_203 0xCB
|
||||
#define LCD_REG_204 0xCC
|
||||
#define LCD_REG_205 0xCD
|
||||
#define LCD_REG_206 0xCE
|
||||
#define LCD_REG_207 0xCF
|
||||
#define LCD_REG_208 0xD0
|
||||
#define LCD_REG_209 0xD1
|
||||
#define LCD_REG_210 0xD2
|
||||
#define LCD_REG_211 0xD3
|
||||
#define LCD_REG_232 0xE8
|
||||
#define LCD_REG_233 0xE9
|
||||
#define LCD_REG_234 0xEA
|
||||
#define LCD_REG_235 0xEB
|
||||
#define LCD_REG_236 0xEC
|
||||
#define LCD_REG_237 0xED
|
||||
#define LCD_REG_241 0xF1
|
||||
#define LCD_REG_242 0xF2
|
||||
#define LCD_REG_255 0xFF
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup HX8347G_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
void hx8347g_Init(void);
|
||||
uint16_t hx8347g_ReadID(void);
|
||||
void hx8347g_WriteReg(uint8_t LCDReg, uint16_t LCDRegValue);
|
||||
uint16_t hx8347g_ReadReg(uint8_t LCDReg);
|
||||
|
||||
void hx8347g_DisplayOn(void);
|
||||
void hx8347g_DisplayOff(void);
|
||||
void hx8347g_SetCursor(uint16_t Xpos, uint16_t Ypos);
|
||||
void hx8347g_WritePixel(uint16_t Xpos, uint16_t Ypos, uint16_t RGBCode);
|
||||
uint16_t hx8347g_ReadPixel(uint16_t Xpos, uint16_t Ypos);
|
||||
|
||||
void hx8347g_DrawHLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void hx8347g_DrawVLine(uint16_t RGBCode, uint16_t Xpos, uint16_t Ypos, uint16_t Length);
|
||||
void hx8347g_DrawBitmap(uint16_t Xpos, uint16_t Ypos, uint8_t *pbmp);
|
||||
|
||||
void hx8347g_SetDisplayWindow(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height);
|
||||
|
||||
|
||||
uint16_t hx8347g_GetLcdPixelWidth(void);
|
||||
uint16_t hx8347g_GetLcdPixelHeight(void);
|
||||
|
||||
/* LCD driver structure */
|
||||
extern LCD_DrvTypeDef hx8347g_drv;
|
||||
|
||||
/* LCD IO functions */
|
||||
void LCD_IO_Init(void);
|
||||
void LCD_IO_WriteMultipleData(uint8_t *pData, uint32_t Size);
|
||||
void LCD_IO_WriteReg(uint8_t Reg);
|
||||
uint16_t LCD_IO_ReadData(uint16_t Reg);
|
||||
void LCD_Delay (uint32_t delay);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __HX8347G_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
Reference in New Issue
Block a user