]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/System/GCC/inc/lcd_pmod.h
FreeRTOS source:
[freertos] / FreeRTOS / Demo / CORTEX_R4F_RZ_T_GCC_IAR / System / GCC / inc / lcd_pmod.h
diff --git a/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/System/GCC/inc/lcd_pmod.h b/FreeRTOS/Demo/CORTEX_R4F_RZ_T_GCC_IAR/System/GCC/inc/lcd_pmod.h
new file mode 100644 (file)
index 0000000..7dc1aad
--- /dev/null
@@ -0,0 +1,227 @@
+/***********************************************************************************************************************\r
+* DISCLAIMER\r
+* This software is supplied by Renesas Electronics Corporation and is only\r
+* intended for use with Renesas products. No other uses are authorized. This\r
+* software is owned by Renesas Electronics Corporation and is protected under\r
+* all applicable laws, including copyright laws.\r
+* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING\r
+* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT\r
+* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE\r
+* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.\r
+* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS\r
+* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE\r
+* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR\r
+* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE\r
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
+* Renesas reserves the right, without notice, to make changes to this software\r
+* and to discontinue the availability of this software. By using this software,\r
+* you agree to the additional terms and conditions found by accessing the\r
+* following link:\r
+* http://www.renesas.com/disclaimer\r
+*\r
+* Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved.\r
+***********************************************************************************************************************/\r
+/***********************************************************************************************************************\r
+* File Name     : lcd_pmod.h\r
+* Device(s)     : RZ/T1 (R7S910017)\r
+* Tool-Chain    : GNUARM-NONEv14.02-EABI\r
+* H/W Platform  : RSK+RZT1 CPU Board\r
+*\r
+* Description   : This Header file contains the Macro Definitions & prototypes\r
+*                 for the functions used in lcd.c\r
+*\r
+*                 This function is created to drive the Okaya LCD display with\r
+*                 either ST7735 or ST7715 driver device. The commands for both\r
+*                 the devices are the same.\r
+*\r
+*                 The display is controlled using the SPI bus. In this example,\r
+*                 the SCI5 is used. This can be modified to the SCI connected to\r
+*                 the PMOD interface. The SCI driver file will also be required.\r
+*\r
+*                 The display memory has an offset with respect to the actual\r
+*                 pixel. This is not documented but realised from driving the\r
+*                 display. The offset is set as LEFT MARGIN and TOP MARGIN.\r
+*                 This offset is catered for internally, so as far as the user\r
+*                 is concerned, cursor position 0,0 is the top left pixel.\r
+* \r
+*                 The simplest procedure to run the display is as follows:\r
+*                 Init_LCD(); Initialise the serial port and set up the display.\r
+*\r
+*                 Clear the display.\r
+*                 The font colour is set to white and background colour to black.\r
+*\r
+*                 DisplaySetFontColour(COL_YELLOW);\r
+*                                    set the font colour to desired colour\r
+*                 DisplaySetBackColour(COL_BLUE);\r
+*                                    set the background colour to desired value\r
+*                 DisplayCenter(1,"Renesas");\r
+*                                    write a title on line 1 of the display.\r
+*\r
+*                Note: Line 0 is the top line.\r
+***********************************************************************************************************************/\r
+/***********************************************************************************************************************\r
+* History       : DD.MM.YYYY Version Description\r
+*               : 21.04.2015 1.00\r
+***********************************************************************************************************************/\r
+\r
+/***********************************************************************************************************************\r
+User Includes (Project Level Includes)\r
+***********************************************************************************************************************/\r
+/* Defines standard variable types used in this file */\r
+#include <stdint.h>\r
+#include "iodefine.h"\r
+\r
+/***********************************************************************************************************************\r
+Macro Definitions\r
+***********************************************************************************************************************/\r
+/* Multiple inclusion prevention macro */\r
+#ifndef LCD_PMOD_H\r
+#define LCD_PMOD_H\r
+\r
+\r
+/***********************************************************************************************************************\r
+Macro Definitions for Okaya display on PMOD connector\r
+***********************************************************************************************************************/\r
+\r
+\r
+/***********************************************************************************************************************\r
+*  SCREEN\r
+*\r
+*  The screen size is 128 x 128 pixels, with coordinate 0,0 at the top left.\r
+*  The display controller is ST7735 or ST7715.\r
+*\r
+***********************************************************************************************************************/\r
+/* 16 lines @ 8 bits = 128. */\r
+#define SCREEN_HEIGHT             (128)            \r
+#define SCREEN_WIDTH              (128)\r
+\r
+#ifndef USE_PMOD2\r
+/* DATA/COMMAND select pin */\r
+#define DATA_CMD_PIN              (PORT7.PODR.BIT.B6)\r
+/* Backlight enable pin */\r
+#define BL_ENABLE_PIN             (PORT7.PODR.BIT.B4)  \r
+/* Reset pin */\r
+#define RESET_PIN                 (PORT6.PODR.BIT.B7)\r
+#else\r
+/* DATA/COMMAND select pin */\r
+#define DATA_CMD_PIN              (PORTM.PODR.BIT.B2)\r
+/* Backlight enable pin */\r
+#define BL_ENABLE_PIN             (PORTM.PODR.BIT.B3) \r
+/* Reset pin */\r
+#define RESET_PIN                 (PORT5.PODR.BIT.B1)\r
+#endif\r
+\r
+/* Automatic calculation of parameters */\r
+\r
+ /* including a space */\r
+#define FONT_WIDTH                (6u)\r
+/* including 1 pixel space */\r
+#define FONT_HEIGHT               (8u)\r
+#define MAX_LINES                 (SCREEN_HEIGHT / FONT_HEIGHT)\r
+#define CHAR_PER_LINE             (SCREEN_WIDTH / FONT_WIDTH)\r
+\r
+/* Allow 2 pixel margin on the left and the top */\r
+#define LEFT_MARGIN               (2u)\r
+#define TOP_MARGIN                (3u)\r
+#define CR                        (0x0d)\r
+#define LF                        (0x0a)\r
+#define BS                        (0x08)\r
+\r
+\r
+/***********************************************************************************************************************\r
+*  DISPLAY COLOUR DEFINITIONS (16 bits) R5G6B5 format\r
+*\r
+*  Only Primary & secondary colours are defined here. Other colours can be\r
+*  created using RGB values.\r
+***********************************************************************************************************************/\r
+#define COL_BLACK       (0x0000)\r
+#define COL_RED         (0xF800)\r
+#define COL_GREEN       (0x07E0)\r
+#define COL_BLUE        (0x001F)\r
+#define COL_YELLOW      (0xFFE0)\r
+#define COL_CYAN        (0x07FF)\r
+#define COL_MAGENTA     (0xF81F)\r
+#define COL_WHITE       (0xFFFF)\r
+\r
+/***********************************************************************************************************************\r
+\r
+  DISPLAY COMMAND SET ST7735\r
+\r
+***********************************************************************************************************************/\r
+#define ST7735_NOP      (0x0)\r
+#define ST7735_SWRESET  (0x01)\r
+#define ST7735_SLPIN    (0x10)\r
+#define ST7735_SLPOUT   (0x11)\r
+#define ST7735_PTLON    (0x12)\r
+#define ST7735_NORON    (0x13)\r
+#define ST7735_INVOFF   (0x20)\r
+#define ST7735_INVON    (0x21)\r
+#define ST7735_DISPOFF  (0x28)\r
+#define ST7735_DISPON   (0x29)\r
+#define ST7735_CASET    (0x2A)\r
+#define ST7735_RASET    (0x2B)\r
+#define ST7735_RAMWR    (0x2C)\r
+#define ST7735_COLMOD   (0x3A)\r
+#define ST7735_MADCTL   (0x36)\r
+#define ST7735_FRMCTR1  (0xB1)\r
+#define ST7735_INVCTR   (0xB4)\r
+#define ST7735_DISSET5  (0xB6)\r
+#define ST7735_PWCTR1   (0xC0)\r
+#define ST7735_PWCTR2   (0xC1)\r
+#define ST7735_PWCTR3   (0xC2)\r
+#define ST7735_VMCTR1   (0xC5)\r
+#define ST7735_PWCTR6   (0xFC)\r
+#define ST7735_GMCTRP1  (0xE0)\r
+#define ST7735_GMCTRN1  (0xE1)\r
+\r
+/* delay for delay counter */\r
+#define DELAY_TIMING    (0x08)\r
+\r
+/***********************************************************************************************************************\r
+* Function Prototypes\r
+***********************************************************************************************************************/\r
+/* Initialises the debug LCD */\r
+void lcd_init (void);\r
+\r
+/* Display string at specific line of display */\r
+void display_lcd (uint8_t const line, uint8_t const column, uint8_t const * string);\r
+\r
+/* Display the string at current cursor position */\r
+void display_str (uint8_t const * str);\r
+\r
+/* Display the sting at the centre of the specified line */\r
+void display_center (uint8_t const line_num, uint8_t * const str);\r
+\r
+/* Clears the display */\r
+void clear_display (uint16_t colour);\r
+\r
+/* Clear a specified line */\r
+void display_clear_line(uint8_t line_num);\r
+\r
+/* Set the current cursor position */\r
+void display_set_cursor (uint8_t const x, uint8_t const y);\r
+\r
+/* Delay function */\r
+void display_delay_us (uint32_t time_us);\r
+void display_delay_ms (uint32_t time_ms);\r
+\r
+/* Set Font colour */\r
+void display_set_font_colour (uint16_t const col);\r
+\r
+/* Set Background colour */\r
+void display_set_back_colour (uint16_t const col);\r
+\r
+/* Simple image blit */\r
+void display_image (uint8_t *image, uint8_t image_width,\r
+                                uint8_t image_height, uint8_t loc_x, uint8_t loc_y);\r
+\r
+/* Enable display */\r
+void display_on (void);\r
+\r
+/* Disable display */\r
+void display_off (void);\r
+\r
+\r
+/* LCD_PMOD_H */\r
+#endif\r
+\r