OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM7_STR75x_IAR/] [STLibrary/] [src/] [lcd.c] - Blame information for rev 577

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 577 jeremybenn
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : lcd.c
3
* Author             : MCD Application Team
4
* Date First Issued  : 03/10/2006
5
* Description        : This file includes the LCD driver for GXM12232-2SL liquid
6
*                      Crystal Display Module of STR75x-EVAL.
7
********************************************************************************
8
* History:
9
* 07/17/2006 : V1.0
10
* 03/10/2006 : V0.1
11
********************************************************************************
12
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
14
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
15
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
16
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
17
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
*******************************************************************************/
19
 
20
/* Includes ------------------------------------------------------------------*/
21
#include "lcd.h"
22
 
23
/* Private typedef -----------------------------------------------------------*/
24
 
25
  /* Peripherals InitStructure define */
26
GPIO_InitTypeDef GPIO_InitStructure;
27
 
28
/* Private define ------------------------------------------------------------*/
29
#define LCD_GPIO_Pins 0x3FC00
30
/* Private macro -------------------------------------------------------------*/
31
/* Private variables ---------------------------------------------------------*/
32
  /* Global variable to set the written text color: used for LCD_Printf */
33
  TextColorMode_TypeDef TextMode = BlackText;
34
 
35
  /* ASCII Table: each character is 7 column (7dots large) on two pages (16dots high)  */
36
  /* 7 column character: Two 8bit data to display one column*/
