![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Production Test Program (PTP) for the LPC4088 Experiment Base Board
Dependencies: EALib I2S LM75B SDFileSystem mbed
EaLcdBoardGPIO.cpp@1:47680ec5d783, 2014-08-27 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Aug 27 14:24:59 2014 +0000
- Revision:
- 1:47680ec5d783
Got the display and touch to work. Only audio tests missing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 1:47680ec5d783 | 1 | /* |
embeddedartists | 1:47680ec5d783 | 2 | * Copyright 2013 Embedded Artists AB |
embeddedartists | 1:47680ec5d783 | 3 | * |
embeddedartists | 1:47680ec5d783 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 1:47680ec5d783 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 1:47680ec5d783 | 6 | * You may obtain a copy of the License at |
embeddedartists | 1:47680ec5d783 | 7 | * |
embeddedartists | 1:47680ec5d783 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 1:47680ec5d783 | 9 | * |
embeddedartists | 1:47680ec5d783 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 1:47680ec5d783 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 1:47680ec5d783 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 1:47680ec5d783 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 1:47680ec5d783 | 14 | * limitations under the License. |
embeddedartists | 1:47680ec5d783 | 15 | */ |
embeddedartists | 1:47680ec5d783 | 16 | |
embeddedartists | 1:47680ec5d783 | 17 | /****************************************************************************** |
embeddedartists | 1:47680ec5d783 | 18 | * Includes |
embeddedartists | 1:47680ec5d783 | 19 | *****************************************************************************/ |
embeddedartists | 1:47680ec5d783 | 20 | |
embeddedartists | 1:47680ec5d783 | 21 | #include "mbed.h" |
embeddedartists | 1:47680ec5d783 | 22 | #include "EaLcdBoardGPIO.h" |
embeddedartists | 1:47680ec5d783 | 23 | |
embeddedartists | 1:47680ec5d783 | 24 | /****************************************************************************** |
embeddedartists | 1:47680ec5d783 | 25 | * Defines and typedefs |
embeddedartists | 1:47680ec5d783 | 26 | *****************************************************************************/ |
embeddedartists | 1:47680ec5d783 | 27 | |
embeddedartists | 1:47680ec5d783 | 28 | |
embeddedartists | 1:47680ec5d783 | 29 | EaLcdBoardGPIO::EaLcdBoardGPIO(PinName sda, PinName scl) |
embeddedartists | 1:47680ec5d783 | 30 | : EaLcdBoard(sda, scl), /*pinWP(P4_15),*/ pin3v3(P2_0), pin5v(P2_21), pinDE(P2_11), pinContrast(P2_1) |
embeddedartists | 1:47680ec5d783 | 31 | { |
embeddedartists | 1:47680ec5d783 | 32 | pinContrast.period_ms(10); |
embeddedartists | 1:47680ec5d783 | 33 | setWriteProtect(true); |
embeddedartists | 1:47680ec5d783 | 34 | set3V3Signal(false); |
embeddedartists | 1:47680ec5d783 | 35 | set5VSignal(false); |
embeddedartists | 1:47680ec5d783 | 36 | setDisplayEnableSignal(false); |
embeddedartists | 1:47680ec5d783 | 37 | setBacklightContrast(0); |
embeddedartists | 1:47680ec5d783 | 38 | } |
embeddedartists | 1:47680ec5d783 | 39 | |
embeddedartists | 1:47680ec5d783 | 40 | |
embeddedartists | 1:47680ec5d783 | 41 | void EaLcdBoardGPIO::setWriteProtect(bool enable) |
embeddedartists | 1:47680ec5d783 | 42 | { |
embeddedartists | 1:47680ec5d783 | 43 | // Not Applicable |
embeddedartists | 1:47680ec5d783 | 44 | } |
embeddedartists | 1:47680ec5d783 | 45 | |
embeddedartists | 1:47680ec5d783 | 46 | void EaLcdBoardGPIO::set3V3Signal(bool enabled) { //P2.0 L=3.3V on |
embeddedartists | 1:47680ec5d783 | 47 | if (enabled) { |
embeddedartists | 1:47680ec5d783 | 48 | pin3v3 = 0; |
embeddedartists | 1:47680ec5d783 | 49 | } else { |
embeddedartists | 1:47680ec5d783 | 50 | pin3v3 = 1; |
embeddedartists | 1:47680ec5d783 | 51 | } |
embeddedartists | 1:47680ec5d783 | 52 | } |
embeddedartists | 1:47680ec5d783 | 53 | |
embeddedartists | 1:47680ec5d783 | 54 | void EaLcdBoardGPIO::set5VSignal(bool enabled) { //P2.21 H=5V on |
embeddedartists | 1:47680ec5d783 | 55 | if (enabled) { |
embeddedartists | 1:47680ec5d783 | 56 | pin5v = 1; |
embeddedartists | 1:47680ec5d783 | 57 | } else { |
embeddedartists | 1:47680ec5d783 | 58 | pin5v = 0; |
embeddedartists | 1:47680ec5d783 | 59 | } |
embeddedartists | 1:47680ec5d783 | 60 | } |
embeddedartists | 1:47680ec5d783 | 61 | |
embeddedartists | 1:47680ec5d783 | 62 | void EaLcdBoardGPIO::setDisplayEnableSignal(bool enabled) { //P2.11 H=enabled |
embeddedartists | 1:47680ec5d783 | 63 | LPC_IOCON->P2_11 &= ~7; /* GPIO2[11] @ P2.11 */ |
embeddedartists | 1:47680ec5d783 | 64 | if (enabled) { |
embeddedartists | 1:47680ec5d783 | 65 | pinDE = 1; |
embeddedartists | 1:47680ec5d783 | 66 | } else { |
embeddedartists | 1:47680ec5d783 | 67 | pinDE = 0; |
embeddedartists | 1:47680ec5d783 | 68 | } |
embeddedartists | 1:47680ec5d783 | 69 | } |
embeddedartists | 1:47680ec5d783 | 70 | |
embeddedartists | 1:47680ec5d783 | 71 | void EaLcdBoardGPIO::setBacklightContrast(uint32_t value) { //P2.1, set to 4.30 for now |
embeddedartists | 1:47680ec5d783 | 72 | #if 0 |
embeddedartists | 1:47680ec5d783 | 73 | LPC_IOCON->P2_1 &= ~7; /* GPIO2[1] @ P2.1 */ |
embeddedartists | 1:47680ec5d783 | 74 | if (value > 50) { |
embeddedartists | 1:47680ec5d783 | 75 | pinContrast = 1; |
embeddedartists | 1:47680ec5d783 | 76 | } else { |
embeddedartists | 1:47680ec5d783 | 77 | pinContrast = 0; |
embeddedartists | 1:47680ec5d783 | 78 | } |
embeddedartists | 1:47680ec5d783 | 79 | #else |
embeddedartists | 1:47680ec5d783 | 80 | uint32_t tmp = LPC_IOCON->P2_1; |
embeddedartists | 1:47680ec5d783 | 81 | tmp &= ~7; |
embeddedartists | 1:47680ec5d783 | 82 | tmp |= 1; |
embeddedartists | 1:47680ec5d783 | 83 | LPC_IOCON->P2_1 = tmp; /* PWM2[1] @ P2.1 */ |
embeddedartists | 1:47680ec5d783 | 84 | float f = value; |
embeddedartists | 1:47680ec5d783 | 85 | pinContrast = f/100.0f; |
embeddedartists | 1:47680ec5d783 | 86 | #endif |
embeddedartists | 1:47680ec5d783 | 87 | |
embeddedartists | 1:47680ec5d783 | 88 | // if (value > 100) return; |
embeddedartists | 1:47680ec5d783 | 89 | |
embeddedartists | 1:47680ec5d783 | 90 | // pca9532_setBlink0Duty(100-value); |
embeddedartists | 1:47680ec5d783 | 91 | // pca9532_setBlink0Period(0); |
embeddedartists | 1:47680ec5d783 | 92 | // pca9532_setBlink0Leds(LCDB_CTRL_BL_C); |
embeddedartists | 1:47680ec5d783 | 93 | } |
embeddedartists | 1:47680ec5d783 | 94 | |
embeddedartists | 1:47680ec5d783 | 95 | |
embeddedartists | 1:47680ec5d783 | 96 |