]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR_ARM/inc/lcd_pmod.h
Remove compiler warnings from auto-generated code.
[freertos] / FreeRTOS / Demo / CORTEX_R4F_RZ_T_GCC_IAR_ARM / inc / lcd_pmod.h
1 /***********************************************************************************************************************\r
2 * DISCLAIMER\r
3 * This software is supplied by Renesas Electronics Corporation and is only\r
4 * intended for use with Renesas products. No other uses are authorized. This\r
5 * software is owned by Renesas Electronics Corporation and is protected under\r
6 * all applicable laws, including copyright laws.\r
7 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING\r
8 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT\r
9 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE\r
10 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.\r
11 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS\r
12 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE\r
13 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR\r
14 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE\r
15 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
16 * Renesas reserves the right, without notice, to make changes to this software\r
17 * and to discontinue the availability of this software. By using this software,\r
18 * you agree to the additional terms and conditions found by accessing the\r
19 * following link:\r
20 * http://www.renesas.com/disclaimer\r
21 *\r
22 * Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved.\r
23 ***********************************************************************************************************************/\r
24 /***********************************************************************************************************************\r
25 * File Name     : lcd_pmod.h\r
26 * Device(s)     : RZ/T1 (R7S910017)\r
27 * Tool-Chain    : GNUARM-NONEv14.02-EABI\r
28 * H/W Platform  : RSK+RZT1 CPU Board\r
29 *\r
30 * Description   : This Header file contains the Macro Definitions & prototypes\r
31 *                 for the functions used in lcd.c\r
32 *\r
33 *                 This function is created to drive the Okaya LCD display with\r
34 *                 either ST7735 or ST7715 driver device. The commands for both\r
35 *                 the devices are the same.\r
36 *\r
37 *                 The display is controlled using the SPI bus. In this example,\r
38 *                 the SCI5 is used. This can be modified to the SCI connected to\r
39 *                 the PMOD interface. The SCI driver file will also be required.\r
40 *\r
41 *                 The display memory has an offset with respect to the actual\r
42 *                 pixel. This is not documented but realised from driving the\r
43 *                 display. The offset is set as LEFT MARGIN and TOP MARGIN.\r
44 *                 This offset is catered for internally, so as far as the user\r
45 *                 is concerned, cursor position 0,0 is the top left pixel.\r
46\r
47 *                 The simplest procedure to run the display is as follows:\r
48 *                 Init_LCD(); Initialise the serial port and set up the display.\r
49 *\r
50 *                 Clear the display.\r
51 *                 The font colour is set to white and background colour to black.\r
52 *\r
53 *                 DisplaySetFontColour(COL_YELLOW);\r
54 *                                    set the font colour to desired colour\r
55 *                 DisplaySetBackColour(COL_BLUE);\r
56 *                                    set the background colour to desired value\r
57 *                 DisplayCenter(1,"Renesas");\r
58 *                                    write a title on line 1 of the display.\r
59 *\r
60 *                Note: Line 0 is the top line.\r
61 ***********************************************************************************************************************/\r
62 /***********************************************************************************************************************\r
63 * History       : DD.MM.YYYY Version Description\r
64 *               : 21.04.2015 1.00\r
65 ***********************************************************************************************************************/\r
66 \r
67 /***********************************************************************************************************************\r
68 User Includes (Project Level Includes)\r
69 ***********************************************************************************************************************/\r
70 /* Defines standard variable types used in this file */\r
71 #include <stdint.h>\r
72 #include "iodefine.h"\r
73 \r
74 /***********************************************************************************************************************\r
75 Macro Definitions\r
76 ***********************************************************************************************************************/\r
77 /* Multiple inclusion prevention macro */\r
78 #ifndef LCD_PMOD_H\r
79 #define LCD_PMOD_H\r
80 \r
81 \r
82 /***********************************************************************************************************************\r
83 Macro Definitions for Okaya display on PMOD connector\r
84 ***********************************************************************************************************************/\r
85 \r
86 \r
87 /***********************************************************************************************************************\r
88 *  SCREEN\r
89 *\r
90 *  The screen size is 128 x 128 pixels, with coordinate 0,0 at the top left.\r
91 *  The display controller is ST7735 or ST7715.\r
92 *\r
93 ***********************************************************************************************************************/\r
94 /* 16 lines @ 8 bits = 128. */\r
95 #define SCREEN_HEIGHT             (128)            \r
96 #define SCREEN_WIDTH              (128)\r
97 \r
98 #ifndef USE_PMOD2\r
99 /* DATA/COMMAND select pin */\r
100 #define DATA_CMD_PIN              (PORT7.PODR.BIT.B6)\r
101 /* Backlight enable pin */\r
102 #define BL_ENABLE_PIN             (PORT7.PODR.BIT.B4)  \r
103 /* Reset pin */\r
104 #define RESET_PIN                 (PORT6.PODR.BIT.B7)\r
105 #else\r
106 /* DATA/COMMAND select pin */\r
107 #define DATA_CMD_PIN              (PORTM.PODR.BIT.B2)\r
108 /* Backlight enable pin */\r
109 #define BL_ENABLE_PIN             (PORTM.PODR.BIT.B3) \r
110 /* Reset pin */\r
111 #define RESET_PIN                 (PORT5.PODR.BIT.B1)\r
112 #endif\r
113 \r
114 /* Automatic calculation of parameters */\r
115 \r
116  /* including a space */\r
117 #define FONT_WIDTH                (6u)\r
118 /* including 1 pixel space */\r
119 #define FONT_HEIGHT               (8u)\r
120 #define MAX_LINES                 (SCREEN_HEIGHT / FONT_HEIGHT)\r
121 #define CHAR_PER_LINE             (SCREEN_WIDTH / FONT_WIDTH)\r
122 \r
123 /* Allow 2 pixel margin on the left and the top */\r
124 #define LEFT_MARGIN               (2u)\r
125 #define TOP_MARGIN                (3u)\r
126 #define CR                        (0x0d)\r
127 #define LF                        (0x0a)\r
128 #define BS                        (0x08)\r
129 \r
130 \r
131 /***********************************************************************************************************************\r
132 *  DISPLAY COLOUR DEFINITIONS (16 bits) R5G6B5 format\r
133 *\r
134 *  Only Primary & secondary colours are defined here. Other colours can be\r
135 *  created using RGB values.\r
136 ***********************************************************************************************************************/\r
137 #define COL_BLACK       (0x0000)\r
138 #define COL_RED         (0xF800)\r
139 #define COL_GREEN       (0x07E0)\r
140 #define COL_BLUE        (0x001F)\r
141 #define COL_YELLOW      (0xFFE0)\r
142 #define COL_CYAN        (0x07FF)\r
143 #define COL_MAGENTA     (0xF81F)\r
144 #define COL_WHITE       (0xFFFF)\r
145 \r
146 /***********************************************************************************************************************\r
147 \r
148   DISPLAY COMMAND SET ST7735\r
149 \r
150 ***********************************************************************************************************************/\r
151 #define ST7735_NOP      (0x0)\r
152 #define ST7735_SWRESET  (0x01)\r
153 #define ST7735_SLPIN    (0x10)\r
154 #define ST7735_SLPOUT   (0x11)\r
155 #define ST7735_PTLON    (0x12)\r
156 #define ST7735_NORON    (0x13)\r
157 #define ST7735_INVOFF   (0x20)\r
158 #define ST7735_INVON    (0x21)\r
159 #define ST7735_DISPOFF  (0x28)\r
160 #define ST7735_DISPON   (0x29)\r
161 #define ST7735_CASET    (0x2A)\r
162 #define ST7735_RASET    (0x2B)\r
163 #define ST7735_RAMWR    (0x2C)\r
164 #define ST7735_COLMOD   (0x3A)\r
165 #define ST7735_MADCTL   (0x36)\r
166 #define ST7735_FRMCTR1  (0xB1)\r
167 #define ST7735_INVCTR   (0xB4)\r
168 #define ST7735_DISSET5  (0xB6)\r
169 #define ST7735_PWCTR1   (0xC0)\r
170 #define ST7735_PWCTR2   (0xC1)\r
171 #define ST7735_PWCTR3   (0xC2)\r
172 #define ST7735_VMCTR1   (0xC5)\r
173 #define ST7735_PWCTR6   (0xFC)\r
174 #define ST7735_GMCTRP1  (0xE0)\r
175 #define ST7735_GMCTRN1  (0xE1)\r
176 \r
177 /* delay for delay counter */\r
178 #define DELAY_TIMING    (0x08)\r
179 \r
180 /***********************************************************************************************************************\r
181 * Function Prototypes\r
182 ***********************************************************************************************************************/\r
183 /* Initialises the debug LCD */\r
184 void lcd_init (void);\r
185 \r
186 /* Display string at specific line of display */\r
187 void display_lcd (uint8_t const line, uint8_t const column, uint8_t const * string);\r
188 \r
189 /* Display the string at current cursor position */\r
190 void display_str (uint8_t const * str);\r
191 \r
192 /* Display the sting at the centre of the specified line */\r
193 void display_center (uint8_t const line_num, uint8_t * const str);\r
194 \r
195 /* Clears the display */\r
196 void clear_display (uint16_t colour);\r
197 \r
198 /* Clear a specified line */\r
199 void display_clear_line(uint8_t line_num);\r
200 \r
201 /* Set the current cursor position */\r
202 void display_set_cursor (uint8_t const x, uint8_t const y);\r
203 \r
204 /* Delay function */\r
205 void display_delay_us (uint32_t time_us);\r
206 void display_delay_ms (uint32_t time_ms);\r
207 \r
208 /* Set Font colour */\r
209 void display_set_font_colour (uint16_t const col);\r
210 \r
211 /* Set Background colour */\r
212 void display_set_back_colour (uint16_t const col);\r
213 \r
214 /* Simple image blit */\r
215 void display_image (uint8_t *image, uint8_t image_width,\r
216                                  uint8_t image_height, uint8_t loc_x, uint8_t loc_y);\r
217 \r
218 /* Enable display */\r
219 void display_on (void);\r
220 \r
221 /* Disable display */\r
222 void display_off (void);\r
223 \r
224 \r
225 /* LCD_PMOD_H */\r
226 #endif\r
227 \r