37
  const u8 AsciiDotsTable[1778] = {
38
  /* ASCII 0   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
39
  /* ASCII 1   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
40
  /* ASCII 2   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
41
  /* ASCII 3   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
42
  /* ASCII 4   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
43
  /* ASCII 5   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
44
  /* ASCII 6   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
45
  /* ASCII 7   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
46
  /* ASCII 8   */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
47
  /* ASCII 9   */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
48
  /* ASCII 10  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
49
  /* ASCII 11  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
50
  /* ASCII 12  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
51
  /* ASCII 13  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
52
  /* ASCII 14  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
53
  /* ASCII 15  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
54
  /* ASCII 16  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
55
  /* ASCII 17  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
56
  /* ASCII 18  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
57
  /* ASCII 19  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
58
  /* ASCII 20  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
59
  /* ASCII 21  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
60
  /* ASCII 22  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
61
  /* ASCII 23  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
62
  /* ASCII 24  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
63
  /* ASCII 25  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
64
  /* ASCII 26  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
65
  /* ASCII 27  */  0x1f,0xe0,0x10,0x20,0x10,0x20,0x10,0x20,0x10,0x20,0x1f,0xe0,0x00,0x00,
66
  /* ASCII 28  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
67
  /* ASCII 29  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
68
  /* ASCII 30  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
69
  /* ASCII 31  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
70
  /* ASCII 32  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
71
  /* ASCII 33  */  0x00,0x00,0x00,0x00,0x00,0x00,0x13,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,
72
  /* ASCII 34  */  0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,0x00,0xe0,0x00,0x20,0x00,0x00,
73
  /* ASCII 35  */  0x00,0x00,0x35,0x00,0x0f,0x80,0x35,0x60,0x0f,0x80,0x05,0x60,0x00,0x00,
74
  /* ASCII 36  */  0x00,0x00,0x0d,0x80,0x0a,0x40,0x3a,0x60,0x06,0x40,0x00,0x00,0x00,0x00,
75
  /* ASCII 37  */  0x00,0x00,0x02,0x40,0x02,0xa0,0x0a,0x40,0x15,0x00,0x09,0x00,0x00,0x00,
76
  /* ASCII 38  */  0x00,0x00,0x0c,0x00,0x13,0x00,0x14,0x80,0x08,0x80,0x14,0x00,0x00,0x00,
77
  /* ASCII 39  */  0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,
78
  /* ASCII 40  */  0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x80,0x60,0x60,0x00,0x00,0x00,0x00,
79
  /* ASCII 41  */  0x00,0x00,0x00,0x00,0x60,0x60,0x1f,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
80
  /* ASCII 42  */  0x00,0x00,0x00,0x40,0x03,0x40,0x00,0xe0,0x03,0x40,0x00,0x40,0x00,0x00,
81
  /* ASCII 43  */  0x02,0x00,0x02,0x00,0x02,0x00,0x1f,0xc0,0x02,0x00,0x02,0x00,0x02,0x00,
82
  /* ASCII 44  */  0x00,0x00,0x00,0x00,0x60,0x00,0x38,0x00,0x08,0x00,0x00,0x00,0x00,0x00,
83
  /* ASCII 45  */  0x00,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,
84
  /* ASCII 46  */  0x00,0x00,0x00,0x00,0x18,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
85
  /* ASCII 47  */  0x00,0x00,0x20,0x00,0x18,0x00,0x06,0x00,0x01,0x80,0x00,0x60,0x00,0x00,
86
  /* ASCII 48  */  0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00,
87
  /* ASCII 49  */  0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00,
88
  /* ASCII 50  */  0x00,0x00,0x18,0x40,0x14,0x20,0x12,0x20,0x11,0x20,0x18,0xc0,0x00,0x00,
89
  /* ASCII 51  */  0x00,0x00,0x08,0x40,0x10,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,
90
  /* ASCII 52  */  0x00,0x00,0x06,0x00,0x05,0x00,0x04,0xc0,0x14,0x20,0x1f,0xe0,0x14,0x00,
91
  /* ASCII 53  */  0x00,0x00,0x08,0x00,0x11,0xe0,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00,
92
  /* ASCII 54  */  0x00,0x00,0x0f,0x80,0x11,0x40,0x11,0x20,0x11,0x20,0x0e,0x20,0x00,0x00,
93
  /* ASCII 55  */  0x00,0x00,0x00,0x60,0x00,0x20,0x18,0x20,0x07,0x20,0x00,0xe0,0x00,0x00,
94
  /* ASCII 56  */  0x00,0x00,0x0e,0xc0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,
95
  /* ASCII 57  */  0x00,0x00,0x11,0xc0,0x12,0x20,0x12,0x20,0x0a,0x20,0x07,0xc0,0x00,0x00,
96
  /* ASCII 58  */  0x00,0x00,0x00,0x00,0x19,0x80,0x19,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
97
  /* ASCII 59  */  0x00,0x00,0x00,0x00,0x30,0x00,0x19,0x80,0x09,0x80,0x00,0x00,0x00,0x00,
98
  /* ASCII 60  */  0x02,0x00,0x05,0x00,0x05,0x00,0x08,0x80,0x10,0x40,0x10,0x40,0x00,0x00,
99
  /* ASCII 61  */  0x00,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x05,0x00,0x00,0x00,
100
  /* ASCII 62  */  0x10,0x40,0x10,0x40,0x08,0x80,0x05,0x00,0x05,0x00,0x02,0x00,0x00,0x00,
101
  /* ASCII 63  */  0x00,0x00,0x00,0x00,0x10,0x80,0x14,0x40,0x02,0x40,0x01,0x80,0x00,0x00,
102
  /* ASCII 64  */  0x00,0x00,0x1f,0xe0,0x20,0x10,0x23,0x10,0x24,0x90,0x17,0xe0,0x00,0x00,
103
  /* ASCII 65  */  0x10,0x00,0x1c,0x00,0x17,0xa0,0x04,0x60,0x17,0x80,0x1c,0x00,0x10,0x00,
104
  /* ASCII 66  */  0x10,0x20,0x1f,0xe0,0x11,0x20,0x11,0x20,0x11,0x20,0x0e,0xc0,0x00,0x00,
105
  /* ASCII 67  */  0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x08,0x60,0x00,0x00,
106
  /* ASCII 68  */  0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x08,0x40,0x07,0x80,0x00,0x00,
107
  /* ASCII 69  */  0x10,0x20,0x1f,0xe0,0x11,0x20,0x13,0xa0,0x10,0x20,0x18,0x60,0x00,0x00,
108
  /* ASCII 70  */  0x00,0x00,0x10,0x20,0x1f,0xe0,0x11,0x20,0x03,0xa0,0x00,0x20,0x00,0x60,
109
  /* ASCII 71  */  0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x12,0x20,0x0e,0x60,0x02,0x00,
110
  /* ASCII 72  */  0x10,0x20,0x1f,0xe0,0x11,0x20,0x01,0x00,0x11,0x20,0x1f,0xe0,0x10,0x20,
111
  /* ASCII 73  */  0x00,0x00,0x10,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x20,0x00,0x00,
112
  /* ASCII 74  */  0x00,0x00,0x0e,0x00,0x10,0x20,0x10,0x20,0x0f,0xe0,0x00,0x20,0x00,0x00,
113
  /* ASCII 75  */  0x10,0x20,0x1f,0xe0,0x12,0x20,0x03,0x00,0x04,0xa0,0x18,0x60,0x10,0x20,
114
  /* ASCII 76  */  0x00,0x00,0x10,0x20,0x1f,0xe0,0x10,0x20,0x10,0x00,0x1c,0x00,0x00,0x00,
115
  /* ASCII 77  */  0x10,0x20,0x1f,0xe0,0x10,0xe0,0x03,0x00,0x10,0xe0,0x1f,0xe0,0x10,0x20,
116
  /* ASCII 78  */  0x10,0x20,0x1f,0xe0,0x10,0xe0,0x07,0x00,0x18,0x20,0x1f,0xe0,0x00,0x20,
117
  /* ASCII 79  */  0x00,0x00,0x0f,0xc0,0x10,0x20,0x10,0x20,0x10,0x20,0x0f,0xc0,0x00,0x00,
118
  /* ASCII 80  */  0x00,0x00,0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x01,0xc0,0x00,0x00,
119
  /* ASCII 81  */  0x00,0x00,0x0f,0xc0,0x10,0x20,0x30,0x20,0x30,0x20,0x2f,0xc0,0x00,0x00,
120
  /* ASCII 82  */  0x10,0x20,0x1f,0xe0,0x12,0x20,0x02,0x20,0x06,0x20,0x09,0xc0,0x10,0x00,
121
  /* ASCII 83  */  0x00,0x00,0x18,0xc0,0x09,0x20,0x11,0x20,0x11,0x40,0x0e,0x60,0x00,0x00,
122
  /* ASCII 84  */  0x00,0x60,0x00,0x20,0x10,0x20,0x1f,0xe0,0x10,0x20,0x00,0x20,0x00,0x60,
123
  /* ASCII 85  */  0x00,0x20,0x0f,0xe0,0x10,0x20,0x10,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20,
124
  /* ASCII 86  */  0x00,0x20,0x00,0xe0,0x07,0x20,0x18,0x00,0x07,0x20,0x00,0xe0,0x00,0x20,
125
  /* ASCII 87  */  0x00,0x20,0x0f,0xe0,0x10,0x20,0x0f,0x00,0x10,0x20,0x0f,0xe0,0x00,0x20,
126
  /* ASCII 88  */  0x10,0x20,0x18,0x60,0x04,0x80,0x03,0x00,0x04,0x80,0x18,0x60,0x10,0x20,
127
  /* ASCII 89  */  0x00,0x20,0x00,0x60,0x11,0xa0,0x1e,0x00,0x11,0xa0,0x00,0x60,0x00,0x20,
128
  /* ASCII 90  */  0x00,0x00,0x18,0x60,0x14,0x20,0x13,0x20,0x10,0xa0,0x18,0x60,0x00,0x00,
129
  /* ASCII 91  */  0x00,0x00,0x00,0x00,0x7f,0xe0,0x40,0x20,0x40,0x20,0x00,0x00,0x00,0x00,
130
  /* ASCII 92  */  0x00,0x00,0x00,0x20,0x01,0xc0,0x06,0x00,0x38,0x00,0x00,0x00,0x00,0x00,
131
  /* ASCII 93  */  0x00,0x00,0x00,0x00,0x40,0x20,0x40,0x20,0x7f,0xe0,0x00,0x00,0x00,0x00,
132
  /* ASCII 94  */  0x00,0x00,0x01,0x00,0x00,0x80,0x00,0x60,0x00,0x80,0x01,0x00,0x00,0x00,
133
  /* ASCII 95  */  0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
134
  /* ASCII 96  */  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x00,0x00,0x00,
135
  /* ASCII 97  */  0x00,0x00,0x0d,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x1f,0x00,0x10,0x00,
136
  /* ASCII 98  */  0x10,0x20,0x1f,0xe0,0x11,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,
137
  /* ASCII 99  */  0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x09,0x80,0x00,0x00,
138
  /* ASCII 100 */  0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x11,0x20,0x1f,0xe0,0x10,0x00,
139
  /* ASCII 101 */  0x00,0x00,0x0f,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x13,0x00,0x00,0x00,
140
  /* ASCII 102 */  0x00,0x00,0x10,0x80,0x1f,0xc0,0x10,0xa0,0x10,0xa0,0x10,0xa0,0x00,0x00,
141
  /* ASCII 103 */  0x00,0x00,0x0f,0x00,0x50,0x80,0x50,0x80,0x51,0x00,0x3f,0x80,0x00,0x80,
142
  /* ASCII 104 */  0x10,0x20,0x1f,0xe0,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00,
143
  /* ASCII 105 */  0x00,0x00,0x10,0x80,0x10,0x80,0x1f,0xa0,0x10,0x00,0x10,0x00,0x00,0x00,
144
  /* ASCII 106 */  0x00,0x00,0x40,0x80,0x40,0x80,0x40,0xa0,0x3f,0x80,0x00,0x00,0x00,0x00,
145
  /* ASCII 107 */  0x10,0x20,0x1f,0xe0,0x02,0x00,0x16,0x80,0x19,0x80,0x10,0x80,0x00,0x00,
146
  /* ASCII 108 */  0x00,0x00,0x10,0x00,0x10,0x20,0x1f,0xe0,0x10,0x00,0x10,0x00,0x00,0x00,
147
  /* ASCII 109 */  0x10,0x80,0x1f,0x80,0x10,0x80,0x1f,0x00,0x10,0x80,0x1f,0x00,0x10,0x00,
148
  /* ASCII 110 */  0x10,0x80,0x1f,0x80,0x11,0x00,0x00,0x80,0x10,0x80,0x1f,0x00,0x10,0x00,
149
  /* ASCII 111 */  0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,
150
  /* ASCII 112 */  0x40,0x80,0x7f,0x80,0x51,0x00,0x10,0x80,0x10,0x80,0x0f,0x00,0x00,0x00,
151
  /* ASCII 113 */  0x00,0x00,0x0f,0x00,0x10,0x80,0x10,0x80,0x51,0x00,0x7f,0x80,0x40,0x80,
152
  /* ASCII 114 */  0x00,0x00,0x10,0x80,0x1f,0x80,0x11,0x00,0x10,0x80,0x10,0x80,0x00,0x00,
153
  /* ASCII 115 */  0x00,0x00,0x19,0x00,0x12,0x80,0x12,0x80,0x12,0x80,0x0d,0x80,0x00,0x00,
154
  /* ASCII 116 */  0x00,0x00,0x00,0x80,0x0f,0xc0,0x10,0x80,0x10,0x80,0x10,0x80,0x08,0x00,
155
  /* ASCII 117 */  0x00,0x80,0x0f,0x80,0x10,0x00,0x10,0x00,0x08,0x80,0x1f,0x80,0x10,0x00,
156
  /* ASCII 118 */  0x00,0x80,0x03,0x80,0x0c,0x80,0x10,0x00,0x0c,0x80,0x03,0x80,0x00,0x80,
157
  /* ASCII 119 */  0x00,0x80,0x0f,0x80,0x10,0x80,0x0e,0x00,0x10,0x80,0x0f,0x80,0x00,0x80,
158
  /* ASCII 120 */  0x10,0x80,0x19,0x80,0x06,0x00,0x06,0x00,0x19,0x80,0x10,0x80,0x00,0x00,
159
  /* ASCII 121 */  0x00,0x80,0x41,0x80,0x46,0x80,0x78,0x00,0x4c,0x80,0x03,0x80,0x00,0x80,
160
  /* ASCII 122 */  0x00,0x00,0x19,0x80,0x14,0x80,0x12,0x80,0x11,0x80,0x18,0x80,0x00,0x00,
161
  /* ASCII 123 */  0x00,0x00,0x00,0x00,0x04,0x00,0x3b,0xc0,0x40,0x20,0x00,0x00,0x00,0x00,
162
  /* ASCII 124 */  0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,
163
  /* ASCII 125 */  0x00,0x00,0x00,0x00,0x40,0x20,0x3b,0xc0,0x04,0x00,0x00,0x00,0x00,0x00,
164
  /* ASCII 126 */  0x00,0x00,0x04,0x00,0x02,0x00,0x04,0x00,0x04,0x00,0x02,0x00,0x00,0x00};
