Newhaven 320x240 LCD

Dependencies:   mbed

Committer:
pbevans89
Date:
Sun Feb 27 21:14:19 2011 +0000
Revision:
1:fa44aeffcfd6
Parent:
0:c8893901ef8a
Child:
2:2058e2f79157

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pbevans89 1:fa44aeffcfd6 1 /* mbed Newhaven LCD Library, for the NHD-320240WG model
pbevans89 1:fa44aeffcfd6 2 * Copyright (c) 2011, Paul Evans
pbevans89 1:fa44aeffcfd6 3 *
pbevans89 1:fa44aeffcfd6 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
pbevans89 1:fa44aeffcfd6 5 * of this software and associated documentation files (the "Software"), to deal
pbevans89 1:fa44aeffcfd6 6 * in the Software without restriction, including without limitation the rights
pbevans89 1:fa44aeffcfd6 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
pbevans89 1:fa44aeffcfd6 8 * copies of the Software, and to permit persons to whom the Software is
pbevans89 1:fa44aeffcfd6 9 * furnished to do so, subject to the following conditions:
pbevans89 1:fa44aeffcfd6 10 *
pbevans89 1:fa44aeffcfd6 11 * The above copyright notice and this permission notice shall be included in
pbevans89 1:fa44aeffcfd6 12 * all copies or substantial portions of the Software.
pbevans89 1:fa44aeffcfd6 13 *
pbevans89 1:fa44aeffcfd6 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
pbevans89 1:fa44aeffcfd6 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
pbevans89 1:fa44aeffcfd6 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
pbevans89 1:fa44aeffcfd6 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
pbevans89 1:fa44aeffcfd6 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
pbevans89 1:fa44aeffcfd6 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
pbevans89 1:fa44aeffcfd6 20 * THE SOFTWARE.
pbevans89 1:fa44aeffcfd6 21 */
pbevans89 1:fa44aeffcfd6 22
pbevans89 1:fa44aeffcfd6 23 #include "mbed.h"
pbevans89 0:c8893901ef8a 24
pbevans89 0:c8893901ef8a 25 class NHLCD {
pbevans89 0:c8893901ef8a 26 public:
pbevans89 1:fa44aeffcfd6 27 /* Creates a Newhaven LCD interface using several DigitalOut pins and a 8-bit BusInOut
pbevans89 1:fa44aeffcfd6 28 *
pbevans89 1:fa44aeffcfd6 29 * @param PIN_E Operation enable signal
pbevans89 1:fa44aeffcfd6 30 * @param PIN_RW Read/Write select signal (1 = read, 0 = write)
pbevans89 1:fa44aeffcfd6 31 * @param PIN_A0 Register select signal (1 = data, 0 = command)
pbevans89 1:fa44aeffcfd6 32 * @param PIN_CS Active LOW chip select
pbevans89 1:fa44aeffcfd6 33 * @param PIN_RST Active LOW reset signal
pbevans89 1:fa44aeffcfd6 34 * @param BUSLCD Bi-directional 8-bit data bus
pbevans89 1:fa44aeffcfd6 35 */
pbevans89 0:c8893901ef8a 36 NHLCD(PinName PIN_E,PinName PIN_RW,PinName PIN_A0,PinName PIN_CS,PinName PIN_RST, BusInOut *BUSLCD);
pbevans89 0:c8893901ef8a 37 void Init();
pbevans89 0:c8893901ef8a 38 void comm_out(unsigned char j);
pbevans89 0:c8893901ef8a 39 void data_out(unsigned char j);
pbevans89 0:c8893901ef8a 40 void clearScreen();
pbevans89 0:c8893901ef8a 41 void text(char* text, char row, char col);
pbevans89 0:c8893901ef8a 42 void setPixel(int row, int col);
pbevans89 0:c8893901ef8a 43
pbevans89 0:c8893901ef8a 44 private:
pbevans89 0:c8893901ef8a 45 DigitalOut E,RW,A0,CS,RST;
pbevans89 0:c8893901ef8a 46 BusInOut *LCD_PORT;
pbevans89 0:c8893901ef8a 47
pbevans89 0:c8893901ef8a 48 };
pbevans89 0:c8893901ef8a 49
pbevans89 0:c8893901ef8a 50 void delay(unsigned int n);
pbevans89 0:c8893901ef8a 51 void delay1(unsigned int n);