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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [ARM9_STR91X_IAR/] [STCode/] [lcd.c] - Blame information for rev 636

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

powered by: WebSVN 2.1.0

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