165
 
166
/* Private function prototypes -----------------------------------------------*/
167
/* Private functions ---------------------------------------------------------*/
168
 
169
/*******************************************************************************
170
* Function Name  : LCD_DataLinesConfig
171
* Description    : Configure data lines D0~D7 (P2.10~P2.17) in Input Floating mode
172
*                  for read from LCD or in Output Push-Pull mode for write on LCD
173
* Input          : - Mode: specifies the configuration mode for data lines D0~D7
174
*                       - Input: configure in Input Floating mode
175
*                       - Output: configure in Output Push-Pul mode
176
* Output         : None
177
* Return         : None
178
*******************************************************************************/
179
void LCD_DataLinesConfig(DataConfigMode_TypeDef Mode)
180
{
181
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 |
182
                                GPIO_Pin_14 | GPIO_Pin_15 | GPIO_Pin_16 | GPIO_Pin_17;
183
  if (Mode == Input)
184
  {
185
    /* Configure D0~D7 lines (P2.10~2.17) in Input Floating mode */
186
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
187
  }
188
  else
189
  {
190
    /* Configure D0~D7 lines (P2.10~2.17) in Output Push-Pull mode */
191
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
192
  }
193
  GPIO_Init(GPIO2, &GPIO_InitStructure);
194
}
195
 
196
/*******************************************************************************
197
* Function Name  : LCD_DataLinesWrite
198
* Description    : Write a value on D0~D7 (P2.10~P2.17)
199
* Input          : - GPIOx: GPIO port to write on. It could be
200
*                  - PortVal: value to write
201
* Output         : None
202
* Return         : None.
203
*******************************************************************************/
204
void LCD_DataLinesWrite(GPIO_TypeDef* GPIOx, u32 PortVal)
205
{
206
  u32 Tmp = 0;
207
 
208
  /* Store the PM register value */
209
  Tmp = GPIO_GetPortMask(GPIOx);
210
  /* Mask the corresponding GPIO pins */
211
  GPIO_PinMaskConfig(GPIOx, LCD_GPIO_Pins, DISABLE);
212
  GPIO_PinMaskConfig(GPIOx, ~LCD_GPIO_Pins, ENABLE);
213
  /* Write in the hole register */
214
  GPIO_Write(GPIOx, (PortVal<<10));
215
 
216
  GPIO_PinMaskConfig(GPIOx, ~LCD_GPIO_Pins, DISABLE);
217
  /* Return the initial PM register value */
218
  GPIO_PinMaskConfig(GPIOx, Tmp, ENABLE);
219
 
220
}
221
 
222
/*******************************************************************************
223
* Function Name  : LCD_CtrlLinesConfig
224
* Description    : Configure control lines E2, E1, RW, DI (P2.0~P2.3) in
225
*                  Output Push-Pull mode.
226
* Input          : None
227
* Output         : None
228
* Return         : None
229
*******************************************************************************/
230
void LCD_CtrlLinesConfig(void)
231
{
232
  /* Configure E2, E1, RW, DI lines (P2.0~2.3) in Output Push-Pull mode */
233
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;
234
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
235
  GPIO_Init(GPIO2, &GPIO_InitStructure);
236
}
237
 
238
/*******************************************************************************
239
* Function Name  : LCD_CtrlLinesWrite
240
* Description    : Set or reset control lines E2, E1, RW, DI (P2.0~P2.3).
241
* Input          : - GPIOx: where x can be 0,1 or 2 to select the GPIO peripheral.
242
*                  - CtrlPins: the Control line. This parameter can be:
243
*                       - CtrlPin_E2: Enabe clock signal for Slave
244
*                       - CtrlPin_E1: Enabe clock signal for Master
245
*                       - CtrlPin_RW: Read/Write control line
246
*                       - CtrlPin_DI:
247
* Output         : None
248
* Return         : None
249
*******************************************************************************/
250
void LCD_CtrlLinesWrite(GPIO_TypeDef* GPIOx, u32 CtrlPins, BitAction BitVal)
251
{
252
  /* Set or Reset the control line */
253
  if(BitVal != Bit_RESET)
254
  {
255
    GPIOx->PD |= CtrlPins;
256
  }
257
  else
258
  {
259
    GPIOx->PD &= ~CtrlPins;
260
  }
261
}
262
 
263
/*******************************************************************************
264
* Function Name  : LCD_CheckMasterStatus
265
* Description    : Check whether master LCD is busy or not
266
* Input          : None
267
* Output         : None
268
* Return         : None
269
*******************************************************************************/
270
void LCD_CheckMasterStatus(void)
271
{
272
  u8 MasterStatus = 0;
273
 
274
  /* Configure Data lines as Input */
275
  LCD_DataLinesConfig(Input);
276
  /* Start the master read sequence */
277
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);   /* E1 = 0 */
278
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET);     /* RW = 1 */
279
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET);   /* DI = 0 */
280
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET);     /* E1 = 1 */
281
  MasterStatus = GPIO_Read(GPIO2);
282
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);   /* E1 = 0 */
283
 
284
  /* Wait until BF is cleared: D7 line */
285
  while ((MasterStatus & 0x20000))
286
  {
287
    LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET);   /* E1 = 1 */
288
    MasterStatus = GPIO_Read(GPIO2);
289
    LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET); /* E1 = 0 */
290
  }
291
}
292
 
293
/*******************************************************************************
294
* Function Name  : LCD_CheckSlaveStatus
295
* Description    : Check whether slave LCD is busy or not
296
* Input          : None
297
* Output         : None
298
* Return         : None
299
*******************************************************************************/
300
void LCD_CheckSlaveStatus(void)
301
{
302
  u8 SlaveStatus = 0;
303
 
304
  /* Configure Data lines as Input */
305
  LCD_DataLinesConfig(Input);
306
  /* Start the slave read sequence */
307
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);   /* E2 = 0 */
308
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET);     /* RW = 1 */
309
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET);   /* DI = 0 */
310
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET);     /* E2 = 1 */
311
  SlaveStatus = GPIO_Read(GPIO2);
312
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);   /* E2 = 0 */
313
 
314
  /* Wait until BF is cleared: D7 line */
315
  while ((SlaveStatus & 0x20000))
316
  {
317
    LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET);   /* E2 = 1 */
318
    SlaveStatus = GPIO_Read(GPIO2);
319
    LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET); /* E2 = 0 */
320
  }
321
}
322
 
323
/*******************************************************************************
324
* Function Name  : LCD_SendMasterCmd
325
* Description    : Send one byte command to master LCD.
326
* Input          : - Cmd: the user expected command to send to master LCD
327
* Output         : None
328
* Return         : None
329
*******************************************************************************/
330
void LCD_SendMasterCmd(u8 Cmd)
331
{
332
  /* Check the master status */
333
  LCD_CheckMasterStatus();
334
  /* Configure Data lines as Output */
335
  LCD_DataLinesConfig(Output);
336
  /* Start the master send command sequence */
337
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);  /* E1 = 0 */
338
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET);  /* RW = 0 */
339
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET);  /* DI = 0 */
340
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET);    /* E1 = 1 */
341
  /* Write master command */
