Production Test Program (PTP) for the LPC4088 Experiment Base Board
Dependencies: EALib I2S LM75B SDFileSystem mbed
EaLcdBoardGPIO.cpp
00001 /* 00002 * Copyright 2013 Embedded Artists AB 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /****************************************************************************** 00018 * Includes 00019 *****************************************************************************/ 00020 00021 #include "mbed.h" 00022 #include "EaLcdBoardGPIO.h" 00023 00024 /****************************************************************************** 00025 * Defines and typedefs 00026 *****************************************************************************/ 00027 00028 00029 EaLcdBoardGPIO::EaLcdBoardGPIO(PinName sda, PinName scl) 00030 : EaLcdBoard(sda, scl), /*pinWP(P4_15),*/ pin3v3(P2_0), pin5v(P2_21), pinDE(P2_11), pinContrast(P2_1) 00031 { 00032 pinContrast.period_ms(10); 00033 setWriteProtect(true); 00034 set3V3Signal(false); 00035 set5VSignal(false); 00036 setDisplayEnableSignal(false); 00037 setBacklightContrast(0); 00038 } 00039 00040 00041 void EaLcdBoardGPIO::setWriteProtect(bool enable) 00042 { 00043 // Not Applicable 00044 } 00045 00046 void EaLcdBoardGPIO::set3V3Signal(bool enabled) { //P2.0 L=3.3V on 00047 if (enabled) { 00048 pin3v3 = 0; 00049 } else { 00050 pin3v3 = 1; 00051 } 00052 } 00053 00054 void EaLcdBoardGPIO::set5VSignal(bool enabled) { //P2.21 H=5V on 00055 if (enabled) { 00056 pin5v = 1; 00057 } else { 00058 pin5v = 0; 00059 } 00060 } 00061 00062 void EaLcdBoardGPIO::setDisplayEnableSignal(bool enabled) { //P2.11 H=enabled 00063 LPC_IOCON->P2_11 &= ~7; /* GPIO2[11] @ P2.11 */ 00064 if (enabled) { 00065 pinDE = 1; 00066 } else { 00067 pinDE = 0; 00068 } 00069 } 00070 00071 void EaLcdBoardGPIO::setBacklightContrast(uint32_t value) { //P2.1, set to 4.30 for now 00072 #if 0 00073 LPC_IOCON->P2_1 &= ~7; /* GPIO2[1] @ P2.1 */ 00074 if (value > 50) { 00075 pinContrast = 1; 00076 } else { 00077 pinContrast = 0; 00078 } 00079 #else 00080 uint32_t tmp = LPC_IOCON->P2_1; 00081 tmp &= ~7; 00082 tmp |= 1; 00083 LPC_IOCON->P2_1 = tmp; /* PWM2[1] @ P2.1 */ 00084 float f = value; 00085 pinContrast = f/100.0f; 00086 #endif 00087 00088 // if (value > 100) return; 00089 00090 // pca9532_setBlink0Duty(100-value); 00091 // pca9532_setBlink0Period(0); 00092 // pca9532_setBlink0Leds(LCDB_CTRL_BL_C); 00093 } 00094 00095 00096
Generated on Sun Jul 17 2022 08:29:10 by 1.7.2