--- /dev/null
+/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************\r
+* File Name : lcd.c\r
+* Author : MCD Application Team\r
+* Date First Issued : 03/10/2006\r
+* Description : This file includes the LCD driver for GXM12232-2SL liquid\r
+* Crystal Display Module of STR75x-EVAL.\r
+********************************************************************************\r
+* History:\r
+* 07/17/2006 : V1.0\r
+* 03/10/2006 : V0.1\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 "lcd.h"\r
+\r
+/* Private typedef -----------------------------------------------------------*/\r
+\r
+ /* Peripherals InitStructure define */\r
+GPIO_InitTypeDef GPIO_InitStructure;\r
+\r
+/* Private define ------------------------------------------------------------*/\r
+#define LCD_GPIO_Pins 0x3FC00\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+ /* Global variable to set the written text color: used for LCD_Printf */\r
+ TextColorMode_TypeDef TextMode = BlackText;\r
+\r
+ /* ASCII Table: each character is 7 column (7dots large) on two pages (16dots high) */\r
+ /* 7 column character: Two 8bit data to display one column*/\r
+ const u8 AsciiDotsTable[1778] = {\r
+ /* ASCII 0 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 1 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 2 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 3 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 4 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 5 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 6 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 7 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 8 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 10 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 11 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 12 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 13 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 14 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 15 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 16 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 17 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 18 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 19 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 20 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 21 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 22 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 23 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 24 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 25 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 26 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 27 */ 0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,\r
+ /* ASCII 28 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 29 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 30 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 31 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 32 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 33 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x13,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 34 */ 0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,\r
+ /* ASCII 35 */ 0x00,0x00,0x35,0x00,0x0f,0x80,0x35,0x60,0x0f,0x80,0x05,0x60,0x00,0x00,\r
+ /* ASCII 36 */ 0x00,0x00,0x0d,0x80,0x0a,0x40,0x3a,0x60,0x06,0x40,0x00,0x00,0x00,0x00,\r
+ /* ASCII 37 */ 0x00,0x00,0x02,0x40,0x02,0xa0,0x0a,0x40,0x15,0x00,0x09,0x00,0x00,0x00,\r
+ /* ASCII 38 */ 0x00,0x00,0x0c,0x00,0x13,0x00,0x14,0x80,0x08,0x80,0x14,0x00,0x00,0x00,\r
+ /* ASCII 39 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 40 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x60,0x60,0x00,0x00,0x00,0x00,\r
+ /* ASCII 41 */ 0x00,0x00,0x00,0x00,0x60,0x60,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 42 */ 0x00,0x00,0x00,0x40,0x03,0x40,0x00,0xe0,0x03,0x40,0x00,0x40,0x00,0x00,\r
+ /* ASCII 43 */ 0x02,0x00,0x02,0x00,0x02,0x00,0x1f,0xc0,0x02,0x00,0x02,0x00,0x02,0x00,\r
+ /* ASCII 44 */ 0x00,0x00,0x00,0x00,0x60,0x00,0x38,0x00,0x08,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 45 */ 0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,\r
+ /* ASCII 46 */ 0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 47 */ 0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x00,\r
+ /* ASCII 48 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00,\r
+ /* ASCII 49 */ 0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00,\r
+ /* ASCII 50 */ 0x00,0x00,0x18,0x40,0x14,0x20,0x12,0x20,0x11,0x20,0x18,0xc0,0x00,0x00,\r
+ /* ASCII 51 */ 0x00,0x00,0x08,0x40,0x10,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,\r
+ /* ASCII 52 */ 0x00,0x00,0x06,0x00,0x05,0x00,0x04,0xc0,0x14,0x20,0x1f,0xe0,0x14,0x00,\r
+ /* ASCII 53 */ 0x00,0x00,0x08,0x00,0x11,0xe0,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00,\r
+ /* ASCII 54 */ 0x00,0x00,0x0f,0x80,0x11,0x40,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00,\r
+ /* ASCII 55 */ 0x00,0x00,0x00,0x60,0x00,0x20,0x18,0x20,0x07,0x20,0x00,0xe0,0x00,0x00,\r
+ /* ASCII 56 */ 0x00,0x00,0x0e,0xc0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,\r
+ /* ASCII 57 */ 0x00,0x00,0x11,0xc0,0x12,0x20,0x12,0x20,0x0a,0x20,0x07,0xc0,0x00,0x00,\r
+ /* ASCII 58 */ 0x00,0x00,0x00,0x00,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 59 */ 0x00,0x00,0x00,0x00,0x30,0x00,0x19,0x80,0x09,0x80,0x00,0x00,0x00,0x00,\r
+ /* ASCII 60 */ 0x02,0x00,0x05,0x00,0x05,0x00,0x08,0x80,0x10,0x40,0x10,0x40,0x00,0x00,\r
+ /* ASCII 61 */ 0x00,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x00,0x00,\r
+ /* ASCII 62 */ 0x10,0x40,0x10,0x40,0x08,0x80,0x05,0x00,0x05,0x00,0x02,0x00,0x00,0x00,\r
+ /* ASCII 63 */ 0x00,0x00,0x00,0x00,0x10,0x80,0x14,0x40,0x02,0x40,0x01,0x80,0x00,0x00,\r
+ /* ASCII 64 */ 0x00,0x00,0x1f,0xe0,0x20,0x10,0x23,0x10,0x24,0x90,0x17,0xe0,0x00,0x00,\r
+ /* ASCII 65 */ 0x10,0x00,0x1c,0x00,0x17,0xa0,0x04,0x60,0x17,0x80,0x1c,0x00,0x10,0x00,\r
+ /* ASCII 66 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,\r
+ /* ASCII 67 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x08,0x60,0x00,0x00,\r
+ /* ASCII 68 */ 0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x08,0x40,0x07,0x80,0x00,0x00,\r
+ /* ASCII 69 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x13,0xa0,0x10,0x20,0x18,0x60,0x00,0x00,\r
+ /* ASCII 70 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x11,0x20,0x03,0xa0,0x00,0x20,0x00,0x60,\r
+ /* ASCII 71 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x12,0x20,0x0e,0x60,0x02,0x00,\r
+ /* ASCII 72 */ 0x10,0x20,0x1f,0xe0,0x11,0x20,0x01,0x00,0x11,0x20,0x1f,0xe0,0x10,0x20,\r
+ /* ASCII 73 */ 0x00,0x00,0x10,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x00,0x00,\r
+ /* ASCII 74 */ 0x00,0x00,0x0e,0x00,0x10,0x20,0x10,0x20,0x0f,0xe0,0x00,0x20,0x00,0x00,\r
+ /* ASCII 75 */ 0x10,0x20,0x1f,0xe0,0x12,0x20,0x03,0x00,0x04,0xa0,0x18,0x60,0x10,0x20,\r
+ /* ASCII 76 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x00,0x1c,0x00,0x00,0x00,\r
+ /* ASCII 77 */ 0x10,0x20,0x1f,0xe0,0x10,0xe0,0x03,0x00,0x10,0xe0,0x1f,0xe0,0x10,0x20,\r
+ /* ASCII 78 */ 0x10,0x20,0x1f,0xe0,0x10,0xe0,0x07,0x00,0x18,0x20,0x1f,0xe0,0x00,0x20,\r
+ /* ASCII 79 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00,\r
+ /* ASCII 80 */ 0x00,0x00,0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x01,0xc0,0x00,0x00,\r
+ /* ASCII 81 */ 0x00,0x00,0x0f,0xc0,0x10,0x20,0x30,0x20,0x30,0x20,0x2f,0xc0,0x00,0x00,\r
+ /* ASCII 82 */ 0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x06,0x20,0x09,0xc0,0x10,0x00,\r
+ /* ASCII 83 */ 0x00,0x00,0x18,0xc0,0x09,0x20,0x11,0x20,0x11,0x40,0x0e,0x60,0x00,0x00,\r
+ /* ASCII 84 */ 0x00,0x60,0x00,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x00,0x20,0x00,0x60,\r
+ /* ASCII 85 */ 0x00,0x20,0x0f,0xe0,0x10,0x20,0x10,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20,\r
+ /* ASCII 86 */ 0x00,0x20,0x00,0xe0,0x07,0x20,0x18,0x00,0x07,0x20,0x00,0xe0,0x00,0x20,\r
+ /* ASCII 87 */ 0x00,0x20,0x0f,0xe0,0x10,0x20,0x0f,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20,\r
+ /* ASCII 88 */ 0x10,0x20,0x18,0x60,0x04,0x80,0x03,0x00,0x04,0x80,0x18,0x60,0x10,0x20,\r
+ /* ASCII 89 */ 0x00,0x20,0x00,0x60,0x11,0xa0,0x1e,0x00,0x11,0xa0,0x00,0x60,0x00,0x20,\r
+ /* ASCII 90 */ 0x00,0x00,0x18,0x60,0x14,0x20,0x13,0x20,0x10,0xa0,0x18,0x60,0x00,0x00,\r
+ /* ASCII 91 */ 0x00,0x00,0x00,0x00,0x7f,0xe0,0x40,0x20,0x40,0x20,0x00,0x00,0x00,0x00,\r
+ /* ASCII 92 */ 0x00,0x00,0x00,0x20,0x01,0xc0,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 93 */ 0x00,0x00,0x00,0x00,0x40,0x20,0x40,0x20,0x7f,0xe0,0x00,0x00,0x00,0x00,\r
+ /* ASCII 94 */ 0x00,0x00,0x01,0x00,0x00,0x80,0x00,0x60,0x00,0x80,0x01,0x00,0x00,0x00,\r
+ /* ASCII 95 */ 0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,\r
+ /* ASCII 96 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x00,0x00,0x00,\r
+ /* ASCII 97 */ 0x00,0x00,0x0d,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 98 */ 0x10,0x20,0x1f,0xe0,0x11,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,\r
+ /* ASCII 99 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x09,0x80,0x00,0x00,\r
+ /* ASCII 100 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x11,0x20,0x1f,0xe0,0x10,0x00,\r
+ /* ASCII 101 */ 0x00,0x00,0x0f,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x13,0x00,0x00,0x00,\r
+ /* ASCII 102 */ 0x00,0x00,0x10,0x80,0x1f,0xc0,0x10,0xa0,0x10,0xa0,0x10,0xa0,0x00,0x00,\r
+ /* ASCII 103 */ 0x00,0x00,0x0f,0x00,0x50,0x80,0x50,0x80,0x51,0x00,0x3f,0x80,0x00,0x80,\r
+ /* ASCII 104 */ 0x10,0x20,0x1f,0xe0,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 105 */ 0x00,0x00,0x10,0x80,0x10,0x80,0x1f,0xa0,0x10,0x00,0x10,0x00,0x00,0x00,\r
+ /* ASCII 106 */ 0x00,0x00,0x40,0x80,0x40,0x80,0x40,0xa0,0x3f,0x80,0x00,0x00,0x00,0x00,\r
+ /* ASCII 107 */ 0x10,0x20,0x1f,0xe0,0x02,0x00,0x16,0x80,0x19,0x80,0x10,0x80,0x00,0x00,\r
+ /* ASCII 108 */ 0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00,\r
+ /* ASCII 109 */ 0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x00,0x10,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 110 */ 0x10,0x80,0x1f,0x80,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00,\r
+ /* ASCII 111 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,\r
+ /* ASCII 112 */ 0x40,0x80,0x7f,0x80,0x51,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,\r
+ /* ASCII 113 */ 0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x51,0x00,0x7f,0x80,0x40,0x80,\r
+ /* ASCII 114 */ 0x00,0x00,0x10,0x80,0x1f,0x80,0x11,0x00,0x10,0x80,0x10,0x80,0x00,0x00,\r
+ /* ASCII 115 */ 0x00,0x00,0x19,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x0d,0x80,0x00,0x00,\r
+ /* ASCII 116 */ 0x00,0x00,0x00,0x80,0x0f,0xc0,0x10,0x80,0x10,0x80,0x10,0x80,0x08,0x00,\r
+ /* ASCII 117 */ 0x00,0x80,0x0f,0x80,0x10,0x00,0x10,0x00,0x08,0x80,0x1f,0x80,0x10,0x00,\r
+ /* ASCII 118 */ 0x00,0x80,0x03,0x80,0x0c,0x80,0x10,0x00,0x0c,0x80,0x03,0x80,0x00,0x80,\r
+ /* ASCII 119 */ 0x00,0x80,0x0f,0x80,0x10,0x80,0x0e,0x00,0x10,0x80,0x0f,0x80,0x00,0x80,\r
+ /* ASCII 120 */ 0x10,0x80,0x19,0x80,0x06,0x00,0x06,0x00,0x19,0x80,0x10,0x80,0x00,0x00,\r
+ /* ASCII 121 */ 0x00,0x80,0x41,0x80,0x46,0x80,0x78,0x00,0x4c,0x80,0x03,0x80,0x00,0x80,\r
+ /* ASCII 122 */ 0x00,0x00,0x19,0x80,0x14,0x80,0x12,0x80,0x11,0x80,0x18,0x80,0x00,0x00,\r
+ /* ASCII 123 */ 0x00,0x00,0x00,0x00,0x04,0x00,0x3b,0xc0,0x40,0x20,0x00,0x00,0x00,0x00,\r
+ /* ASCII 124 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 125 */ 0x00,0x00,0x00,0x00,0x40,0x20,0x3b,0xc0,0x04,0x00,0x00,0x00,0x00,0x00,\r
+ /* ASCII 126 */ 0x00,0x00,0x04,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x00,0x00};\r
+\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Private functions ---------------------------------------------------------*/\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DataLinesConfig\r
+* Description : Configure data lines D0~D7 (P2.10~P2.17) in Input Floating mode\r
+* for read from LCD or in Output Push-Pull mode for write on LCD\r
+* Input : - Mode: specifies the configuration mode for data lines D0~D7\r
+* - Input: configure in Input Floating mode\r
+* - Output: configure in Output Push-Pul mode\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DataLinesConfig(DataConfigMode_TypeDef Mode)\r
+{\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 |\r
+ GPIO_Pin_14 | GPIO_Pin_15 | GPIO_Pin_16 | GPIO_Pin_17;\r
+ if (Mode == Input)\r
+ {\r
+ /* Configure D0~D7 lines (P2.10~2.17) in Input Floating mode */\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;\r
+ }\r
+ else\r
+ {\r
+ /* Configure D0~D7 lines (P2.10~2.17) in Output Push-Pull mode */\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
+ }\r
+ GPIO_Init(GPIO2, &GPIO_InitStructure);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DataLinesWrite\r
+* Description : Write a value on D0~D7 (P2.10~P2.17)\r
+* Input : - GPIOx: GPIO port to write on. It could be\r
+* - PortVal: value to write\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DataLinesWrite(GPIO_TypeDef* GPIOx, u32 PortVal)\r
+{\r
+ u32 Tmp = 0;\r
+\r
+ /* Store the PM register value */\r
+ Tmp = GPIO_GetPortMask(GPIOx);\r
+ /* Mask the corresponding GPIO pins */\r
+ GPIO_PinMaskConfig(GPIOx, LCD_GPIO_Pins, DISABLE);\r
+ GPIO_PinMaskConfig(GPIOx, ~LCD_GPIO_Pins, ENABLE);\r
+ /* Write in the hole register */\r
+ GPIO_Write(GPIOx, (PortVal<<10));\r
+\r
+ GPIO_PinMaskConfig(GPIOx, ~LCD_GPIO_Pins, DISABLE);\r
+ /* Return the initial PM register value */\r
+ GPIO_PinMaskConfig(GPIOx, Tmp, ENABLE);\r
+\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CtrlLinesConfig\r
+* Description : Configure control lines E2, E1, RW, DI (P2.0~P2.3) in\r
+* Output Push-Pull mode.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CtrlLinesConfig(void)\r
+{\r
+ /* Configure E2, E1, RW, DI lines (P2.0~2.3) in Output Push-Pull mode */\r
+ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;\r
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;\r
+ GPIO_Init(GPIO2, &GPIO_InitStructure);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CtrlLinesWrite\r
+* Description : Set or reset control lines E2, E1, RW, DI (P2.0~P2.3).\r
+* Input : - GPIOx: where x can be 0,1 or 2 to select the GPIO peripheral.\r
+* - CtrlPins: the Control line. This parameter can be:\r
+* - CtrlPin_E2: Enabe clock signal for Slave\r
+* - CtrlPin_E1: Enabe clock signal for Master\r
+* - CtrlPin_RW: Read/Write control line\r
+* - CtrlPin_DI:\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u32 CtrlPins, BitAction BitVal)\r
+{\r
+ /* Set or Reset the control line */\r
+ if(BitVal != Bit_RESET)\r
+ {\r
+ GPIOx->PD |= CtrlPins;\r
+ }\r
+ else\r
+ {\r
+ GPIOx->PD &= ~CtrlPins;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CheckMasterStatus\r
+* Description : Check whether master LCD is busy or not\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CheckMasterStatus(void) \r
+{\r
+ u8 MasterStatus = 0;\r
+\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the master read sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ MasterStatus = GPIO_Read(GPIO2);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ \r
+ /* Wait until BF is cleared: D7 line */\r
+ while ((MasterStatus & 0x20000))\r
+ {\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ MasterStatus = GPIO_Read(GPIO2);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_CheckSlaveStatus\r
+* Description : Check whether slave LCD is busy or not\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_CheckSlaveStatus(void) \r
+{\r
+ u8 SlaveStatus = 0;\r
+\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the slave read sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */ \r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ SlaveStatus = GPIO_Read(GPIO2);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ \r
+ /* Wait until BF is cleared: D7 line */\r
+ while ((SlaveStatus & 0x20000))\r
+ {\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ SlaveStatus = GPIO_Read(GPIO2);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendMasterCmd\r
+* Description : Send one byte command to master LCD.\r
+* Input : - Cmd: the user expected command to send to master LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendMasterCmd(u8 Cmd)\r
+{\r
+ /* Check the master status */\r
+ LCD_CheckMasterStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the master send command sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ /* Write master command */\r
+ LCD_DataLinesWrite(GPIO2, (u32)Cmd);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendSlaveCmd\r
+* Description : Send one byte command to slave LCD\r
+* Input : - Cmd: the user expected command to send to slave LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendSlaveCmd(u8 Cmd)\r
+{\r
+ /* Check the slave status */\r
+ LCD_CheckSlaveStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the slave send command sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET); /* DI = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ /* Write slave command */\r
+ LCD_DataLinesWrite(GPIO2, (u32)Cmd);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendMasterData\r
+* Description : Display one byte data to master LCD.\r
+* Input : - Data: the user expected data to display on master LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendMasterData(u8 Data)\r
+{\r
+ /* Check the master status */\r
+ LCD_CheckMasterStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the master send data sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ /* Write data to the master */\r
+ LCD_DataLinesWrite(GPIO2, (u32)Data);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ReadMasterData\r
+* Description : Read master byte data displayed on master LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+u32 LCD_ReadMasterData(void)\r
+{\r
+ u32 MasterData = 0;\r
+\r
+ /* Check the master status */\r
+ LCD_CheckMasterStatus();\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the master read data sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET); /* E1 = 1 */\r
+ /* Read data from the master */\r
+ MasterData = ((GPIO_Read(GPIO2)&0x3FC00)>>10);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */\r
+ /* Read the master returned data */\r
+ return MasterData;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SendSlaveData\r
+* Description : Display one byte data to slave LCD.\r
+* Input : - Data: the user expected data to display on slave LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SendSlaveData(u8 Data)\r
+{\r
+ /* Check the slave status */\r
+ LCD_CheckSlaveStatus();\r
+ /* Configure Data lines as Output */\r
+ LCD_DataLinesConfig(Output);\r
+ /* Start the slave send data sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET); /* RW = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ /* Write data to the slave */\r
+ LCD_DataLinesWrite(GPIO2, (u32)Data);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ReadSlaveData\r
+* Description : Read slave byte data displayed on slave LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+u32 LCD_ReadSlaveData(void)\r
+{\r
+ u32 SlaveData = 0;\r
+\r
+ /* Check the slave status */\r
+ LCD_CheckSlaveStatus();\r
+ /* Configure Data lines as Input */\r
+ LCD_DataLinesConfig(Input);\r
+ /* Start the slave read data sequence */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET); /* RW = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET); /* DI = 1 */\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET); /* E2 = 1 */\r
+ /* Read data from the slave */\r
+ SlaveData = ((GPIO_Read(GPIO2)&0x3FC00)>>10);\r
+ LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */\r
+ /* Read the slave returned data */\r
+ return SlaveData;\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Init\r
+* Description : Initialize master and slave LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Init(void)\r
+{\r
+ /* Enable GPIO Clock */\r
+ MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);\r
+\r
+ /* Configure control lines signals as output mode */\r
+ LCD_CtrlLinesConfig(); \r
+\r
+ /* Master LCD Init */\r
+ LCD_SendMasterCmd(SOFTWARE_RESET);\r
+ LCD_SendMasterCmd(DISPLAY_OFF);\r
+ LCD_SendMasterCmd(DYNAMIC_DRIVE);\r
+ LCD_SendMasterCmd(DUTY_CYCLE);\r
+ LCD_SendMasterCmd(CLOCKWISE_OUTPUT);\r
+ LCD_SendMasterCmd(READ_MODIFY_WRITE_OFF);\r
+ LCD_SendMasterCmd(START_COLUMN); /* Set master column address to 0 */\r
+ LCD_SendMasterCmd(START_LINE); /* Set master display start line to 0 */\r
+ LCD_SendMasterCmd(DISPLAY_ON );\r
+\r
+ /* Slave LCD Init */\r
+ LCD_SendSlaveCmd(SOFTWARE_RESET);\r
+ LCD_SendSlaveCmd(DISPLAY_OFF);\r
+ LCD_SendSlaveCmd(DYNAMIC_DRIVE);\r
+ LCD_SendSlaveCmd(DUTY_CYCLE);\r
+ LCD_SendSlaveCmd(CLOCKWISE_OUTPUT);\r
+ LCD_SendSlaveCmd(READ_MODIFY_WRITE_OFF);\r
+ LCD_SendSlaveCmd(START_COLUMN ); /* Set slave column address to 0 */\r
+ LCD_SendSlaveCmd(START_LINE); /* Set slave display start line to 0 */\r
+ LCD_SendSlaveCmd(DISPLAY_ON);\r
+\r
+ /* Clear LCD */ \r
+ LCD_Clear();\r
+ /* Set current Page to 0 for Master and Slave LCDs */ \r
+ LCD_SetSlavePage(0);\r
+ LCD_SetMasterPage(0);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetSlavePage\r
+* Description : Set the display page of slave LCD, the page range is 0 to 3,\r
+* make sure the input will not exceed this range ,otherwise it\r
+* will reach a undecided result.\r
+* Input : - Page: specifies the expected display page of slave LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetSlavePage(u8 Page)\r
+{\r
+ /* Set Slave page */\r
+ LCD_SendSlaveCmd(0xB8|Page);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetMasterPage\r
+* Description : Set the display page of master LCD, the page range is 0 to 3,\r
+* make sure the input will not exceed this range ,otherwise it\r
+* will reach a undecided result.\r
+* Input : - Page: specifies the expected display page of master LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetMasterPage(u8 Page)\r
+{\r
+ /* Set Master page */\r
+ LCD_SendMasterCmd(0xB8|Page);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : SetAddress\r
+* Description : Set the display column of slave LCD. Column range is 0 to 61.\r
+* Input : - Address: specifies the expected display column of slave LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetSlaveColumn(u8 Address)\r
+{\r
+ /* Set Slave column address */\r
+ LCD_SendSlaveCmd(Address&0x7F);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetMasterColumn\r
+* Description : Set the display column of master LCD. Column range is 0 to 61.\r
+* Input : - Address: specifies the expected display column of slave LCD\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetMasterColumn(u8 Address)\r
+{\r
+ /* Set Master column address */\r
+ LCD_SendMasterCmd(Address&0x7F);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_SetTextColor\r
+* Description : Set the text color for LCD.\r
+* Input : - TextColor: BlackText: character on black, bottom on white.\r
+* WhiteText: character on white, bottom on black.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_SetTextColor(TextColorMode_TypeDef TextColor)\r
+{\r
+ if(TextColor)\r
+ {\r
+ /* Set White Text color */\r
+ TextMode=WhiteText;\r
+ }\r
+ else\r
+ {\r
+ /* Set Black Text color */\r
+ TextMode=BlackText;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Clear\r
+* Description : Clear the Master and Slave LCDs display.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Clear(void)\r
+{\r
+ u8 Page = 0, Column = 0; \r
+\r
+ /* Clear master and slave LCDs page by page */\r
+ for (Page=0; Page<4; Page++)\r
+ {\r
+ /* Set master and slave page by page */\r
+ LCD_SetMasterPage(Page);\r
+ LCD_SetSlavePage(Page);\r
+ /* Set master and slave column address */\r
+ LCD_SetMasterColumn(0);\r
+ LCD_SetSlaveColumn(0);\r
+ /* Send empty data to master and slave column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendSlaveData(0);\r
+ LCD_SendMasterData(0);\r
+ }\r
+ }\r
+}\r
+ \r
+/*******************************************************************************\r
+* Function Name : LCD_ClearLine\r
+* Description : Clear the selected line of the LCD.\r
+* Input : - Line: the Line to clear.\r
+* - Line1 (Page0&1): clear the first line\r
+* - Line2 (Page2&3): clear the second line\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearLine(u8 Line)\r
+{\r
+ u8 Page = 0, Column = 0; \r
+\r
+ /* Clear the slected master and slave line */\r
+ for (Page=Line; Page<Line+2; Page++)\r
+ {\r
+ /* Set master and slave page by page */\r
+ LCD_SetMasterPage(Page);\r
+ LCD_SetSlavePage(Page);\r
+ /* Set master and slave column address */\r
+ LCD_SetMasterColumn(0);\r
+ LCD_SetSlaveColumn(0);\r
+ /* Send empty data to master and slave column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendSlaveData(0);\r
+ LCD_SendMasterData(0);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ClearMaster\r
+* Description : Clear the master LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearMaster(void)\r
+{\r
+ u8 Page = 0, Column = 0;\r
+ \r
+ /* Clear all master LCD pages */\r
+ for (Page=0; Page<4; Page++)\r
+ {\r
+ /* Set master page by page */\r
+ LCD_SetMasterPage(Page);\r
+ /* Set master column address */\r
+ LCD_SetMasterColumn(0);\r
+ /* Send empty data to master column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendMasterData(0);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ClearSlave\r
+* Description : Clear the slave LCD.\r
+* Input : None\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_ClearSlave()\r
+{\r
+ u8 Page = 0, Column = 0; \r
+\r
+ /* Clear all slave LCD pages */\r
+ for (Page=0; Page<4; Page++)\r
+ {\r
+ /* Set slave page by page */\r
+ LCD_SetSlavePage(Page);\r
+ /* Set slave column address */\r
+ LCD_SetSlaveColumn(0);\r
+ /* Send empty data to slave column address on the selected page */\r
+ for (Column=0; Column<61; Column++)\r
+ {\r
+ LCD_SendSlaveData(0);\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawChar\r
+* Description : Draw a character in LCD.\r
+* Note:\r
+* the LCD can only display two line character,so page 0 and 1\r
+* is to display the first line, page2 and page 3 is to display\r
+* the second line.\r
+* Input : - Line: the Line where to display the character shape .\r
+* - Line1 (Page0&1): display character on the first line\r
+* - Line2 (Page2&3): display character on the second line\r
+* - Column: start column address.\r
+* - Width: the number of column (dots) of a character width.\r
+* - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DrawChar(u8 Line, u8 Column, u8 Width, u8 *Bmp)\r
+{\r
+ u8 X = 0, ActualColumn = 0, Window = 0, i = 0;\r
+\r
+ /* Draw the character column by column: width times */\r
+ for(X = Column; X<(Column+Width); X++)\r
+ {\r
+ if(X > 121)\r
+ {\r
+ /* Return if column exceeded 121 */\r
+ return;\r
+ }\r
+ if (X > 60) \r
+ {\r
+ /* To be displayed on slave LCD (Window = 1) */\r
+ Window = 1;\r
+ /* Get the Slave relative start column */\r
+ ActualColumn = X%61;\r
+ }\r
+ else\r
+ { \r
+ /* To be displayed on master LCD (Window = 0) */\r
+ ActualColumn = X;\r
+ }\r
+\r
+ /* Switch window, display the character upper part */\r
+ if (Window)\r
+ {\r
+ /* Display it on slave LCD */\r
+ LCD_SetSlavePage(Line);\r
+ LCD_SetSlaveColumn(ActualColumn);\r
+ LCD_SendSlaveData(Bmp[i]);\r
+ }\r
+ else\r
+ {\r
+ /* Display it on master LCD */\r
+ LCD_SetMasterPage(Line);\r
+ LCD_SetMasterColumn(ActualColumn);\r
+ LCD_SendMasterData(Bmp[i]);\r
+ }\r
+ /* Switch window, diplay the character lower part */\r
+ if (Window)\r
+ {\r
+ /* Display it on slave LCD */\r
+ LCD_SetSlavePage(Line+1);\r
+ LCD_SetSlaveColumn(ActualColumn);\r
+ LCD_SendSlaveData(Bmp[i+1]);\r
+ }\r
+ else\r
+ {\r
+ /* Display it on master LCD */\r
+ LCD_SetMasterPage(Line+1);\r
+ LCD_SetMasterColumn(ActualColumn);\r
+ LCD_SendMasterData(Bmp[i+1]);\r
+ }\r
+ /* Increment by 2 the character table index */\r
+ i+=2;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayChar\r
+* Description : Display one character (7dots large, 16dots high).\r
+* Note:\r
+* the LCD can only display two line character,so page 0 and 1\r
+* is to display the first line, page2 and page 3 is to display\r
+* the second line.\r
+* Input : - Line: the Line where to display the character.\r
+* - Line1 (Page0&1): display character on the first line\r
+* - Line2 (Page2&3): display character on the second line\r
+* - Column: start column address.\r
+* - Ascii: character ascii code.\r
+* - CharMode: BlackText: character on black, bottom on white.\r
+* WhiteText: character on white, bottom on black.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayChar(u8 Line, u8 Column, u8 Ascii, TextColorMode_TypeDef CharMode)\r
+{\r
+ u8 DotBuffer[14], i = 0;\r
+\r
+ /* Display the character lower and upper 8bit parts (2*7columns) */\r
+ for (i=0;i<14;i++)\r
+ {\r
+ /* Character displayed as white Text on black buttom */\r
+ if(CharMode)\r
+ {\r
+ if(i%2==0)\r
+ {\r
+ DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i+1];\r
+ }\r
+ else\r
+ {\r
+ DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i-1]; \r
+ }\r
+ }\r
+ /* Character displayed as black Text on white buttom */\r
+ else\r
+ {\r
+ if(i%2==0)\r
+ {\r
+ DotBuffer[i] = AsciiDotsTable[Ascii*14+i+1]; \r
+ }\r
+ else\r
+ {\r
+ DotBuffer[i] = AsciiDotsTable[Ascii*14+i-1]; \r
+ }\r
+ }\r
+ }\r
+ /* Display the asc code after conversion */\r
+ LCD_DrawChar(Line, Column, 7, DotBuffer);\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_HexToAsciiLow\r
+* Description : This function is used to convert the low nibble of an\r
+* unsigned byte (0-F hex) to ASCII.\r
+* Input : - byte: byte to convert to ASCII.\r
+* Output : None\r
+* Return : ASCII value result of the conversion.\r
+*******************************************************************************/\r
+u8 LCD_HexToAsciiLow(u8 byte)\r
+{\r
+ /* Keep lower nibble only */\r
+ byte = byte & 0x0F;\r
+ /* If the ascii is a number */ \r
+ if (byte <= 0x09)\r
+ {\r
+ /* Add 0x30 to its ascii */\r
+ return(byte + 0x30);\r
+ }\r
+ else\r
+ {\r
+ /* Add 0x37 to its ascii */\r
+ return (byte + 0x37);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_HexToAsciiHigh\r
+* Description : This function is used to convert the high nibble of an\r
+* unsigned byte (0-F hex) to ASCII.\r
+* Input : - byte: byte to convert to ASCII.\r
+* Output : None\r
+* Return : ASCII value result of the conversion.\r
+*******************************************************************************/\r
+u8 LCD_HexToAsciiHigh(u8 byte)\r
+{\r
+ /* Keep upper nibble only */\r
+ byte = byte & 0xF0; \r
+ byte = byte >> 4;\r
+ /* If the ascii is a number */\r
+ if (byte <= 0x09)\r
+ {\r
+ /* Add 0x30 to display its ascii */\r
+ return(byte + 0x30);\r
+ }\r
+ else\r
+ {\r
+ /* Add 0x37 to display its ascii */\r
+ return (byte + 0x37);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DisplayString\r
+* Description : This function is used to display a 17char max string of\r
+* characters on the LCD display on the selected line.\r
+* Note:\r
+* this function is the user interface to use the LCD driver.\r
+* Input : - *ptr: pointer to string to display on LCD.\r
+* - Line: the Line where to display the character.\r
+* - Line1 (Page0&1): display character on the first line\r
+* - Line2 (Page2&3): display character on the second line\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_DisplayString(u8 Line, u8 *ptr, TextColorMode_TypeDef CharMode)\r
+{\r
+ u8 RefColumn = 0, i = 0;\r
+\r
+ /* Send the string character by character on lCD */\r
+ while ((*ptr!=0)&(i<17))\r
+ {\r
+ /* Display one character on LCD */\r
+ LCD_DisplayChar(Line, RefColumn, *ptr, CharMode);\r
+ /* Increment the column position by 7 */\r
+ RefColumn+=7;\r
+ /* Point on the next character */\r
+ ptr++;\r
+ /* Increment the character counter */\r
+ i++;\r
+ /* If we reach the maximum Line character */\r
+ if(i==17)\r
+ {\r
+ LCD_DisplayChar(Line, RefColumn-1, 0x1f, CharMode); /* Add missed columns */\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_Printf\r
+* Description : This function is used to display a string of characters\r
+* on the LCD display.\r
+* Note:\r
+* this function is the user interface to use the LCD driver.\r
+* Input : - *ptr: pointer to string to display on LCD.\r
+* Output : None\r
+* Return : None\r
+*******************************************************************************/\r
+void LCD_Printf(u8 *ptr, ...)\r
+{\r
+ u8 RefColumn = 0, RefPage = 0, i = 0, c1 = 0;\r
+ u16 var = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0;\r
+ u32 WordVar = 0;\r
+\r
+ /* Store pointer on LCD_Printf second parameter (String) */\r
+ u8 *var_ptr=(u8 *)(&ptr+1);\r
+\r
+ /* Send String */\r
+ while (*ptr != 0)\r
+ {\r
+ c1 = *ptr;\r
+ /* Limited to AsciiDotsTable code table */\r
+ if(c1 <= 128)\r
+ {\r
+ /* Carriage return */\r
+ if ( *ptr == '\r')\r
+ {\r
+ ptr++;\r
+ RefColumn = 0;\r
+ }\r
+ /* Jump to Line2 */\r
+ else if( *ptr == '\n')\r
+ {\r
+ /* Point on the string to display */\r
+ ptr++;\r
+ /* Clear Line2 */\r
+ LCD_ClearLine(Line2);\r
+ /* Point on first Line2 column */\r
+ RefColumn = 0;\r
+ /* Increment RefPage by 2 */\r
+ RefPage+=2;\r
+ }\r
+ /* Display value on the passed format */\r
+ else if( *ptr == '%')\r
+ {\r
+ ptr++;\r
+ /* Display decimal value */\r
+ if (*ptr == 'd')\r
+ {\r
+ ptr++;\r
+ /* Get the word value to display */\r
+ WordVar = ((*var_ptr)|(*(var_ptr+1)<<8)|(*(var_ptr+2)<<16));\r
+ c1=WordVar/10000;\r
+ c2=(WordVar%10000)/1000;\r
+ c3=(WordVar%1000)/100;\r
+ c4=(WordVar%100)/10;\r
+ c5=(WordVar%10);\r
+ /* Display the ten miles digit */\r
+ if (c1!=0)\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c1+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the miles digit */\r
+ if (!((c1==0)&(c2==0)))\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c2+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the hundred digit */\r
+ if (!((c1==0)&(c2==0)&(c3==0)))\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c3+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the tens digit */\r
+ if (!((c1==0)&(c2==0)&(c3==0)&(c4==0)))\r
+ {\r
+ LCD_DisplayChar(RefPage, RefColumn, c4+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display the rest */\r
+ LCD_DisplayChar(RefPage, RefColumn, c5+0x30, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display 16bits Hex value */\r
+ else if (*ptr == 'x')\r
+ {\r
+ ptr++;\r
+ /* Display 8bits MSB */\r
+ var_ptr = var_ptr +1;\r
+ var = *var_ptr;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ /* Display 8bits LSB */\r
+ var_ptr = var_ptr -1;\r
+ var = *var_ptr;\r
+ var_ptr = var_ptr +4;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ /* Display 32bits Hex value */\r
+ else if (*ptr == 'w')\r
+ {\r
+ ptr++;\r
+ /* Display 16bits MSB */\r
+ var_ptr = var_ptr +3;\r
+ var = *var_ptr;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ var_ptr = var_ptr -1;\r
+ var = *var_ptr;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ /* Display 16bits LSB */\r
+ var_ptr = var_ptr -1;\r
+ var = *var_ptr;\r
+ var_ptr = var_ptr +4;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ var_ptr = var_ptr -5;\r
+ var = *var_ptr;\r
+ var_ptr = var_ptr +4;\r
+ c1 = LCD_HexToAsciiHigh(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ c1 = LCD_HexToAsciiLow(var);\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ }\r
+ else\r
+ {\r
+ /* Display '%' character which is followed by (d, x or w) */\r
+ ptr--;\r
+ c1 = *ptr;\r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ ptr++;\r
+ i++;\r
+ if(i==17)\r
+ {\r
+ /* Add missed columns */\r
+ LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode);\r
+ RefColumn = 0;\r
+ RefPage+=2;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ { \r
+ /* Display characters different from (\r, \n, %) */ \r
+ LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);\r
+ RefColumn+=7;\r
+ ptr++;\r
+ i++;\r
+ if(i==17)\r
+ {\r
+ /* Add missed columns */\r
+ LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode);\r
+ LCD_ClearLine(Line2);\r
+ RefColumn = 0;\r
+ RefPage+=2;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ /* Display spaces if string doesn't reach the max LCD characters size */\r
+ while(RefColumn<119)\r
+ {\r
+ /* Display Spaces */\r
+ LCD_DisplayChar(RefPage, RefColumn, 0x20, TextMode);\r
+ RefColumn+=7;\r
+ /* Add missed columns */\r
+ LCD_DisplayChar(RefPage, RefColumn, 0x1f, TextMode);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawMasterGraphic\r
+* Description : Draw a Graphic image on master LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawMasterGraphic(u8 *Bmp)\r
+{\r
+ u8 j = 0, k = 0, ActPage = 0;\r
+\r
+ /* Draw graphic on master: 61 Column *4 Pages */\r
+ while(j<244)\r
+ {\r
+ /* Draw on master page by page */\r
+ LCD_SetMasterPage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetMasterColumn(k);\r
+ LCD_SendMasterData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawSlaveGraphic\r
+* Description : Draw a Graphic image on slave LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawSlaveGraphic(u8 *Bmp)\r
+{\r
+ u8 j = 0, k = 0, ActPage = 0;\r
+\r
+ /* Draw graphic on slave: 61 Column *4 Pages */\r
+ while(j<244)\r
+ {\r
+ /* Draw on slave page by page */\r
+ LCD_SetSlavePage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetSlaveColumn(k);\r
+ LCD_SendSlaveData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawGraphic\r
+* Description : Draw a Graphic image on LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawGraphic(u8 *Bmp)\r
+{\r
+ u8 Pos = 0, ActPage = 0;\r
+ u16 j = 0, k = 0;\r
+\r
+ /* Draw graphic on LCD: 122 Column *4 Pages */\r
+ while(j<488)\r
+ {\r
+ if(!Pos)\r
+ {\r
+ /* Draw on master page by page */\r
+ LCD_SetMasterPage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetMasterColumn(k);\r
+ LCD_SendMasterData(*Bmp++);\r
+ j++;\r
+ }\r
+ Pos=1;\r
+ }\r
+ else\r
+ {\r
+ /* Draw on slave page by page */\r
+ LCD_SetSlavePage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetSlaveColumn(k);\r
+ LCD_SendSlaveData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ Pos=0;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_ScrollGraphic\r
+* Description : Scroll a Graphic image on LCD.\r
+* Input : - Bmp: the pointer of the dot matrix data.\r
+* - nCount: specifies the delay time length.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_ScrollGraphic(u8 *Bmp, u32 nCount)\r
+{\r
+ u8 Pos = 0, ActPage = 0;\r
+ u16 j = 0, k = 0;\r
+ u32 Counter = 0;\r
+\r
+ /* Draw graphic on LCD: 122 Column *4 Pages */\r
+ while(j<488)\r
+ {\r
+ if(!Pos)\r
+ {\r
+ /* Draw on master page by page */\r
+ LCD_SetMasterPage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetMasterColumn(k);\r
+ LCD_SendMasterData(*Bmp++);\r
+ Counter = nCount;\r
+ /* Set a delay */\r
+ for(; Counter != 0; Counter--);\r
+ j++;\r
+ }\r
+ Pos=1;\r
+ }\r
+ else\r
+ {\r
+ /* Draw on slave page by page */\r
+ LCD_SetSlavePage(ActPage);\r
+ for(k=0; k<61; k++)\r
+ {\r
+ LCD_SetSlaveColumn(k);\r
+ Counter = nCount;\r
+ /* Set a delay */\r
+ for(; Counter != 0; Counter--);\r
+ LCD_SendSlaveData(*Bmp++);\r
+ j++;\r
+ }\r
+ ActPage++;\r
+ Pos=0;\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawPixel\r
+* Description : Draw a Graphic image on slave LCD.\r
+* Input : - XPos: the dot line number of the pixel.\r
+* - 1->61 : displayed on master LCD\r
+* - 62->122: displayed on slave LCD\r
+* - YPos: column address of the pixel from 1->32.\r
+* - Mode: Dot_On: Pixel turned on (black).\r
+* Dot_Off: Pixel turned off (black).\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawPixel(u8 XPos, u8 YPos, DotMode_TypeDef Mode)\r
+{\r
+ u8 Page = 0, Position = 0;\r
+ u16 Mask = 0;\r
+ u32 MasterDataIn = 0, MasterDataOut = 0, SlaveDataIn = 0, SlaveDataOut = 0;\r
+\r
+ /* Pixel page */\r
+ Page = (XPos-1)/8;\r
+ /* Pixel column */\r
+ Position = (YPos-1)/61; /* 0:Master, 1:Slave */\r
+ /* Mask for the pixel */\r
+ Mask= 1<<((XPos-1)%8);\r
+ /* If Position=0 draw pixel on master LCD */\r
+ if(!Position)\r
+ {\r
+ LCD_SetMasterPage(Page);\r
+ LCD_SetMasterColumn(YPos-1);\r
+ MasterDataIn = LCD_ReadMasterData();\r
+ MasterDataIn = LCD_ReadMasterData();\r
+ LCD_SetMasterColumn(YPos-1);\r
+ if(Mode==Dot_On)\r
+ {\r
+ MasterDataOut = MasterDataIn | Mask;\r
+ }\r
+ else\r
+ {\r
+ MasterDataOut = MasterDataIn & (~Mask);\r
+ }\r
+ LCD_SendMasterData(MasterDataOut);\r
+ }\r
+ /* If Position=1 draw pixel on slave LCD */\r
+ else\r
+ {\r
+ LCD_SetSlavePage(Page);\r
+ LCD_SetSlaveColumn(YPos-62);\r
+ SlaveDataIn = LCD_ReadSlaveData();\r
+ SlaveDataIn = LCD_ReadSlaveData();\r
+ LCD_SetSlaveColumn(YPos-62);\r
+ if(Mode==Dot_On)\r
+ {\r
+ SlaveDataOut = SlaveDataIn | Mask;\r
+ }\r
+ else\r
+ {\r
+ SlaveDataOut = SlaveDataIn & (~Mask);\r
+ }\r
+ LCD_SendSlaveData(SlaveDataOut);\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawLine\r
+* Description : Draw a line on master and slave LCDs.\r
+* Input : - XPos1: the dot line number of the source point .\r
+* - XPos2: the dot line number of the destination point .\r
+* - YPos1: the dot column number of the source point.\r
+* - YPos2: the dot column number of the destination point.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawLine(u8 XPos1, u8 YPos1, u8 XPos2, u8 YPos2)\r
+{\r
+ u8 XPos = 0, YPos = 0;\r
+\r
+ /* Use XPos1, YPos1, XPos2 and YPos2 */\r
+ if((XPos2>=XPos1)&(YPos2>=YPos1))\r
+ {\r
+ for(XPos=XPos1; XPos<=XPos2; XPos++)\r
+ {\r
+ for(YPos=YPos1; YPos<=YPos2; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+ else if((XPos2<XPos1)&(YPos2>=YPos1))\r
+ {\r
+ for(XPos=XPos2; XPos<=XPos1; XPos++)\r
+ {\r
+ for(YPos=YPos1; YPos<=YPos2; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+ else if((XPos2>=XPos1)&(YPos2<YPos1))\r
+ {\r
+ for(XPos=XPos1; XPos<=XPos2; XPos++)\r
+ {\r
+ for(YPos=YPos2; YPos<=YPos1; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+ else /*if((XPos2<XPos1)&(YPos2<YPos1))*/\r
+ {\r
+ for(XPos=XPos2; XPos<=XPos1; XPos++)\r
+ {\r
+ for(YPos=YPos2; YPos<=YPos1; YPos++)\r
+ {\r
+ LCD_DrawPixel(XPos, YPos, Dot_On);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+/*******************************************************************************\r
+* Function Name : LCD_DrawBox\r
+* Description : Draw a Box on master and slave LCDs.\r
+* Input : - XPos: the dot line number of the source point .\r
+* - YPos: the dot column number of the source point.\r
+* - Dx: Box large.\r
+* - Dy: Box width.\r
+* Output : None\r
+* Return : None.\r
+*******************************************************************************/\r
+void LCD_DrawBox(u8 XPos, u8 YPos, u8 Dx, u8 Dy)\r
+{\r
+ /* Use XPos, YPos, Dx and Dy */\r
+ LCD_DrawLine(XPos, YPos, XPos, YPos+Dy);\r
+ LCD_DrawLine(XPos, YPos, XPos+Dx, YPos);\r
+ LCD_DrawLine(XPos+Dx, YPos, XPos+Dx, YPos+Dy);\r
+ LCD_DrawLine(XPos, YPos+Dy, XPos+Dx, YPos+Dy);\r
+}\r
+\r
+/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE******/\r
+\r