342
  LCD_DataLinesWrite(GPIO2, (u32)Cmd);
343
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);  /* E1 = 0 */
344
}
345
 
346
/*******************************************************************************
347
* Function Name  : LCD_SendSlaveCmd
348
* Description    : Send one byte command to slave LCD
349
* Input          : - Cmd: the user expected command to send to slave LCD.
350
* Output         : None
351
* Return         : None
352
*******************************************************************************/
353
void LCD_SendSlaveCmd(u8 Cmd)
354
{
355
  /* Check the slave status */
356
  LCD_CheckSlaveStatus();
357
  /* Configure Data lines as Output */
358
  LCD_DataLinesConfig(Output);
359
  /* Start the slave send command sequence */
360
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);  /* E2 = 0 */
361
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET);  /* RW = 0 */
362
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_RESET);  /* DI = 0 */
363
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET);    /* E2 = 1 */
364
  /* Write slave command */
365
  LCD_DataLinesWrite(GPIO2, (u32)Cmd);
366
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);  /* E2 = 0 */
367
}
368
 
369
/*******************************************************************************
370
* Function Name  : LCD_SendMasterData
371
* Description    : Display one byte data to master LCD.
372
* Input          : - Data: the user expected data to display on master LCD.
373
* Output         : None
374
* Return         : None
375
*******************************************************************************/
376
void LCD_SendMasterData(u8 Data)
377
{
378
  /* Check the master status */
379
  LCD_CheckMasterStatus();
380
  /* Configure Data lines as Output */
381
  LCD_DataLinesConfig(Output);
382
  /* Start the master send data sequence */
383
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);  /* E1 = 0 */
384
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET);  /* RW = 0 */
385
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET);    /* DI = 1 */
386
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET);    /* E1 = 1 */
387
  /* Write data to the master */
388
  LCD_DataLinesWrite(GPIO2, (u32)Data);
389
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);  /* E1 = 0 */
390
}
391
 
392
/*******************************************************************************
393
* Function Name  : LCD_ReadMasterData
394
* Description    : Read master byte data displayed on master LCD.
395
* Input          : None
396
* Output         : None
397
* Return         : None
398
*******************************************************************************/
399
u32 LCD_ReadMasterData(void)
400
{
401
  u32 MasterData = 0;
402
 
403
  /* Check the master status */
404
  LCD_CheckMasterStatus();
405
  /* Configure Data lines as Input */
406
  LCD_DataLinesConfig(Input);
407
  /* Start the master read data sequence */
408
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);  /* E1 = 0 */
409
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET);    /* RW = 1 */
410
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET);    /* DI = 1 */
411
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_SET);    /* E1 = 1 */
412
  /* Read data from the master */
413
  MasterData = ((GPIO_Read(GPIO2)&0x3FC00)>>10);
414
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E1, Bit_RESET);  /* E1 = 0 */
415
  /* Read the master returned data */
416
  return MasterData;
417
}
418
 
419
/*******************************************************************************
420
* Function Name  : LCD_SendSlaveData
421
* Description    : Display one byte data to slave LCD.
422
* Input          : - Data: the user expected data to display on slave LCD.
423
* Output         : None
424
* Return         : None
425
*******************************************************************************/
426
void LCD_SendSlaveData(u8 Data)
427
{
428
  /* Check the slave status */
429
  LCD_CheckSlaveStatus();
430
  /* Configure Data lines as Output */
431
  LCD_DataLinesConfig(Output);
432
  /* Start the slave send data sequence */
433
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);  /* E2 = 0 */
434
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_RESET);  /* RW = 0 */
435
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET);    /* DI = 1 */
436
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET);    /* E2 = 1 */
437
  /* Write data to the slave */
438
  LCD_DataLinesWrite(GPIO2, (u32)Data);
439
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);  /* E2 = 0 */
440
}
441
 
442
/*******************************************************************************
443
* Function Name  : LCD_ReadSlaveData
444
* Description    : Read slave byte data displayed on slave LCD.
445
* Input          : None
446
* Output         : None
447
* Return         : None
448
*******************************************************************************/
449
u32 LCD_ReadSlaveData(void)
450
{
451
  u32 SlaveData = 0;
452
 
453
  /* Check the slave status */
454
  LCD_CheckSlaveStatus();
455
  /* Configure Data lines as Input */
456
  LCD_DataLinesConfig(Input);
457
  /* Start the slave read data sequence */
458
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);  /* E2 = 0 */
459
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_RW, Bit_SET);    /* RW = 1 */
460
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_DI, Bit_SET);    /* DI = 1 */
461
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_SET);    /* E2 = 1 */
462
  /* Read data from the slave */
463
  SlaveData = ((GPIO_Read(GPIO2)&0x3FC00)>>10);
464
  LCD_CtrlLinesWrite(GPIO2, CtrlPin_E2, Bit_RESET);  /* E2 = 0 */
465
  /* Read the slave returned data */
466
  return SlaveData;
467
}
468
 
469
/*******************************************************************************
470
* Function Name  : LCD_Init
471
* Description    : Initialize master and slave LCD.
472
* Input          : None
473
* Output         : None
474
* Return         : None
475
*******************************************************************************/
476
void LCD_Init(void)
477
{
478
  /* Enable GPIO Clock */
479
  MRCC_PeripheralClockConfig(MRCC_Peripheral_GPIO, ENABLE);
480
 
481
  /* Configure control lines signals as output mode */
482
  LCD_CtrlLinesConfig();
483
 
484
  /* Master LCD Init */
485
  LCD_SendMasterCmd(SOFTWARE_RESET);
486
  LCD_SendMasterCmd(DISPLAY_OFF);
487
  LCD_SendMasterCmd(DYNAMIC_DRIVE);
488
  LCD_SendMasterCmd(DUTY_CYCLE);
489
  LCD_SendMasterCmd(CLOCKWISE_OUTPUT);
490
  LCD_SendMasterCmd(READ_MODIFY_WRITE_OFF);
491
  LCD_SendMasterCmd(START_COLUMN);          /* Set master column address to 0 */
492
  LCD_SendMasterCmd(START_LINE);            /* Set master display start line to 0 */
493
  LCD_SendMasterCmd(DISPLAY_ON );
494
 
495
  /* Slave LCD Init */
496
  LCD_SendSlaveCmd(SOFTWARE_RESET);
497
  LCD_SendSlaveCmd(DISPLAY_OFF);
498
  LCD_SendSlaveCmd(DYNAMIC_DRIVE);
499
  LCD_SendSlaveCmd(DUTY_CYCLE);
500
  LCD_SendSlaveCmd(CLOCKWISE_OUTPUT);
501
  LCD_SendSlaveCmd(READ_MODIFY_WRITE_OFF);
502
  LCD_SendSlaveCmd(START_COLUMN );          /* Set slave column address to 0 */
503
  LCD_SendSlaveCmd(START_LINE);             /* Set slave display start line to 0 */
504
  LCD_SendSlaveCmd(DISPLAY_ON);
505
 
506
  /* Clear LCD */
507
  LCD_Clear();
508
  /* Set current Page to 0 for Master and Slave LCDs */
509
  LCD_SetSlavePage(0);
510
  LCD_SetMasterPage(0);
511
}
512
 
513
/*******************************************************************************
514
* Function Name  : LCD_SetSlavePage
515
* Description    : Set the display page of slave LCD, the page range is 0 to 3,
516
*                  make sure the input will not exceed this range ,otherwise it
517
*                  will reach a undecided result.
518
* Input          : - Page: specifies the expected display page of slave LCD
519
* Output         : None
520
* Return         : None
521
*******************************************************************************/
522
void LCD_SetSlavePage(u8 Page)
523
{
524
  /* Set Slave page */
525
  LCD_SendSlaveCmd(0xB8|Page);
526
}
527
 
