Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gr-peach-opencv-project-sd-card by
lcd_analog_rgb_ch1.c
00001 /******************************************************************************* 00002 * DISCLAIMER 00003 * This software is supplied by Renesas Electronics Corporation and is only 00004 * intended for use with Renesas products. No other uses are authorized. This 00005 * software is owned by Renesas Electronics Corporation and is protected under 00006 * all applicable laws, including copyright laws. 00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING 00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT 00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. 00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS 00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE 00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR 00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE 00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00016 * Renesas reserves the right, without notice, to make changes to this software 00017 * and to discontinue the availability of this software. By using this software, 00018 * you agree to the additional terms and conditions found by accessing the 00019 * following link: 00020 * http://www.renesas.com/disclaimer 00021 * Copyright (C) 2012 - 2015 Renesas Electronics Corporation. All rights reserved. 00022 *******************************************************************************/ 00023 /**************************************************************************//** 00024 * @file lcd_analog_rgb_ch1.c 00025 * @version 1.00 00026 * $Rev: 199 $ 00027 * $Date:: 2014-05-23 16:33:52 +0900#$ 00028 * @brief LCD panel for vdc5 channel 1 function 00029 ******************************************************************************/ 00030 00031 /****************************************************************************** 00032 Includes <System Includes> , "Project Includes" 00033 ******************************************************************************/ 00034 #include <string.h> 00035 00036 #include "r_typedefs.h" 00037 00038 #include "r_vdc5.h" 00039 00040 #include "iodefine.h" 00041 #include "lcd_panel.h" 00042 00043 #if (LCD_VDC5_CH1_PANEL==1) 00044 00045 /****************************************************************************** 00046 Macro definitions 00047 ******************************************************************************/ 00048 /* Port 4 */ 00049 #define LCD_PORT4_2ND (0x5400u) 00050 /* Port 9 */ 00051 #define LCD_PORT9_1ST (0x00FCu) 00052 /* Port 5 */ 00053 #define LCD_PORT5_7TH (0x0600u) 00054 #define LCD_PORT5_2ND (0x00FFu) 00055 /* Port 2 */ 00056 #define LCD_PORT2_7TH (0xF000u) 00057 #define LCD_PORT2_6TH (0x0F00u) 00058 00059 #define FH_1_2_CYCLE (2u) 00060 00061 /****************************************************************************** 00062 Typedef definitions 00063 ******************************************************************************/ 00064 00065 /****************************************************************************** 00066 Imported global variables and functions (from other files) 00067 ******************************************************************************/ 00068 00069 /****************************************************************************** 00070 Exported global variables (to be accessed by other files) 00071 ******************************************************************************/ 00072 00073 /****************************************************************************** 00074 Private global variables and functions 00075 ******************************************************************************/ 00076 00077 /**************************************************************************//** 00078 * @brief LCD panel I/O port setup (VDC5 channel 1) 00079 * @param[in] void 00080 * @retval None 00081 ******************************************************************************/ 00082 void GRAPHICS_SetLcdPanel_Ch1 (void) 00083 { 00084 volatile uint32_t dummy_read; 00085 uint32_t reg_data; 00086 00087 /* Analog RGB D-sub15 (RGB888) 00088 VSYNC : LCD1_TCON1 ... P4_14, 2nd alternative function 00089 : LCD1_CLK ... P4_12, 2nd alternative function 00090 HSYNC : LCD1_TCON5 ... P4_10, 2nd alternative function 00091 LCD1_DATA 00092 R[7:0] : LCD1_DATA[23:18] ... P9_7 ~ P9_2, 1st alternative function 00093 : [17:16] ... P5_10 ~ P5_9, 7th alternative function 00094 G[7:0] : LCD1_DATA[15:12] ... P2_15 ~ P2_12, 7th alternative function 00095 : [11:8] ... P2_11 ~ P2_8, 6th alternative function 00096 B[7:0] : LCD1_DATA[7:0] ... P5_7 ~ P5_0, 2nd alternative function 00097 */ 00098 /* Port 4 */ 00099 reg_data = (uint32_t)GPIO.PMC4 & (uint32_t)~LCD_PORT4_2ND; 00100 GPIO.PMC4 = (uint16_t)reg_data; 00101 reg_data = (uint32_t)GPIO.PMC4; 00102 dummy_read = reg_data; 00103 /* PFCAE4, PFCE4, PFC4 ... 2nd alternative function 00104 PIPC4, PMC4 00105 b14 : P4_14 00106 b12 : P4_12 00107 b10 : P4_10 */ 00108 reg_data = (uint32_t)GPIO.PFCAE4 & (uint32_t)~LCD_PORT4_2ND; 00109 GPIO.PFCAE4 = (uint16_t)reg_data; 00110 reg_data = (uint32_t)GPIO.PFCE4 & (uint32_t)~LCD_PORT4_2ND; 00111 GPIO.PFCE4 = (uint16_t)reg_data; 00112 reg_data = (uint32_t)GPIO.PFC4 | (uint32_t)LCD_PORT4_2ND; 00113 GPIO.PFC4 = (uint16_t)reg_data; 00114 reg_data = (uint32_t)GPIO.PIPC4 | (uint32_t)LCD_PORT4_2ND; 00115 GPIO.PIPC4 = (uint16_t)reg_data; 00116 reg_data = (uint32_t)GPIO.PMC4 | (uint32_t)LCD_PORT4_2ND; 00117 GPIO.PMC4 = (uint16_t)reg_data; 00118 00119 /* Port 9 */ 00120 reg_data = (uint32_t)GPIO.PMC9 & (uint32_t)~LCD_PORT9_1ST; 00121 GPIO.PMC9 = (uint16_t)reg_data; 00122 reg_data = (uint32_t)GPIO.PMC9; 00123 dummy_read = reg_data; 00124 /* PFCAE9, PFCE9, PFC9 ... 1st alternative function 00125 PIPC9, PMC9 00126 b7:b2 : P9_7 ~ P9_2 */ 00127 reg_data = (uint32_t)GPIO.PFCAE9 & (uint32_t)~LCD_PORT9_1ST; 00128 GPIO.PFCAE9 = (uint16_t)reg_data; 00129 reg_data = (uint32_t)GPIO.PFCE9 & (uint32_t)~LCD_PORT9_1ST; 00130 GPIO.PFCE9 = (uint16_t)reg_data; 00131 reg_data = (uint32_t)GPIO.PFC9 & (uint32_t)~LCD_PORT9_1ST; 00132 GPIO.PFC9 = (uint16_t)reg_data; 00133 reg_data = (uint32_t)GPIO.PIPC9 | (uint32_t)LCD_PORT9_1ST; 00134 GPIO.PIPC9 = (uint16_t)reg_data; 00135 reg_data = (uint32_t)GPIO.PMC9 | (uint32_t)LCD_PORT9_1ST; 00136 GPIO.PMC9 = (uint16_t)reg_data; 00137 00138 /* Port 5 */ 00139 reg_data = (uint32_t)GPIO.PMC5 & (uint32_t)~(LCD_PORT5_7TH|LCD_PORT5_2ND); 00140 GPIO.PMC5 = (uint16_t)reg_data; 00141 reg_data = (uint32_t)GPIO.PMC5; 00142 dummy_read = reg_data; 00143 /* PFCAE5, PFCE5, PFC5 ... 7th alternative function 00144 b10:b9 : P5_10 ~ P5_9 */ 00145 reg_data = (uint32_t)GPIO.PFCAE5 | (uint32_t)LCD_PORT5_7TH; 00146 GPIO.PFCAE5 = (uint16_t)reg_data; 00147 reg_data = (uint32_t)GPIO.PFCE5 | (uint32_t)LCD_PORT5_7TH; 00148 GPIO.PFCE5 = (uint16_t)reg_data; 00149 reg_data = (uint32_t)GPIO.PFC5 & (uint32_t)~LCD_PORT5_7TH; 00150 GPIO.PFC5 = (uint16_t)reg_data; 00151 /* PFCAE5, PFCE5, PFC5 ... 2nd alternative function 00152 b7:b0 : P5_7 ~ P5_0 */ 00153 reg_data = (uint32_t)GPIO.PFCAE5 & (uint32_t)~LCD_PORT5_2ND; 00154 GPIO.PFCAE5 = (uint16_t)reg_data; 00155 reg_data = (uint32_t)GPIO.PFCE5 & (uint32_t)~LCD_PORT5_2ND; 00156 GPIO.PFCE5 = (uint16_t)reg_data; 00157 reg_data = (uint32_t)GPIO.PFC5 | (uint32_t)LCD_PORT5_2ND; 00158 GPIO.PFC5 = (uint16_t)reg_data; 00159 /* PIPC5, PMC5 00160 b10:b9 : P5_10 ~ P5_9 00161 b7:b0 : P5_7 ~ P5_0 */ 00162 reg_data = (uint32_t)GPIO.PIPC5 | (uint32_t)(LCD_PORT5_7TH|LCD_PORT5_2ND); 00163 GPIO.PIPC5 = (uint16_t)reg_data; 00164 reg_data = (uint32_t)GPIO.PMC5 | (uint32_t)(LCD_PORT5_7TH|LCD_PORT5_2ND); 00165 GPIO.PMC5 = (uint16_t)reg_data; 00166 00167 /* Port 2 */ 00168 reg_data = (uint32_t)GPIO.PMC2 & (uint32_t)~(LCD_PORT2_7TH|LCD_PORT2_6TH); 00169 GPIO.PMC2 = (uint16_t)reg_data; 00170 reg_data = (uint32_t)GPIO.PMC2; 00171 dummy_read = reg_data; 00172 /* PFCAE2, PFCE2, PFC2 ... 7th alternative function 00173 b15:b12 : P2_15 ~ P2_12 */ 00174 reg_data = (uint32_t)GPIO.PFCAE2 | (uint32_t)LCD_PORT2_7TH; 00175 GPIO.PFCAE2 = (uint16_t)reg_data; 00176 reg_data = (uint32_t)GPIO.PFCE2 | (uint32_t)LCD_PORT2_7TH; 00177 GPIO.PFCE2 = (uint16_t)reg_data; 00178 reg_data = (uint32_t)GPIO.PFC2 & (uint32_t)~LCD_PORT2_7TH; 00179 GPIO.PFC2 = (uint16_t)reg_data; 00180 /* PFCAE2, PFCE2, PFC2 ... 6th alternative function 00181 b11:b8 : P2_11 ~ P2_8 */ 00182 reg_data = (uint32_t)GPIO.PFCAE2 | (uint32_t)LCD_PORT2_6TH; 00183 GPIO.PFCAE2 = (uint16_t)reg_data; 00184 reg_data = (uint32_t)GPIO.PFCE2 & (uint32_t)~LCD_PORT2_6TH; 00185 GPIO.PFCE2 = (uint16_t)reg_data; 00186 reg_data = (uint32_t)GPIO.PFC2 | (uint32_t)LCD_PORT2_6TH; 00187 GPIO.PFC2 = (uint16_t)reg_data; 00188 /* PIPC2, PMC2 00189 b15:b8 : P2_15 ~ P2_8 */ 00190 reg_data = (uint32_t)GPIO.PIPC2 | (uint32_t)(LCD_PORT2_7TH|LCD_PORT2_6TH); 00191 GPIO.PIPC2 = (uint16_t)reg_data; 00192 reg_data = (uint32_t)GPIO.PMC2 | (uint32_t)(LCD_PORT2_7TH|LCD_PORT2_6TH); 00193 GPIO.PMC2 = (uint16_t)reg_data; 00194 } /* End of function GRAPHICS_SetLcdPanel_Ch1() */ 00195 00196 /**************************************************************************//** 00197 * @brief LCD TCON setup parameter acquisition processing (VDC5 channel 1) 00198 * @param[out] outctrl : Address of the area for storing the LCD TCON timing setup data table 00199 * @retval None 00200 ******************************************************************************/ 00201 void GRAPHICS_SetLcdTconSettings_Ch1 (const vdc5_lcd_tcon_timing_t * * const outctrl) 00202 { 00203 /* Analog RGB D-sub15 (RGB888), SVGA signal 800x600 */ 00204 /* TCON timing setting, VS */ 00205 static const vdc5_lcd_tcon_timing_t lcd_tcon_timing_VS = { 00206 (uint16_t)(LCD_CH1_S_VSYNC * FH_1_2_CYCLE), /* Signal pulse start position */ 00207 (uint16_t)(LCD_CH1_W_VSYNC * FH_1_2_CYCLE), /* Pulse width */ 00208 VDC5_LCD_TCON_POLMD_NORMAL , 00209 VDC5_LCD_TCON_REFSEL_HSYNC , 00210 LCD_CH1_POL_VSYNC, /* Polarity inversion control of signal */ 00211 VDC5_LCD_TCON_PIN_1 , /* Output pin for LCD driving signal */ 00212 LCD_CH1_OUT_EDGE /* Output phase control of signal */ 00213 }; 00214 /* TCON timing setting, HS */ 00215 static const vdc5_lcd_tcon_timing_t lcd_tcon_timing_HS = { 00216 (uint16_t)LCD_CH1_S_HSYNC, /* Signal pulse start position */ 00217 (uint16_t)LCD_CH1_W_HSYNC, /* Pulse width */ 00218 VDC5_LCD_TCON_POLMD_NORMAL , 00219 VDC5_LCD_TCON_REFSEL_HSYNC , /* Signal operating reference select */ 00220 LCD_CH1_POL_HSYNC, /* Polarity inversion control of signal */ 00221 VDC5_LCD_TCON_PIN_5 , /* Output pin for LCD driving signal */ 00222 LCD_CH1_OUT_EDGE /* Output phase control of signal */ 00223 }; 00224 00225 if (outctrl != NULL) { 00226 outctrl[VDC5_LCD_TCONSIG_STVA_VS ] = &lcd_tcon_timing_VS; /* STVA/VS: Vsync */ 00227 outctrl[VDC5_LCD_TCONSIG_STVB_VE ] = NULL; /* STVB/VE: Not used */ 00228 outctrl[VDC5_LCD_TCONSIG_STH_SP_HS ] = &lcd_tcon_timing_HS; /* STH/SP/HS: Hsync */ 00229 outctrl[VDC5_LCD_TCONSIG_STB_LP_HE ] = NULL; /* STB/LP/HE: Not used */ 00230 outctrl[VDC5_LCD_TCONSIG_CPV_GCK ] = NULL; /* CPV/GCK: Not used */ 00231 outctrl[VDC5_LCD_TCONSIG_POLA ] = NULL; /* POLA: Not used */ 00232 outctrl[VDC5_LCD_TCONSIG_POLB ] = NULL; /* POLB: Not used */ 00233 outctrl[VDC5_LCD_TCONSIG_DE ] = NULL; /* DE: Not used */ 00234 } 00235 } /* End of function GRAPHICS_SetLcdTconSettings_Ch1() */ 00236 00237 #endif /* LCD_VDC5_CH1_PANEL==LCD_CH1_PANEL_ANALOG_RGB */ 00238
Generated on Tue Jul 12 2022 14:47:13 by
1.7.2
