+/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************\r
+* File Name : lcd.c\r
+* Author : MCD Application Team\r
+* Date First Issued : mm/dd/yyyy\r
+* Description : This file includes the LCD driver for AM-240320LTNQW00H\r
+* liquid Crystal Display Module of STM32F10x-EVAL.\r
+********************************************************************************\r
+* History:\r
+* mm/dd/yyyy\r
+********************************************************************************\r
+* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS\r
+* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.\r
+* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,\r
+* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE\r
+* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING\r
+* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.\r
+*******************************************************************************/\r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "stm32f10x_type.h"\r
+#include "lcd.h"\r
+#include "spi_flash.h"\r
+\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+ /* ASCII Table: each character is 16 column (16dots large)\r
+ and 24 raw (24 dots high) */\r
+ const uc16 ASCII_Table[] =\r
+ {\r
+ /* Space ' ' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '!' */\r
+ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '"' */\r
+ 0x0000, 0x0000, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '#' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C60, 0x0C60,\r
+ 0x0C60, 0x0630, 0x0630, 0x1FFE, 0x1FFE, 0x0630, 0x0738, 0x0318,\r
+ 0x1FFE, 0x1FFE, 0x0318, 0x0318, 0x018C, 0x018C, 0x018C, 0x0000,\r
+ /* '$' */\r
+ 0x0000, 0x0080, 0x03E0, 0x0FF8, 0x0E9C, 0x1C8C, 0x188C, 0x008C,\r
+ 0x0098, 0x01F8, 0x07E0, 0x0E80, 0x1C80, 0x188C, 0x188C, 0x189C,\r
+ 0x0CB8, 0x0FF0, 0x03E0, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000,\r
+ /* '%' */\r
+ 0x0000, 0x0000, 0x0000, 0x180E, 0x0C1B, 0x0C11, 0x0611, 0x0611,\r
+ 0x0311, 0x0311, 0x019B, 0x018E, 0x38C0, 0x6CC0, 0x4460, 0x4460,\r
+ 0x4430, 0x4430, 0x4418, 0x6C18, 0x380C, 0x0000, 0x0000, 0x0000,\r
+ /* '&' */\r
+ 0x0000, 0x01E0, 0x03F0, 0x0738, 0x0618, 0x0618, 0x0330, 0x01F0,\r
+ 0x00F0, 0x00F8, 0x319C, 0x330E, 0x1E06, 0x1C06, 0x1C06, 0x3F06,\r
+ 0x73FC, 0x21F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* ''' */\r
+ 0x0000, 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '(' */\r
+ 0x0000, 0x0200, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x0060, 0x0060,\r
+ 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,\r
+ 0x0060, 0x0060, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0200, 0x0000,\r
+ /* ')' */\r
+ 0x0000, 0x0020, 0x0060, 0x00C0, 0x0180, 0x0180, 0x0300, 0x0300,\r
+ 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600,\r
+ 0x0300, 0x0300, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0020, 0x0000,\r
+ /* '*' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0,\r
+ 0x06D8, 0x07F8, 0x01E0, 0x0330, 0x0738, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '+' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x3FFC, 0x3FFC, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* ',' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000,\r
+ /* '-' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x07E0, 0x07E0, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '.' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '/' */\r
+ 0x0000, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300,\r
+ 0x0300, 0x0380, 0x0180, 0x0180, 0x0180, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x0060, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '0' */\r
+ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x180C, 0x180C, 0x180C,\r
+ 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0E38,\r
+ 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '1' */\r
+ 0x0000, 0x0100, 0x0180, 0x01C0, 0x01F0, 0x0198, 0x0188, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '2' */\r
+ 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x1800,\r
+ 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018,\r
+ 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '3' */\r
+ 0x0000, 0x01E0, 0x07F8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C00, 0x0600,\r
+ 0x03C0, 0x07C0, 0x0C00, 0x1800, 0x1800, 0x180C, 0x180C, 0x0C18,\r
+ 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '4' */\r
+ 0x0000, 0x0C00, 0x0E00, 0x0F00, 0x0F00, 0x0D80, 0x0CC0, 0x0C60,\r
+ 0x0C60, 0x0C30, 0x0C18, 0x0C0C, 0x3FFC, 0x3FFC, 0x0C00, 0x0C00,\r
+ 0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '5' */\r
+ 0x0000, 0x0FF8, 0x0FF8, 0x0018, 0x0018, 0x000C, 0x03EC, 0x07FC,\r
+ 0x0E1C, 0x1C00, 0x1800, 0x1800, 0x1800, 0x180C, 0x0C1C, 0x0E18,\r
+ 0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '6' */\r
+ 0x0000, 0x07C0, 0x0FF0, 0x1C38, 0x1818, 0x0018, 0x000C, 0x03CC,\r
+ 0x0FEC, 0x0E3C, 0x1C1C, 0x180C, 0x180C, 0x180C, 0x1C18, 0x0E38,\r
+ 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '7' */\r
+ 0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0600, 0x0300, 0x0380,\r
+ 0x0180, 0x01C0, 0x00C0, 0x00E0, 0x0060, 0x0060, 0x0070, 0x0030,\r
+ 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '8' */\r
+ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x0C18, 0x0C18, 0x0638,\r
+ 0x07F0, 0x07F0, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C38,\r
+ 0x0FF8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '9' */\r
+ 0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C1C, 0x180C, 0x180C, 0x180C,\r
+ 0x1C1C, 0x1E38, 0x1BF8, 0x19E0, 0x1800, 0x0C00, 0x0C00, 0x0E1C,\r
+ 0x07F8, 0x01F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* ':' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* ';' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000,\r
+ /* '<' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x1000, 0x1C00, 0x0F80, 0x03E0, 0x00F8, 0x0018, 0x00F8, 0x03E0,\r
+ 0x0F80, 0x1C00, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '=' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x1FF8, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '>' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0008, 0x0038, 0x01F0, 0x07C0, 0x1F00, 0x1800, 0x1F00, 0x07C0,\r
+ 0x01F0, 0x0038, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '?' */\r
+ 0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x0C00,\r
+ 0x0600, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000,\r
+ 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '@' */\r
+ 0x0000, 0x0000, 0x07E0, 0x1818, 0x2004, 0x29C2, 0x4A22, 0x4411,\r
+ 0x4409, 0x4409, 0x4409, 0x2209, 0x1311, 0x0CE2, 0x4002, 0x2004,\r
+ 0x1818, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'A' */\r
+ 0x0000, 0x0380, 0x0380, 0x06C0, 0x06C0, 0x06C0, 0x0C60, 0x0C60,\r
+ 0x1830, 0x1830, 0x1830, 0x3FF8, 0x3FF8, 0x701C, 0x600C, 0x600C,\r
+ 0xC006, 0xC006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'B' */\r
+ 0x0000, 0x03FC, 0x0FFC, 0x0C0C, 0x180C, 0x180C, 0x180C, 0x0C0C,\r
+ 0x07FC, 0x0FFC, 0x180C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C,\r
+ 0x1FFC, 0x07FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'C' */\r
+ 0x0000, 0x07C0, 0x1FF0, 0x3838, 0x301C, 0x700C, 0x6006, 0x0006,\r
+ 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x6006, 0x700C, 0x301C,\r
+ 0x1FF0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'D' */\r
+ 0x0000, 0x03FE, 0x0FFE, 0x0E06, 0x1806, 0x1806, 0x3006, 0x3006,\r
+ 0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x1806, 0x1806, 0x0E06,\r
+ 0x0FFE, 0x03FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'E' */\r
+ 0x0000, 0x3FFC, 0x3FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,\r
+ 0x1FFC, 0x1FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,\r
+ 0x3FFC, 0x3FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'F' */\r
+ 0x0000, 0x3FF8, 0x3FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,\r
+ 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,\r
+ 0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'G' */\r
+ 0x0000, 0x0FE0, 0x3FF8, 0x783C, 0x600E, 0xE006, 0xC007, 0x0003,\r
+ 0x0003, 0xFE03, 0xFE03, 0xC003, 0xC007, 0xC006, 0xC00E, 0xF03C,\r
+ 0x3FF8, 0x0FE0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'H' */\r
+ 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C,\r
+ 0x3FFC, 0x3FFC, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C,\r
+ 0x300C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'I' */\r
+ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'J' */\r
+ 0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600,\r
+ 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0618, 0x0618, 0x0738,\r
+ 0x03F0, 0x01E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'K' */\r
+ 0x0000, 0x3006, 0x1806, 0x0C06, 0x0606, 0x0306, 0x0186, 0x00C6,\r
+ 0x0066, 0x0076, 0x00DE, 0x018E, 0x0306, 0x0606, 0x0C06, 0x1806,\r
+ 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'L' */\r
+ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,\r
+ 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,\r
+ 0x1FF8, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'M' */\r
+ 0x0000, 0xE00E, 0xF01E, 0xF01E, 0xF01E, 0xD836, 0xD836, 0xD836,\r
+ 0xD836, 0xCC66, 0xCC66, 0xCC66, 0xC6C6, 0xC6C6, 0xC6C6, 0xC6C6,\r
+ 0xC386, 0xC386, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'N' */\r
+ 0x0000, 0x300C, 0x301C, 0x303C, 0x303C, 0x306C, 0x306C, 0x30CC,\r
+ 0x30CC, 0x318C, 0x330C, 0x330C, 0x360C, 0x360C, 0x3C0C, 0x3C0C,\r
+ 0x380C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'O' */\r
+ 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xC003, 0xC003,\r
+ 0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0x6006, 0x700E, 0x381C,\r
+ 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'P' */\r
+ 0x0000, 0x0FFC, 0x1FFC, 0x380C, 0x300C, 0x300C, 0x300C, 0x300C,\r
+ 0x180C, 0x1FFC, 0x07FC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,\r
+ 0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'Q' */\r
+ 0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xE003, 0xC003,\r
+ 0xC003, 0xC003, 0xC003, 0xC003, 0xE007, 0x6306, 0x3F0E, 0x3C1C,\r
+ 0x3FF8, 0xF7E0, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'R' */\r
+ 0x0000, 0x0FFE, 0x1FFE, 0x3806, 0x3006, 0x3006, 0x3006, 0x3806,\r
+ 0x1FFE, 0x07FE, 0x0306, 0x0606, 0x0C06, 0x1806, 0x1806, 0x3006,\r
+ 0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'S' */\r
+ 0x0000, 0x03E0, 0x0FF8, 0x0C1C, 0x180C, 0x180C, 0x000C, 0x001C,\r
+ 0x03F8, 0x0FE0, 0x1E00, 0x3800, 0x3006, 0x3006, 0x300E, 0x1C1C,\r
+ 0x0FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'T' */\r
+ 0x0000, 0x7FFE, 0x7FFE, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'U' */\r
+ 0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C,\r
+ 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x1818,\r
+ 0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'V' */\r
+ 0x0000, 0x6003, 0x3006, 0x3006, 0x3006, 0x180C, 0x180C, 0x180C,\r
+ 0x0C18, 0x0C18, 0x0E38, 0x0630, 0x0630, 0x0770, 0x0360, 0x0360,\r
+ 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'W' */\r
+ 0x0000, 0x6003, 0x61C3, 0x61C3, 0x61C3, 0x3366, 0x3366, 0x3366,\r
+ 0x3366, 0x3366, 0x3366, 0x1B6C, 0x1B6C, 0x1B6C, 0x1A2C, 0x1E3C,\r
+ 0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'X' */\r
+ 0x0000, 0xE00F, 0x700C, 0x3018, 0x1830, 0x0C70, 0x0E60, 0x07C0,\r
+ 0x0380, 0x0380, 0x03C0, 0x06E0, 0x0C70, 0x1C30, 0x1818, 0x300C,\r
+ 0x600E, 0xE007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'Y' */\r
+ 0x0000, 0xC003, 0x6006, 0x300C, 0x381C, 0x1838, 0x0C30, 0x0660,\r
+ 0x07E0, 0x03C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'Z' */\r
+ 0x0000, 0x7FFC, 0x7FFC, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600,\r
+ 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006,\r
+ 0x7FFE, 0x7FFE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '[' */\r
+ 0x0000, 0x03E0, 0x03E0, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060,\r
+ 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060,\r
+ 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x03E0, 0x03E0, 0x0000,\r
+ /* '\' */\r
+ 0x0000, 0x0030, 0x0030, 0x0060, 0x0060, 0x0060, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0300,\r
+ 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* ']' */\r
+ 0x0000, 0x03E0, 0x03E0, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300,\r
+ 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300,\r
+ 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x03E0, 0x03E0, 0x0000,\r
+ /* '^' */\r
+ 0x0000, 0x0000, 0x01C0, 0x01C0, 0x0360, 0x0360, 0x0360, 0x0630,\r
+ 0x0630, 0x0C18, 0x0C18, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '_' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* ''' */\r
+ 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'a' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03F0, 0x07F8,\r
+ 0x0C1C, 0x0C0C, 0x0F00, 0x0FF0, 0x0CF8, 0x0C0C, 0x0C0C, 0x0F1C,\r
+ 0x0FF8, 0x18F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'b' */\r
+ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x03D8, 0x0FF8,\r
+ 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38,\r
+ 0x0FF8, 0x03D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'c' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x07F0,\r
+ 0x0E30, 0x0C18, 0x0018, 0x0018, 0x0018, 0x0018, 0x0C18, 0x0E30,\r
+ 0x07F0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'd' */\r
+ 0x0000, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1BC0, 0x1FF0,\r
+ 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30,\r
+ 0x1FF0, 0x1BC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'e' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0,\r
+ 0x0C30, 0x1818, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x1838, 0x1C30,\r
+ 0x0FF0, 0x07C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'f' */\r
+ 0x0000, 0x0F80, 0x0FC0, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'g' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0DE0, 0x0FF8,\r
+ 0x0E18, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0E18,\r
+ 0x0FF8, 0x0DE0, 0x0C00, 0x0C0C, 0x061C, 0x07F8, 0x01F0, 0x0000,\r
+ /* 'h' */\r
+ 0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x07D8, 0x0FF8,\r
+ 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818,\r
+ 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'i' */\r
+ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'j' */\r
+ 0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00F8, 0x0078, 0x0000,\r
+ /* 'k' */\r
+ 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0C0C, 0x060C,\r
+ 0x030C, 0x018C, 0x00CC, 0x006C, 0x00FC, 0x019C, 0x038C, 0x030C,\r
+ 0x060C, 0x0C0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'l' */\r
+ 0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'm' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3C7C, 0x7EFF,\r
+ 0xE3C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183,\r
+ 0xC183, 0xC183, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'n' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0798, 0x0FF8,\r
+ 0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818,\r
+ 0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'o' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0,\r
+ 0x0C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C30,\r
+ 0x0FF0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'p' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03D8, 0x0FF8,\r
+ 0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38,\r
+ 0x0FF8, 0x03D8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000,\r
+ /* 'q' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1BC0, 0x1FF0,\r
+ 0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30,\r
+ 0x1FF0, 0x1BC0, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x0000,\r
+ /* 'r' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07B0, 0x03F0,\r
+ 0x0070, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,\r
+ 0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 's' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03E0, 0x03F0,\r
+ 0x0E38, 0x0C18, 0x0038, 0x03F0, 0x07C0, 0x0C00, 0x0C18, 0x0E38,\r
+ 0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 't' */\r
+ 0x0000, 0x0000, 0x0080, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x07C0, 0x0780, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'u' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818,\r
+ 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C38,\r
+ 0x1FF0, 0x19E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'v' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x180C, 0x0C18,\r
+ 0x0C18, 0x0C18, 0x0630, 0x0630, 0x0630, 0x0360, 0x0360, 0x0360,\r
+ 0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'w' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41C1, 0x41C1,\r
+ 0x61C3, 0x6363, 0x6363, 0x6363, 0x3636, 0x3636, 0x3636, 0x1C1C,\r
+ 0x1C1C, 0x1C1C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'x' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x381C, 0x1C38,\r
+ 0x0C30, 0x0660, 0x0360, 0x0360, 0x0360, 0x0360, 0x0660, 0x0C30,\r
+ 0x1C38, 0x381C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* 'y' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3018, 0x1830,\r
+ 0x1830, 0x1870, 0x0C60, 0x0C60, 0x0CE0, 0x06C0, 0x06C0, 0x0380,\r
+ 0x0380, 0x0380, 0x0180, 0x0180, 0x01C0, 0x00F0, 0x0070, 0x0000,\r
+ /* 'z' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FFC, 0x1FFC,\r
+ 0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018,\r
+ 0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ /* '{' */\r
+ 0x0000, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x0060, 0x0060, 0x0030, 0x0060, 0x0040, 0x00C0, 0x00C0,\r
+ 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0000, 0x0000,\r
+ /* '|' */\r
+ 0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000,\r
+ /* '}' */\r
+ 0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180,\r
+ 0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180,\r
+ 0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000,\r
+ /* '~' */\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x10F0, 0x1FF8, 0x0F08, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,\r
+ };\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+ /* Global variables to set the written text color */\r
+static vu16 TextColor = 0x0000, BackColor = 0xFFFF;\r
+\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+static u32 StrLength(u8 *Str);\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Init\r
+* Description : Initializes LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Init(void)\r
+{\r
+/* Configure the LCD Control pins --------------------------------------------*/\r
+ LCD_CtrlLinesConfig();\r
+\r
+/* Configure the SPI2 interface ----------------------------------------------*/\r
+ LCD_SPIConfig();\r
+\r
+/* Enable the LCD Oscillator -------------------------------------------------*/\r
+ LCD_WriteReg(R1, 0x10);\r
+ LCD_WriteReg(R0, 0xA0);\r
+ LCD_WriteReg(R3, 0x01);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+ LCD_WriteReg(R3, 0x00);\r
+ LCD_WriteReg(R43, 0x04);\r
+\r
+ LCD_WriteReg(R40, 0x18);\r
+ LCD_WriteReg(R26, 0x05);\r
+ LCD_WriteReg(R37, 0x05);\r
+ LCD_WriteReg(R25, 0x00);\r
+\r
+/* LCD Power On --------------------------------------------------------------*/\r
+ LCD_WriteReg(R28, 0x73);\r
+ LCD_WriteReg(R36, 0x74);\r
+ LCD_WriteReg(R30, 0x01);\r
+ LCD_WriteReg(R24, 0xC1);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+ LCD_WriteReg(R24, 0xE1);\r
+ LCD_WriteReg(R24, 0xF1);\r
+ vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */\r
+ LCD_WriteReg(R24, 0xF5);\r
+ vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */\r
+ LCD_WriteReg(R27, 0x09);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+ LCD_WriteReg(R31, 0x11);\r
+ LCD_WriteReg(R32, 0x0E);\r
+ LCD_WriteReg(R30, 0x81);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+\r
+/* Chip Set ------------------------------------------------------------------*/\r
+ LCD_WriteReg(R157, 0x00);\r
+ LCD_WriteReg(R192, 0x00);\r
+\r
+ LCD_WriteReg(R14, 0x00);\r
+ LCD_WriteReg(R15, 0x00);\r
+ LCD_WriteReg(R16, 0x00);\r
+ LCD_WriteReg(R17, 0x00);\r
+ LCD_WriteReg(R18, 0x00);\r
+ LCD_WriteReg(R19, 0x00);\r
+ LCD_WriteReg(R20, 0x00);\r
+ LCD_WriteReg(R21, 0x00);\r
+ LCD_WriteReg(R22, 0x00);\r
+ LCD_WriteReg(R23, 0x00);\r
+\r
+ LCD_WriteReg(R52, 0x01);\r
+ LCD_WriteReg(R53, 0x00);\r
+\r
+ LCD_WriteReg(R75, 0x00);\r
+ LCD_WriteReg(R76, 0x00);\r
+ LCD_WriteReg(R78, 0x00);\r
+ LCD_WriteReg(R79, 0x00);\r
+ LCD_WriteReg(R80, 0x00);\r
+\r
+ LCD_WriteReg(R60, 0x00);\r
+ LCD_WriteReg(R61, 0x00);\r
+ LCD_WriteReg(R62, 0x01);\r
+ LCD_WriteReg(R63, 0x3F);\r
+ LCD_WriteReg(R64, 0x02);\r
+ LCD_WriteReg(R65, 0x02);\r
+ LCD_WriteReg(R66, 0x00);\r
+ LCD_WriteReg(R67, 0x00);\r
+ LCD_WriteReg(R68, 0x00);\r
+ LCD_WriteReg(R69, 0x00);\r
+ LCD_WriteReg(R70, 0xEF);\r
+ LCD_WriteReg(R71, 0x00);\r
+ LCD_WriteReg(R72, 0x00);\r
+ LCD_WriteReg(R73, 0x01);\r
+ LCD_WriteReg(R74, 0x3F);\r
+\r
+ LCD_WriteReg(R29, 0x08); /* R29:Gate scan direction setting */\r
+\r
+ LCD_WriteReg(R134, 0x00);\r
+ LCD_WriteReg(R135, 0x30);\r
+ LCD_WriteReg(R136, 0x02);\r
+ LCD_WriteReg(R137, 0x05);\r
+\r
+ LCD_WriteReg(R141, 0x01); /* R141:Register set-up mode for one line clock */\r
+ LCD_WriteReg(R139, 0x20); /* R139:One line SYSCLK number in one-line */\r
+ LCD_WriteReg(R51, 0x01); /* R51:N line inversion setting */\r
+ LCD_WriteReg(R55, 0x01); /* R55:Scanning method setting */\r
+ LCD_WriteReg(R118, 0x00);\r
+\r
+/* Gamma Set -----------------------------------------------------------------*/\r
+ LCD_WriteReg(R143, 0x10);\r
+ LCD_WriteReg(R144, 0x67);\r
+ LCD_WriteReg(R145, 0x07);\r
+ LCD_WriteReg(R146, 0x65);\r
+ LCD_WriteReg(R147, 0x07);\r
+ LCD_WriteReg(R148, 0x01);\r
+ LCD_WriteReg(R149, 0x76);\r
+ LCD_WriteReg(R150, 0x56);\r
+ LCD_WriteReg(R151, 0x00);\r
+ LCD_WriteReg(R152, 0x06);\r
+ LCD_WriteReg(R153, 0x03);\r
+ LCD_WriteReg(R154, 0x00);\r
+\r
+/* Display On ----------------------------------------------------------------*/\r
+ LCD_WriteReg(R1, 0x50);\r
+ LCD_WriteReg(R5, 0x04);\r
+\r
+ LCD_WriteReg(R0, 0x80);\r
+ LCD_WriteReg(R59, 0x01);\r
+ vTaskDelay( 40 / portTICK_RATE_MS ); /* Delay 40 ms */\r
+ LCD_WriteReg(R0, 0x20);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetTextColor\r
+* Description : Sets the Text color.\r
+* Input : - Color: specifies the Text color code RGB(5-6-5).\r
+* Output : - TextColor: Text color global variable used by LCD_DrawChar\r
+* and LCD_DrawPicture functions.\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetTextColor(vu16 Color)\r
+{\r
+ TextColor = Color;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetBackColor\r
+* Description : Sets the Background color.\r
+* Input : - Color: specifies the Background color code RGB(5-6-5).\r
+* Output : - BackColor: Background color global variable used by\r
+* LCD_DrawChar and LCD_DrawPicture functions.\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetBackColor(vu16 Color)\r
+{\r
+ BackColor = Color;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ClearLine\r
+* Description : Clears the selected line.\r
+* Input : - Line: the Line to be cleared.\r
+* This parameter can be one of the following values:\r
+* - Linex: where x can be 0..9\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearLine(u8 Line)\r
+{\r
+ LCD_DisplayStringLine(Line, " ");\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Clear\r
+* Description : Clears the hole LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Clear(void)\r
+{\r
+ u32 index = 0;\r
+\r
+ LCD_SetCursor(0x00, 0x013F);\r
+\r
+ for(index = 0; index < 0x12C00; index++)\r
+ {\r
+ LCD_WriteRAM(White);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetCursor\r
+* Description : Sets the cursor position.\r
+* Input : - Xpos: specifies the X position.\r
+* - Ypos: specifies the Y position.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetCursor(u8 Xpos, u16 Ypos)\r
+{\r
+ LCD_WriteReg(R66, Xpos);\r
+ LCD_WriteReg(R67, ((Ypos & 0x100)>> 8));\r
+ LCD_WriteReg(R68, (Ypos & 0xFF));\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawChar\r
+* Description : Draws a character on LCD.\r
+* Input : - Xpos: the Line where to display the character shape.\r
+* This parameter can be one of the following values:\r
+* - Linex: where x can be 0..9\r
+* - Ypos: start column address.\r
+* - c: pointer to the character data.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawChar(u8 Xpos, u16 Ypos, uc16 *c)\r
+{\r
+ u32 index = 0, i = 0;\r
+ u8 Xaddress = 0;\r
+\r
+ Xaddress = Xpos;\r
+\r
+ LCD_SetCursor(Xaddress, Ypos);\r
+\r
+ for(index = 0; index < 24; index++)\r
+ {\r
+ for(i = 0; i < 16; i++)\r
+ {\r
+ if((c[index] & (1 << i)) == 0x00)\r
+ {\r
+ LCD_WriteRAM(BackColor);\r
+ }\r
+ else\r
+ {\r
+ LCD_WriteRAM(TextColor);\r
+ }\r
+ }\r
+ Xaddress++;\r
+ LCD_SetCursor(Xaddress, Ypos);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayChar\r
+* Description : Displays one character (16dots width, 24dots height).\r
+* Input : - Line: the Line where to display the character shape .\r
+* This parameter can be one of the following values:\r
+* - Linex: where x can be 0..9\r
+* - Column: start column address.\r
+* - Ascii: character ascii code, must be between 0x20 and 0x7E.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayChar(u8 Line, u16 Column, u8 Ascii)\r
+{\r
+ Ascii -= 32;\r
+ LCD_DrawChar(Line, Column, &ASCII_Table[Ascii * 24]);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayStringLine\r
+* Description : Displays a maximum of 20 char on the LCD.\r
+* Input : - Line: the Line where to display the character shape .\r
+* This parameter can be one of the following values:\r
+* - Linex: where x can be 0..9\r
+* - *ptr: pointer to string to display on LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayStringLine(u8 Line, u8 *ptr)\r
+{\r
+ u32 i = 0;\r
+ u16 refcolumn = 319;\r
+\r
+ /* Send the string character by character on lCD */\r
+ while ((*ptr != 0) & (i < 20))\r
+ {\r
+ /* Display one character on LCD */\r
+ LCD_DisplayChar(Line, refcolumn, *ptr);\r
+ /* Decrement the column position by 16 */\r
+ refcolumn -= 16;\r
+ /* Point on the next character */\r
+ ptr++;\r
+ /* Increment the character counter */\r
+ i++;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayString\r
+* Description : Displays a maximum of 200 char on the LCD.\r
+* Input : - Line: the starting Line where to display the character shape.\r
+* This parameter can be one of the following values:\r
+* - Linex: where x can be 0..9\r
+* - *ptr: pointer to string to display on LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayString(u8 Line, u8 *ptr)\r
+{\r
+ u32 i = 0, column = 0, index = 0, spaceindex = 0;\r
+ u16 refcolumn = 319;\r
+ u32 length = 0;\r
+\r
+ /* Get the string length */\r
+ length = StrLength(ptr);\r
+ if(length > 200)\r
+ {\r
+ /* Set the Cursor position */\r
+ LCD_SetCursor(Line, 0x013F);\r
+ /* Clear the Selected Line */\r
+ LCD_ClearLine(Line);\r
+ LCD_DisplayStringLine(Line, " String too long ");\r
+ }\r
+ else\r
+ {\r
+ /* Set the Cursor position */\r
+ LCD_SetCursor(Line, 0x013F);\r
+ /* Clear the Selected Line */\r
+ LCD_ClearLine(Line);\r
+\r
+ while(length--)\r
+ {\r
+ if(index == 20)\r
+ {\r
+ if(*ptr == 0x20)\r
+ {\r
+ ptr++;\r
+ }\r
+ else\r
+ {\r
+ for(i = 0; i < spaceindex; i++)\r
+ {\r
+ LCD_DisplayChar(Line, column, ' ');\r
+ column -= 16;\r
+ }\r
+ ptr -= (spaceindex - 1);\r
+ length += (spaceindex - 1);\r
+ }\r
+ Line += 24;\r
+ /* Clear the Selected Line */\r
+ LCD_ClearLine(Line);\r
+ refcolumn = 319;\r
+ index = 0;\r
+ }\r
+ /* Display one character on LCD */\r
+ LCD_DisplayChar(Line, refcolumn, *ptr);\r
+\r
+ /* Increment character number in one line */\r
+ index++;\r
+\r
+ /* Decrement the column position by 16 */\r
+ refcolumn -= 16;\r
+ /* Point on the next character */\r
+ ptr++;\r
+ /* Increment the number of character after the last space */\r
+ spaceindex++;\r
+ if(*ptr == 0x20)\r
+ {\r
+ spaceindex = 0;\r
+ column = refcolumn - 16;\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ScrollText\r
+* Description :\r
+* Input :\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ScrollText(u8 Line, u8 *ptr)\r
+{\r
+ u32 i = 0, length = 0, x = 0;\r
+ u16 refcolumn = 319;\r
+\r
+ /* Get the string length */\r
+ length = StrLength(ptr);\r
+\r
+ while(1)\r
+ {\r
+ /* Send the string character by character on lCD */\r
+ while ((*ptr != 0) & (i < 20))\r
+ {\r
+ /* Display one character on LCD */\r
+ LCD_DisplayChar(Line, refcolumn, *ptr);\r
+ /* Decrement the column position by 16 */\r
+ refcolumn -= 16;\r
+ /* Point on the next character */\r
+ ptr++;\r
+ /* Increment the character counter */\r
+ i++;\r
+ }\r
+ vTaskDelay( 100 / portTICK_RATE_MS );\r
+ i = 0;\r
+ //LCD_ClearLine(Line);\r
+ ptr -= length;\r
+ x++;\r
+ if(refcolumn < 16)\r
+ {\r
+ x = 0;\r
+ }\r
+ refcolumn = 319 - (x * 16);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetDisplayWindow\r
+* Description : Sets a display window\r
+* Input : - Xpos: specifies the X position.\r
+* - Ypos: specifies the Y position.\r
+* - Height: display window height.\r
+* - Width: display window width.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetDisplayWindow(u8 Xpos, u16 Ypos, u8 Height, u16 Width)\r
+{\r
+ LCD_WriteReg(R1, 0xD0);\r
+ LCD_WriteReg(R5, 0x14);\r
+\r
+ LCD_WriteReg(R69, Xpos);\r
+ LCD_WriteReg(R70, (Xpos + Height + 1));\r
+\r
+ LCD_WriteReg(R71, ((Ypos & 0x100)>> 8));\r
+ LCD_WriteReg(R72, (Ypos & 0xFF));\r
+\r
+ LCD_WriteReg(R73, (((Ypos + Width + 1) & 0x100)>> 8));\r
+ LCD_WriteReg(R74, ((Ypos + Width + 1) & 0xFF));\r
+\r
+ LCD_SetCursor(Xpos, Ypos);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawLine\r
+* Description : Displays a line.\r
+* Input : - Xpos: specifies the X position.\r
+* - Ypos: specifies the Y position.\r
+* - Length: line length.\r
+* - Direction: line direction.\r
+* This parameter can be one of the following values: Vertical\r
+* or Horizontal.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawLine(u8 Xpos, u16 Ypos, u16 Length, u8 Direction)\r
+{\r
+ u32 i = 0;\r
+\r
+ LCD_SetCursor(Xpos, Ypos);\r
+\r
+ if(Direction == Horizontal)\r
+ {\r
+ for(i = 0; i < Length; i++)\r
+ {\r
+ LCD_WriteRAM(TextColor);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ for(i = 0; i < Length; i++)\r
+ {\r
+\r
+ LCD_WriteRAM(TextColor);\r
+ Xpos++;\r
+ LCD_SetCursor(Xpos, Ypos);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawRect\r
+* Description : Displays a rectangle.\r
+* Input : - Xpos: specifies the X position.\r
+* - Ypos: specifies the Y position.\r
+* - Height: display rectangle height.\r
+* - Width: display rectangle width.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawRect(u8 Xpos, u16 Ypos, u8 Height, u16 Width)\r
+{\r
+ LCD_DrawLine(Xpos, Ypos, Width, Horizontal);\r
+ LCD_DrawLine((Xpos + Height), Ypos, Width, Horizontal);\r
+\r
+ LCD_DrawLine(Xpos, Ypos, Height, Vertical);\r
+ LCD_DrawLine(Xpos, (Ypos - Width + 1), Height, Vertical);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawCircle\r
+* Description : Displays a circle.\r
+* Input : - Xpos: specifies the X position.\r
+* - Ypos: specifies the Y position.\r
+* - Height: display rectangle height.\r
+* - Width: display rectangle width.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawCircle(u8 Xpos, u16 Ypos, u16 Radius)\r
+{\r
+ s32 D; /* Decision Variable */\r
+ u32 CurX; /* Current X Value */\r
+ u32 CurY; /* Current Y Value */\r
+\r
+ D = 3 - (Radius << 1);\r
+ CurX = 0;\r
+ CurY = Radius;\r
+\r
+ while (CurX <= CurY)\r
+ {\r
+ LCD_SetCursor(Xpos + CurX, Ypos + CurY);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos + CurX, Ypos - CurY);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos - CurX, Ypos + CurY);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos - CurX, Ypos - CurY);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos + CurY, Ypos + CurX);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos + CurY, Ypos - CurX);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos - CurY, Ypos + CurX);\r
+ LCD_WriteRAM(TextColor);\r
+ LCD_SetCursor(Xpos - CurY, Ypos - CurX);\r
+ LCD_WriteRAM(TextColor);\r
+\r
+ if (D < 0)\r
+ {\r
+ D += (CurX << 2) + 6;\r
+ }\r
+ else\r
+ {\r
+ D += ((CurX - CurY) << 2) + 10;\r
+ CurY--;\r
+ }\r
+ CurX++;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawMonoPict\r
+* Description : Displays a monocolor picture.\r
+* Input : - Pict: pointer to the picture array.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawMonoPict(uc32 *Pict)\r
+{\r
+ u32 index = 0, i = 0;\r
+\r
+ LCD_SetCursor(0, 319);\r
+\r
+ for(index = 0; index < 2400; index++)\r
+ {\r
+ for(i = 0; i < 32; i++)\r
+ {\r
+ if((Pict[index] & (1 << i)) == 0x00)\r
+ {\r
+ LCD_WriteRAM(BackColor);\r
+ }\r
+ else\r
+ {\r
+ LCD_WriteRAM(TextColor);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawBMP\r
+* Description : Displays a bitmap picture loaded in the SPI Flash.\r
+* Input : - BmpAddress: Bmp picture address in the SPI Flash.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawBMP(u32 BmpAddress)\r
+{\r
+ u32 i = 0;\r
+\r
+ LCD_WriteReg(R1, 0xD0);\r
+ LCD_WriteReg(R5, 0x04);\r
+\r
+ LCD_SetCursor(239, 0x013F);\r
+\r
+ SPI_FLASH_StartReadSequence(BmpAddress);\r
+\r
+ /* Disable SPI1 */\r
+ SPI_Cmd(SPI1, DISABLE);\r
+ /* SPI in 16-bit mode */\r
+ SPI_DataSizeConfig(SPI1, SPI_DataSize_16b);\r
+ /* Enable SPI1 */\r
+ SPI_Cmd(SPI1, ENABLE);\r
+\r
+ for(i = 0; i < 76800; i++)\r
+ {\r
+ LCD_WriteRAM(__REV_HalfWord(SPI_FLASH_SendHalfWord(0xA5A5)));\r
+ }\r
+\r
+ /* Deselect the FLASH: Chip Select high */\r
+ SPI_FLASH_ChipSelect(1);\r
+\r
+ /* Disable SPI1 */\r
+ SPI_Cmd(SPI1, DISABLE);\r
+ /* SPI in 8-bit mode */\r
+ SPI_DataSizeConfig(SPI1, SPI_DataSize_8b);\r
+ /* Enable SPI1 */\r
+ SPI_Cmd(SPI1, ENABLE);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_WriteReg\r
+* Description : Writes to the selected LCD register.\r
+* Input : - LCD_Reg: address of the selected register.\r
+* - LCD_RegValue: value to write to the selected register.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_WriteReg(u8 LCD_Reg, u8 LCD_RegValue)\r
+{\r
+ u16 tmp = 0;\r
+\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_RESET);\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_RESET);\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET);\r
+\r
+ tmp = LCD_Reg << 8;\r
+ tmp |= LCD_RegValue;\r
+\r
+ SPI_SendData(SPI2, tmp);\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET)\r
+ {\r
+ }\r
+\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ReadReg\r
+* Description : Reads the selected LCD Register.\r
+* Input : None\r
+* Output : None\r
+* Return : LCD Register Value.\r
+*******************************************************************************/\r
+u8 LCD_ReadReg(u8 LCD_Reg)\r
+{\r
+ u16 tmp = 0;\r
+\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_RESET);\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_RESET);\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET);\r
+\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET)\r
+ {\r
+ }\r
+ SPI_SendData(SPI2, LCD_Reg);\r
+\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_SET);\r
+\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET)\r
+ {\r
+ }\r
+ SPI_SendData(SPI2, 0xFF);\r
+\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_RXNE)== RESET)\r
+ {\r
+ }\r
+ tmp = SPI_ReceiveData(SPI2);\r
+\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);\r
+ return tmp;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_WriteRAM\r
+* Description : Writes to the LCD RAM.\r
+* Input : - RGB_Code: the pixel color in RGB mode (5-6-5).\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_WriteRAM(u16 RGB_Code)\r
+{\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_RESET);\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_SET);\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET);\r
+\r
+ SPI_SendData(SPI2, RGB_Code);\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET)\r
+ {\r
+ }\r
+\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ReadRAM\r
+* Description : Reads the LCD RAM.\r
+* Input : None\r
+* Output : None\r
+* Return : LCD RAM Value.\r
+*******************************************************************************/\r
+u16 LCD_ReadRAM(void)\r
+{\r
+ u16 tmp = 0;\r
+\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_NWR, Bit_SET);\r
+ LCD_CtrlLinesWrite(GPIOD, CtrlPin_RS, Bit_SET);\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_RESET);\r
+\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_TXE) == RESET)\r
+ {\r
+ }\r
+ SPI_SendData(SPI2, 0xFF);\r
+ while(SPI_GetFlagStatus(SPI2, SPI_FLAG_RXNE)==RESET)\r
+ {\r
+ }\r
+ tmp = SPI_ReceiveData(SPI2);\r
+\r
+ LCD_CtrlLinesWrite(GPIOB, CtrlPin_NCS, Bit_SET);\r
+\r
+ return tmp;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_PowerOn\r
+* Description :\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_PowerOn(void)\r
+{\r
+ /* Power On Set */\r
+ LCD_WriteReg(R28, 0x73);\r
+ LCD_WriteReg(R36, 0x74);\r
+ LCD_WriteReg(R30, 0x01);\r
+ LCD_WriteReg(R24, 0xC1);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+ LCD_WriteReg(R24, 0xE1);\r
+ LCD_WriteReg(R24, 0xF1);\r
+ vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */\r
+ LCD_WriteReg(R24, 0xF5);\r
+ vTaskDelay( 60 / portTICK_RATE_MS ); /* Delay 60 ms */\r
+ LCD_WriteReg(R27, 0x09);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+ LCD_WriteReg(R31, 0x11);\r
+ LCD_WriteReg(R32, 0x0E);\r
+ LCD_WriteReg(R30, 0x81);\r
+ vTaskDelay( 10 / portTICK_RATE_MS ); /* Delay 10 ms */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayOn\r
+* Description : Enables the Display.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayOn(void)\r
+{\r
+ LCD_WriteReg(R1, 0x50);\r
+ LCD_WriteReg(R5, 0x04);\r
+\r
+ /* Display On */\r
+ LCD_WriteReg(R0, 0x80);\r
+ LCD_WriteReg(R59, 0x01);\r
+ vTaskDelay( 40 / portTICK_RATE_MS ); /* Delay 40 ms */\r
+ LCD_WriteReg(R0, 0x20);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayOff\r
+* Description : Disables the Display.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayOff(void)\r
+{\r
+ /* Display Off */\r
+ LCD_WriteReg(R0, 0xA0);\r
+ vTaskDelay( 40 / portTICK_RATE_MS ); /* Delay 40 ms */\r
+ LCD_WriteReg(R59, 0x00);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CtrlLinesConfig\r
+* Description : Configures LCD control lines in Output Push-Pull mode.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CtrlLinesConfig(void)\r
+{\r
+ GPIO_InitTypeDef GPIO_InitStructure;\r
+\r
+ /* Configure NCS (PB.02) in Output Push-Pull mode */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;\r
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
+ GPIO_Init(GPIOB, &GPIO_InitStructure);\r
+\r
+ /* Configure NWR(RNW), RS (PD.15, PD.07) in Output Push-Pull mode */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_15;\r
+ GPIO_Init(GPIOD, &GPIO_InitStructure);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CtrlLinesWrite\r
+* Description : Sets or reset LCD control lines.\r
+* Input : - GPIOx: where x can be B or D to select the GPIO peripheral.\r
+* - CtrlPins: the Control line. This parameter can be:\r
+* - CtrlPin_NCS: Chip Select pin (PB.02)\r
+* - CtrlPin_NWR: Read/Write Selection pin (PD.15)\r
+* - CtrlPin_RS: Register/RAM Selection pin (PD.07)\r
+* - BitVal: specifies the value to be written to the selected bit.\r
+* This parameter can be:\r
+* - Bit_RESET: to clear the port pin\r
+* - Bit_SET: to set the port pin\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u16 CtrlPins, BitAction BitVal)\r
+{\r
+ /* Set or Reset the control line */\r
+ GPIO_WriteBit(GPIOx, CtrlPins, BitVal);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SPIConfig\r
+* Description : Configures the SPI2 interface.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SPIConfig(void)\r
+{\r
+ SPI_InitTypeDef SPI_InitStructure;\r
+ GPIO_InitTypeDef GPIO_InitStructure;\r
+\r
+ /* Enable GPIOA clock */\r
+ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);\r
+\r
+ /* Enable SPI2 clock */\r
+ RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2, ENABLE);\r
+\r
+ /* Configure SPI2 pins: NSS, SCK, MISO and MOSI */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;\r
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;\r
+ GPIO_Init(GPIOB, &GPIO_InitStructure);\r
+\r
+ /* SPI2 Config */\r
+ SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;\r
+ SPI_InitStructure.SPI_Mode = SPI_Mode_Master;\r
+ SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b;\r
+ SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;\r
+ SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;\r
+ SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;\r
+ SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;\r
+ SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;\r
+ SPI_Init(SPI2, &SPI_InitStructure);\r
+\r
+ /* SPI2 enable */\r
+ SPI_Cmd(SPI2, ENABLE);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : StrLength\r
+* Description : Returns length of string.\r
+* Input : - Str: Character Pointer.\r
+* Output : None\r
+* Return : String length.\r
+*******************************************************************************/\r
+static u32 StrLength(u8 *Str)\r
+{\r
+ u32 Index = 0;\r
+\r
+ /* Increment the Index unless the end of string */\r
+ for(Index = 0; *Str != '\0'; Str++, Index++)\r
+ {\r
+ }\r
+\r
+ return Index;\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/\r