528
/*******************************************************************************
529
* Function Name  : LCD_SetMasterPage
530
* Description    : Set the display page of master LCD, the page range is 0 to 3,
531
*                  make sure the input will not exceed this range ,otherwise it
532
*                  will reach a undecided result.
533
* Input          : - Page: specifies the expected display page of master LCD
534
* Output         : None
535
* Return         : None
536
*******************************************************************************/
537
void LCD_SetMasterPage(u8 Page)
538
{
539
  /* Set Master page */
540
  LCD_SendMasterCmd(0xB8|Page);
541
}
542
 
543
/*******************************************************************************
544
* Function Name  : SetAddress
545
* Description    : Set the display column of slave LCD. Column range is 0 to 61.
546
* Input          : - Address: specifies the expected display column of slave LCD
547
* Output         : None
548
* Return         : None
549
*******************************************************************************/
550
void LCD_SetSlaveColumn(u8 Address)
551
{
552
  /* Set Slave column address */
553
  LCD_SendSlaveCmd(Address&0x7F);
554
}
555
 
556
/*******************************************************************************
557
* Function Name  : LCD_SetMasterColumn
558
* Description    : Set the display column of master LCD. Column range is 0 to 61.
559
* Input          : - Address: specifies the expected display column of slave LCD
560
* Output         : None
561
* Return         : None
562
*******************************************************************************/
563
void LCD_SetMasterColumn(u8 Address)
564
{
565
  /* Set Master column address */
566
  LCD_SendMasterCmd(Address&0x7F);
567
}
568
 
569
/*******************************************************************************
570
* Function Name  : LCD_SetTextColor
571
* Description    : Set the text color for LCD.
572
* Input          : - TextColor: BlackText: character on black, bottom on white.
573
*                               WhiteText: character on white, bottom on black.
574
* Output         : None
575
* Return         : None
576
*******************************************************************************/
577
void LCD_SetTextColor(TextColorMode_TypeDef TextColor)
578
{
579
  if(TextColor)
580
  {
581
    /* Set White Text color */
582
    TextMode=WhiteText;
583
  }
584
  else
585
  {
586
    /* Set Black Text color */
587
    TextMode=BlackText;
588
  }
589
}
590
 
591
/*******************************************************************************
592
* Function Name  : LCD_Clear
593
* Description    : Clear the Master and Slave LCDs display.
594
* Input          : None
595
* Output         : None
596
* Return         : None
597
*******************************************************************************/
598
void LCD_Clear(void)
599
{
600
  u8 Page = 0, Column = 0;
601
 
602
  /* Clear master and slave LCDs page by page */
603
  for (Page=0; Page<4; Page++)
604
  {
605
    /* Set master and slave page by page */
606
    LCD_SetMasterPage(Page);
607
    LCD_SetSlavePage(Page);
608
    /* Set master and slave column address */
609
    LCD_SetMasterColumn(0);
610
    LCD_SetSlaveColumn(0);
611
    /* Send empty data to master and slave column address on the selected page */
612
    for (Column=0; Column<61; Column++)
613
    {
614
      LCD_SendSlaveData(0);
615
      LCD_SendMasterData(0);
616
    }
617
  }
618
}
619
 
620
/*******************************************************************************
621
* Function Name  : LCD_ClearLine
622
* Description    : Clear the selected line of the LCD.
623
* Input          : - Line: the Line to clear.
624
*                      - Line1 (Page0&1): clear the first line
625
*                      - Line2 (Page2&3): clear the second line
626
* Output         : None
627
* Return         : None
628
*******************************************************************************/
629
void LCD_ClearLine(u8 Line)
630
{
631
  u8 Page = 0, Column = 0;
632
 
633
  /* Clear the slected master and slave line */
634
  for (Page=Line; Page<Line+2; Page++)
635
  {
636
    /* Set master and slave page by page */
637
    LCD_SetMasterPage(Page);
638
    LCD_SetSlavePage(Page);
639
    /* Set master and slave column address */
640
    LCD_SetMasterColumn(0);
641
    LCD_SetSlaveColumn(0);
642
    /* Send empty data to master and slave column address on the selected page */
643
    for (Column=0; Column<61; Column++)
644
    {
645
      LCD_SendSlaveData(0);
646
      LCD_SendMasterData(0);
647
    }
648
  }
649
}
650
 
651
/*******************************************************************************
652
* Function Name  : LCD_ClearMaster
653
* Description    : Clear the master LCD.
654
* Input          : None
655
* Output         : None
656
* Return         : None
657
*******************************************************************************/
658
void LCD_ClearMaster(void)
659
{
660
  u8 Page = 0, Column = 0;
661
 
662
  /* Clear all master LCD pages */
663
  for (Page=0; Page<4; Page++)
664
  {
665
    /* Set master page by page */
666
    LCD_SetMasterPage(Page);
667
    /* Set master column address */
668
    LCD_SetMasterColumn(0);
669
    /* Send empty data to master column address on the selected page */
670
    for (Column=0; Column<61; Column++)
671
    {
672
      LCD_SendMasterData(0);
673
    }
674
  }
675
}
676
 
677
/*******************************************************************************
678
* Function Name  : LCD_ClearSlave
679
* Description    : Clear the slave LCD.
680
* Input          : None
681
* Output         : None
682
* Return         : None
683
*******************************************************************************/
684
void LCD_ClearSlave()
685
{
686
  u8 Page = 0, Column = 0;
687
 
688
  /* Clear all slave LCD pages */
689
  for (Page=0; Page<4; Page++)
690
  {
691
    /* Set slave page by page */
692
    LCD_SetSlavePage(Page);
693
    /* Set slave column address */
694
    LCD_SetSlaveColumn(0);
695
    /* Send empty data to slave column address on the selected page */
696
    for (Column=0; Column<61; Column++)
697
    {
698
      LCD_SendSlaveData(0);
699
    }
700
  }
701
}
702
 
703
/*******************************************************************************
704
* Function Name  : LCD_DrawChar
705
* Description    : Draw a character in LCD.
706
*                  Note:
707
*                  the LCD can only display two line character,so page 0 and 1
708
*                  is to display the first line, page2 and page 3 is to display
709
*                  the second line.
710
* Input          : - Line: the Line where to display the character shape .
711
*                      - Line1 (Page0&1): display character on the first line
712
*                      - Line2 (Page2&3): display character on the second line
713
*                  - Column: start column address.
714
*                  - Width: the number of column (dots) of a character width.
715
*                  - Bmp: the pointer of the dot matrix data.
716
* Output         : None
717
* Return         : None
718
*******************************************************************************/
719
void LCD_DrawChar(u8 Line, u8 Column, u8 Width, u8 *Bmp)
720
{
721
  u8 X = 0, ActualColumn = 0, Window = 0, i = 0;
722
 
723
  /* Draw the character column by column: width times */
724
  for(X = Column; X<(Column+Width); X++)
725
  {
726
    if(X > 121)
727
    {
728
      /* Return if column exceeded 121 */
729
      return;
730
    }
731
    if (X > 60)
732
    {
733
      /* To be displayed on slave LCD (Window = 1) */
734
      Window = 1;
735
      /* Get the Slave relative start column */
736
      ActualColumn = X%61;
737
    }
738
    else
739
    {
740
      /* To be displayed on master LCD (Window = 0) */
741
      ActualColumn = X;
742
    }
743
 
744
    /* Switch window, display the character upper part */
745
    if (Window)
746
    {
747
      /* Display it on slave LCD */
748
      LCD_SetSlavePage(Line);
749
      LCD_SetSlaveColumn(ActualColumn);
750
      LCD_SendSlaveData(Bmp[i]);
751
    }
752
    else
753
    {
754
      /* Display it on master LCD */
755
      LCD_SetMasterPage(Line);
756
      LCD_SetMasterColumn(ActualColumn);
757
      LCD_SendMasterData(Bmp[i]);
758
    }
759
    /* Switch window, diplay the character lower part  */
760
    if (Window)
761
    {
762
      /* Display it on slave LCD */
763
      LCD_SetSlavePage(Line+1);
764
      LCD_SetSlaveColumn(ActualColumn);
765
      LCD_SendSlaveData(Bmp[i+1]);
766
    }
767
    else
768
    {
769
      /* Display it on master LCD */
770
      LCD_SetMasterPage(Line+1);
771
      LCD_SetMasterColumn(ActualColumn);
772
      LCD_SendMasterData(Bmp[i+1]);
773
    }
774
    /* Increment by 2 the character table index */
775
    i+=2;
776
  }
777
}
778
 
779
/*******************************************************************************
780
* Function Name  : LCD_DisplayChar
781
* Description    : Display one character (7dots large, 16dots high).
782
*                  Note:
783
*                  the LCD can only display two line character,so page 0 and 1
784
*                  is to display the first line, page2 and page 3 is to display
785
*                  the second line.
786
* Input          : - Line: the Line where to display the character.
787
*                      - Line1 (Page0&1): display character on the first line
788
*                      - Line2 (Page2&3): display character on the second line
789
*                  - Column: start column address.
790
*                  - Ascii: character ascii code.
791
*                  - CharMode: BlackText: character on black, bottom on white.
792
*                              WhiteText: character on white, bottom on black.
793
* Output         : None
794
* Return         : None
795
*******************************************************************************/
796
void LCD_DisplayChar(u8 Line, u8 Column, u8 Ascii, TextColorMode_TypeDef CharMode)
797
{
798
  u8  DotBuffer[14], i = 0;
799
 
800
  /* Display the character lower and upper 8bit parts (2*7columns) */
801
  for (i=0;i<14;i++)
802
  {
803
    /* Character displayed as white Text on black buttom  */
804
    if(CharMode)
805
    {
806
      if(i%2==0)
807
      {
808
        DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i+1];
809
      }
810
      else
811
      {
812
        DotBuffer[i] = ~AsciiDotsTable[Ascii*14+i-1];
813
      }
814
    }
815
    /* Character displayed as black Text on white buttom  */
816
    else
817
    {
818
      if(i%2==0)
819
      {
820
        DotBuffer[i] = AsciiDotsTable[Ascii*14+i+1];
821
      }
822
      else
823
      {
824
        DotBuffer[i] = AsciiDotsTable[Ascii*14+i-1];
825
      }
826
    }
827
  }
828
  /* Display the asc code after conversion */
829
  LCD_DrawChar(Line, Column, 7, DotBuffer);
830
}
831
 
832
/*******************************************************************************
833
* Function Name  : LCD_HexToAsciiLow
834
* Description    : This function is used to convert the low nibble of an
835
*                  unsigned byte (0-F hex) to ASCII.
836
* Input          : - byte: byte to convert to ASCII.
837
* Output         : None
838
* Return         : ASCII value result of the conversion.
839
*******************************************************************************/
840
u8 LCD_HexToAsciiLow(u8 byte)
841
{
842
  /* Keep lower nibble only */
843
  byte = byte & 0x0F;
844
  /* If the ascii is a number */
845
  if (byte <= 0x09)
846
  {
847
    /* Add 0x30 to its ascii */
848
    return(byte + 0x30);
849
  }
850
  else
851
  {
852
    /* Add 0x37 to its ascii */
853
    return (byte + 0x37);
854
  }
855
}
856
 
857
/*******************************************************************************
858
* Function Name  : LCD_HexToAsciiHigh
859
* Description    : This function is used to convert the high nibble of an
860
*                  unsigned byte (0-F hex) to ASCII.
861
* Input          : - byte: byte to convert to ASCII.
862
* Output         : None
863
* Return         : ASCII value result of the conversion.
864
*******************************************************************************/
865
u8 LCD_HexToAsciiHigh(u8 byte)
866
{
867
  /* Keep upper nibble only */
868
  byte = byte & 0xF0;
869
  byte = byte >> 4;
870
  /* If the ascii is a number */
871
  if (byte <= 0x09)
872
  {
873
    /* Add 0x30 to display its ascii */
874
    return(byte + 0x30);
875
  }
876
  else
877
  {
878
    /* Add 0x37 to display its ascii */
879
    return (byte + 0x37);
880
  }
881
}
882
 
883
/*******************************************************************************
884
* Function Name  : LCD_DisplayString
885
* Description    : This function is used to display a 17char max string of
886
*                  characters on the LCD display on the selected line.
887
*                  Note:
888
*                  this function is the user interface to use the LCD driver.
889
* Input          : - *ptr: pointer to string to display on LCD.
890
*                  - Line: the Line where to display the character.
891
*                      - Line1 (Page0&1): display character on the first line
892
*                      - Line2 (Page2&3): display character on the second line
893
* Output         : None
894
* Return         : None
895
*******************************************************************************/
896
void LCD_DisplayString(u8 Line, u8 *ptr, TextColorMode_TypeDef CharMode)
897
{
898
  u8 RefColumn = 0, i = 0;
899
 
900
  /* Send the string character by character on lCD */
901
  while ((*ptr!=0)&(i<17))
902
  {
903
    /* Display one character on LCD */
904
    LCD_DisplayChar(Line, RefColumn, *ptr, CharMode);
905
    /* Increment the column position by 7 */
906
    RefColumn+=7;
907
    /* Point on the next character */
908
    ptr++;
909
    /* Increment the character counter */
910
    i++;
911
    /* If we reach the maximum Line character */
912
    if(i==17)
913
    {
914
      LCD_DisplayChar(Line, RefColumn-1, 0x1f, CharMode); /* Add missed columns */
915
    }
916
  }
917
}
918
 
919
/*******************************************************************************
920
* Function Name  : LCD_Printf
921
* Description    : This function is used to display a string of characters
922
*                  on the LCD display.
923
*                  Note:
924
*                  this function is the user interface to use the LCD driver.
925
* Input          : - *ptr: pointer to string to display on LCD.
926
* Output         : None
927
* Return         : None
928
*******************************************************************************/
929
void LCD_Printf(u8 *ptr, ...)
930
{
931
  u8 RefColumn = 0, RefPage = 0, i = 0, c1 = 0;
932
  u16  var = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0;
933
  u32 WordVar = 0;
934
 
935
  /* Store pointer on LCD_Printf second parameter (String) */
936
  u8 *var_ptr=(u8 *)(&ptr+1);
937
 
938
  /* Send String */
939
  while (*ptr != 0)
940
  {
941
    c1 = *ptr;
942
    /* Limited to AsciiDotsTable code table */
943
    if(c1 <= 128)
944
    {
945
      /* Carriage return */
946
      if ( *ptr == '\r')
947
      {
948
        ptr++;
949
        RefColumn = 0;
950
      }
951
      /* Jump to Line2 */
952
      else if( *ptr == '\n')
953
      {
954
        /* Point on the string to display */
955
        ptr++;
956
        /* Clear Line2 */
957
        LCD_ClearLine(Line2);
958
        /* Point on first Line2 column */
959
        RefColumn = 0;
960
        /* Increment RefPage by 2 */
961
        RefPage+=2;
962
      }
963
      /* Display value on the passed format */
964
      else if( *ptr == '%')
965
      {
966
        ptr++;
967
        /* Display decimal value */
968
        if (*ptr == 'd')
969
        {
970
          ptr++;
971
          /* Get the word value to display */
972
          WordVar = ((*var_ptr)|(*(var_ptr+1)<<8)|(*(var_ptr+2)<<16));
973
          c1=WordVar/10000;
974
          c2=(WordVar%10000)/1000;
975
          c3=(WordVar%1000)/100;
976
          c4=(WordVar%100)/10;
977
          c5=(WordVar%10);
978
          /* Display the ten miles digit */
979
          if (c1!=0)
980
          {
981
            LCD_DisplayChar(RefPage, RefColumn, c1+0x30, TextMode);
982
            RefColumn+=7;
983
          }
984
          /* Display the miles digit */
985
          if (!((c1==0)&(c2==0)))
986
          {
987
          LCD_DisplayChar(RefPage, RefColumn, c2+0x30, TextMode);
988
          RefColumn+=7;
989
          }
990
          /* Display the hundred digit */
991
          if (!((c1==0)&(c2==0)&(c3==0)))
992
          {
993
          LCD_DisplayChar(RefPage, RefColumn, c3+0x30, TextMode);
994
          RefColumn+=7;
995
          }
996
          /* Display the tens digit */
997
          if (!((c1==0)&(c2==0)&(c3==0)&(c4==0)))
998
          {
999
          LCD_DisplayChar(RefPage, RefColumn, c4+0x30, TextMode);
1000
          RefColumn+=7;
1001
          }
1002
          /* Display the rest */
1003
          LCD_DisplayChar(RefPage, RefColumn, c5+0x30, TextMode);
1004
          RefColumn+=7;
1005
        }
1006
        /* Display 16bits Hex value */
1007
        else if (*ptr == 'x')
1008
        {
1009
          ptr++;
1010
          /* Display 8bits MSB */
1011
          var_ptr = var_ptr +1;
1012
          var = *var_ptr;
1013
          c1 = LCD_HexToAsciiHigh(var);
1014
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1015
          RefColumn+=7;
1016
          c1 = LCD_HexToAsciiLow(var);
1017
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1018
          RefColumn+=7;
1019
          /* Display 8bits LSB */
1020
          var_ptr = var_ptr -1;
1021
          var = *var_ptr;
1022
          var_ptr = var_ptr +4;
1023
          c1 = LCD_HexToAsciiHigh(var);
1024
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1025
          RefColumn+=7;
1026
          c1 = LCD_HexToAsciiLow(var);
1027
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1028
          RefColumn+=7;
1029
        }
1030
        /* Display 32bits Hex value */
1031
        else if (*ptr == 'w')
1032
        {
1033
          ptr++;
1034
          /* Display 16bits MSB */
1035
          var_ptr = var_ptr +3;
1036
          var = *var_ptr;
1037
          c1 = LCD_HexToAsciiHigh(var);
1038
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1039
          RefColumn+=7;
1040
          c1 = LCD_HexToAsciiLow(var);
1041
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1042
          RefColumn+=7;
1043
          var_ptr = var_ptr -1;
1044
          var = *var_ptr;
1045
          c1 = LCD_HexToAsciiHigh(var);
1046
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1047
          RefColumn+=7;
1048
          c1 = LCD_HexToAsciiLow(var);
1049
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1050
          RefColumn+=7;
1051
          /* Display 16bits LSB */
1052
          var_ptr = var_ptr -1;
1053
          var = *var_ptr;
1054
          var_ptr = var_ptr +4;
1055
          c1 = LCD_HexToAsciiHigh(var);
1056
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1057
          RefColumn+=7;
1058
          c1 = LCD_HexToAsciiLow(var);
1059
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1060
          RefColumn+=7;
1061
          var_ptr = var_ptr -5;
1062
          var = *var_ptr;
1063
          var_ptr = var_ptr +4;
1064
          c1 = LCD_HexToAsciiHigh(var);
1065
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1066
          RefColumn+=7;
1067
          c1 = LCD_HexToAsciiLow(var);
1068
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1069
          RefColumn+=7;
1070
        }
1071
        else
1072
        {
1073
          /* Display '%' character which is followed by (d, x or w) */
1074
          ptr--;
1075
          c1 = *ptr;
1076
          LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1077
          RefColumn+=7;
1078
          ptr++;
1079
          i++;
1080
          if(i==17)
1081
          {
1082
            /* Add missed columns */
1083
            LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode);
1084
            RefColumn = 0;
1085
            RefPage+=2;
1086
          }
1087
        }
1088
      }
1089
      else
1090
      {
1091
        /* Display characters different from (\r, \n, %) */
1092
        LCD_DisplayChar(RefPage, RefColumn, c1, TextMode);
1093
        RefColumn+=7;
1094
        ptr++;
1095
        i++;
1096
        if(i==17)
1097
        {
1098
          /* Add missed columns */
1099
          LCD_DisplayChar(RefPage, RefColumn-1, 0x1f, TextMode);
1100
          LCD_ClearLine(Line2);
1101
          RefColumn = 0;
1102
          RefPage+=2;
1103
        }
1104
      }
1105
    }
1106
  }
1107
  /* Display spaces if string doesn't reach the max LCD characters size */
1108
  while(RefColumn<119)
1109
  {
1110
    /* Display Spaces */
1111
    LCD_DisplayChar(RefPage, RefColumn, 0x20, TextMode);
1112
    RefColumn+=7;
1113
    /* Add missed columns */
1114
    LCD_DisplayChar(RefPage, RefColumn, 0x1f, TextMode);
1115
  }
1116
}
1117
 
1118
/*******************************************************************************
1119
* Function Name  : LCD_DrawMasterGraphic
1120
* Description    : Draw a Graphic image on master LCD.
1121
* Input          : - Bmp: the pointer of the dot matrix data.
1122
* Output         : None
1123
* Return         : None.
1124
*******************************************************************************/
1125
void LCD_DrawMasterGraphic(u8 *Bmp)
1126
{
1127
  u8 j = 0, k = 0, ActPage = 0;
1128
 
1129
  /* Draw graphic on master: 61 Column *4 Pages */
1130
  while(j<244)
1131
  {
1132
    /* Draw on master page by page */
1133
    LCD_SetMasterPage(ActPage);
1134
    for(k=0; k<61; k++)
1135
    {
1136
      LCD_SetMasterColumn(k);
1137
      LCD_SendMasterData(*Bmp++);
1138
      j++;
1139
    }
1140
    ActPage++;
1141
  }
1142
}
1143
 
1144
/*******************************************************************************
1145
* Function Name  : LCD_DrawSlaveGraphic
1146
* Description    : Draw a Graphic image on slave LCD.
1147
* Input          : - Bmp: the pointer of the dot matrix data.
1148
* Output         : None
1149
* Return         : None.
1150
*******************************************************************************/
1151
void LCD_DrawSlaveGraphic(u8 *Bmp)
1152
{
1153
  u8 j = 0, k = 0, ActPage = 0;
1154
 
1155
  /* Draw graphic on slave: 61 Column *4 Pages */
1156
  while(j<244)
1157
  {
1158
    /* Draw on slave page by page */
1159
    LCD_SetSlavePage(ActPage);
1160
    for(k=0; k<61; k++)
1161
    {
1162
      LCD_SetSlaveColumn(k);
1163
      LCD_SendSlaveData(*Bmp++);
1164
      j++;
1165
    }
1166
    ActPage++;
1167
  }
1168
}
1169
 
1170
/*******************************************************************************
1171
* Function Name  : LCD_DrawGraphic
1172
* Description    : Draw a Graphic image on LCD.
1173
* Input          : - Bmp: the pointer of the dot matrix data.
1174
* Output         : None
1175
* Return         : None.
1176
*******************************************************************************/
1177
void LCD_DrawGraphic(u8 *Bmp)
1178
{
1179
  u8 Pos = 0, ActPage = 0;
1180
  u16 j = 0, k = 0;
1181
 
1182
  /* Draw graphic on LCD: 122 Column *4 Pages */
1183
  while(j<488)
1184
  {
1185
    if(!Pos)
1186
    {
1187
      /* Draw on master page by page */
1188
      LCD_SetMasterPage(ActPage);
1189
      for(k=0; k<61; k++)
1190
      {
1191
        LCD_SetMasterColumn(k);
1192
        LCD_SendMasterData(*Bmp++);
1193
        j++;
1194
      }
1195
      Pos=1;
1196
    }
1197
    else
1198
    {
1199
      /* Draw on slave page by page */
1200
      LCD_SetSlavePage(ActPage);
1201
      for(k=0; k<61; k++)
1202
      {
1203
        LCD_SetSlaveColumn(k);
1204
        LCD_SendSlaveData(*Bmp++);
1205
        j++;
1206
      }
1207
      ActPage++;
1208
      Pos=0;
1209
    }
1210
  }
1211
}
1212
 
1213
/*******************************************************************************
1214
* Function Name  : LCD_ScrollGraphic
1215
* Description    : Scroll a Graphic image on LCD.
1216
* Input          : - Bmp: the pointer of the dot matrix data.
1217
*                  - nCount: specifies the delay time length.
1218
* Output         : None
1219
* Return         : None.
1220
*******************************************************************************/
1221
void LCD_ScrollGraphic(u8 *Bmp, u32 nCount)
1222
{
1223
  u8 Pos = 0, ActPage = 0;
1224
  u16 j = 0, k = 0;
1225
  u32 Counter = 0;
1226
 
1227
  /* Draw graphic on LCD: 122 Column *4 Pages */
1228
  while(j<488)
1229
  {
1230
    if(!Pos)
1231
    {
1232
      /* Draw on master page by page */
1233
      LCD_SetMasterPage(ActPage);
1234
      for(k=0; k<61; k++)
1235
      {
1236
        LCD_SetMasterColumn(k);
1237
        LCD_SendMasterData(*Bmp++);
1238
        Counter = nCount;
1239
        /* Set a delay */
1240
        for(; Counter != 0; Counter--);
1241
        j++;
1242
      }
1243
      Pos=1;
1244
    }
1245
    else
1246
    {
1247
      /* Draw on slave page by page */
1248
      LCD_SetSlavePage(ActPage);
1249
      for(k=0; k<61; k++)
1250
      {
1251
        LCD_SetSlaveColumn(k);
1252
        Counter = nCount;
1253
        /* Set a delay */
1254
        for(; Counter != 0; Counter--);
1255
        LCD_SendSlaveData(*Bmp++);
1256
        j++;
1257
      }
1258
      ActPage++;
1259
      Pos=0;
1260
    }
1261
  }
1262
}
1263
 
1264
/*******************************************************************************
1265
* Function Name  : LCD_DrawPixel
1266
* Description    : Draw a Graphic image on slave LCD.
1267
* Input          : - XPos: the dot line number of the pixel.
1268
*                      - 1->61 : displayed on master LCD
1269
*                      - 62->122: displayed on slave LCD
1270
*                  - YPos: column address of the pixel from 1->32.
1271
*                  - Mode: Dot_On: Pixel turned on (black).
1272
*                          Dot_Off: Pixel turned off (black).
1273
* Output         : None
1274
* Return         : None.
1275
*******************************************************************************/
1276
void LCD_DrawPixel(u8 XPos, u8 YPos, DotMode_TypeDef Mode)
1277
{
1278
  u8 Page = 0, Position = 0;
1279
  u16 Mask = 0;
1280
  u32 MasterDataIn = 0, MasterDataOut = 0, SlaveDataIn = 0, SlaveDataOut = 0;
1281
 
1282
  /* Pixel page */
1283
  Page = (XPos-1)/8;
1284
  /* Pixel column  */
1285
  Position = (YPos-1)/61; /* 0:Master, 1:Slave */
1286
  /* Mask for the pixel */
1287
  Mask= 1<<((XPos-1)%8);
1288
  /* If Position=0 draw pixel on master LCD */
1289
  if(!Position)
1290
  {
1291
    LCD_SetMasterPage(Page);
1292
    LCD_SetMasterColumn(YPos-1);
1293
    MasterDataIn = LCD_ReadMasterData();
1294
    MasterDataIn = LCD_ReadMasterData();
1295
    LCD_SetMasterColumn(YPos-1);
1296
    if(Mode==Dot_On)
1297
    {
1298
      MasterDataOut = MasterDataIn | Mask;
1299
    }
1300
    else
1301
    {
1302
      MasterDataOut = MasterDataIn & (~Mask);
1303
    }
1304
    LCD_SendMasterData(MasterDataOut);
1305
  }
1306
  /* If Position=1 draw pixel on slave LCD */
1307
  else
1308
  {
1309
    LCD_SetSlavePage(Page);
1310
    LCD_SetSlaveColumn(YPos-62);
1311
    SlaveDataIn = LCD_ReadSlaveData();
1312
    SlaveDataIn = LCD_ReadSlaveData();
1313
    LCD_SetSlaveColumn(YPos-62);
1314
    if(Mode==Dot_On)
1315
    {
1316
      SlaveDataOut = SlaveDataIn | Mask;
1317
    }
1318
    else
1319
    {
1320
      SlaveDataOut = SlaveDataIn & (~Mask);
1321
    }
1322
    LCD_SendSlaveData(SlaveDataOut);
1323
  }
1324
}
1325
 
1326
/*******************************************************************************
1327
* Function Name  : LCD_DrawLine
1328
* Description    : Draw a line on master and slave LCDs.
1329
* Input          : - XPos1: the dot line number of the source point .
1330
*                  - XPos2: the dot line number of the destination point .
1331
*                  - YPos1: the dot column number of the source point.
1332
*                  - YPos2: the dot column number of the destination point.
1333
* Output         : None
1334
* Return         : None.
1335
*******************************************************************************/
1336
void LCD_DrawLine(u8 XPos1, u8 YPos1, u8 XPos2, u8 YPos2)
1337
{
1338
  u8 XPos = 0, YPos = 0;
1339
 
1340
  /* Use XPos1, YPos1, XPos2 and YPos2 */
1341
  if((XPos2>=XPos1)&(YPos2>=YPos1))
1342
  {
1343
    for(XPos=XPos1; XPos<=XPos2; XPos++)
1344
    {
1345
      for(YPos=YPos1; YPos<=YPos2; YPos++)
1346
      {
1347
        LCD_DrawPixel(XPos, YPos, Dot_On);
1348
      }
1349
    }
1350
  }
1351
  else if((XPos2<XPos1)&(YPos2>=YPos1))
1352
  {
1353
    for(XPos=XPos2; XPos<=XPos1; XPos++)
1354
    {
1355
      for(YPos=YPos1; YPos<=YPos2; YPos++)
1356
      {
1357
        LCD_DrawPixel(XPos, YPos, Dot_On);
1358
      }
1359
    }
1360
  }
1361
  else if((XPos2>=XPos1)&(YPos2<YPos1))
1362
  {
1363
    for(XPos=XPos1; XPos<=XPos2; XPos++)
1364
    {
1365
      for(YPos=YPos2; YPos<=YPos1; YPos++)
1366
      {
1367
        LCD_DrawPixel(XPos, YPos, Dot_On);
1368
      }
1369
    }
1370
  }
1371
  else /*if((XPos2<XPos1)&(YPos2<YPos1))*/
1372
  {
1373
    for(XPos=XPos2; XPos<=XPos1; XPos++)
1374
    {
1375
      for(YPos=YPos2; YPos<=YPos1; YPos++)
1376
      {
1377
        LCD_DrawPixel(XPos, YPos, Dot_On);
1378
      }
1379
    }
1380
  }
1381
}
1382
 
1383
/*******************************************************************************
1384
* Function Name  : LCD_DrawBox
1385
* Description    : Draw a Box on master and slave LCDs.
1386
* Input          : - XPos: the dot line number of the source point .
1387
*                  - YPos: the dot column number of the source point.
1388
*                  - Dx: Box large.
1389
*                  - Dy: Box width.
1390
* Output         : None
1391
* Return         : None.
1392
*******************************************************************************/
1393
void LCD_DrawBox(u8 XPos, u8 YPos, u8 Dx, u8 Dy)
1394
{
1395
  /* Use XPos, YPos, Dx and Dy */
1396
  LCD_DrawLine(XPos, YPos, XPos, YPos+Dy);
1397
  LCD_DrawLine(XPos, YPos, XPos+Dx, YPos);
1398
  LCD_DrawLine(XPos+Dx, YPos, XPos+Dx, YPos+Dy);
1399
  LCD_DrawLine(XPos, YPos+Dy, XPos+Dx, YPos+Dy);
1400
}
1401
 
1402
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE******/
1403
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.