using Gert van der Knokke´s vga lib and Ivo van Poorten´ss fastlib to receive from GPS data and display on monitor

Dependencies:   mbed vga640x480g

Committer:
smayr
Date:
Sun Jan 01 21:30:01 2012 +0000
Revision:
0:2b28d7f11022

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
smayr 0:2b28d7f11022 1 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780
smayr 0:2b28d7f11022 2 * Copyright (c) 2007-2010, sford, http://mbed.org
smayr 0:2b28d7f11022 3 *
smayr 0:2b28d7f11022 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
smayr 0:2b28d7f11022 5 * of this software and associated documentation files (the "Software"), to deal
smayr 0:2b28d7f11022 6 * in the Software without restriction, including without limitation the rights
smayr 0:2b28d7f11022 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
smayr 0:2b28d7f11022 8 * copies of the Software, and to permit persons to whom the Software is
smayr 0:2b28d7f11022 9 * furnished to do so, subject to the following conditions:
smayr 0:2b28d7f11022 10 *
smayr 0:2b28d7f11022 11 * The above copyright notice and this permission notice shall be included in
smayr 0:2b28d7f11022 12 * all copies or substantial portions of the Software.
smayr 0:2b28d7f11022 13 *
smayr 0:2b28d7f11022 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
smayr 0:2b28d7f11022 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
smayr 0:2b28d7f11022 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
smayr 0:2b28d7f11022 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
smayr 0:2b28d7f11022 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
smayr 0:2b28d7f11022 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
smayr 0:2b28d7f11022 20 * THE SOFTWARE.
smayr 0:2b28d7f11022 21 */
smayr 0:2b28d7f11022 22
smayr 0:2b28d7f11022 23 #ifndef MBED_TEXTLCD_H
smayr 0:2b28d7f11022 24 #define MBED_TEXTLCD_H
smayr 0:2b28d7f11022 25
smayr 0:2b28d7f11022 26 #include "mbed.h"
smayr 0:2b28d7f11022 27
smayr 0:2b28d7f11022 28 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
smayr 0:2b28d7f11022 29 *
smayr 0:2b28d7f11022 30 * Currently supports 16x2, 20x2 and 20x4 panels
smayr 0:2b28d7f11022 31 *
smayr 0:2b28d7f11022 32 * @code
smayr 0:2b28d7f11022 33 * #include "mbed.h"
smayr 0:2b28d7f11022 34 * #include "TextLCD.h"
smayr 0:2b28d7f11022 35 *
smayr 0:2b28d7f11022 36 * TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3
smayr 0:2b28d7f11022 37 *
smayr 0:2b28d7f11022 38 * int main() {
smayr 0:2b28d7f11022 39 * lcd.printf("Hello World!\n");
smayr 0:2b28d7f11022 40 * }
smayr 0:2b28d7f11022 41 */
smayr 0:2b28d7f11022 42 class TextLCD : public Stream {
smayr 0:2b28d7f11022 43 public:
smayr 0:2b28d7f11022 44
smayr 0:2b28d7f11022 45 /** LCD panel format */
smayr 0:2b28d7f11022 46 enum LCDType {
smayr 0:2b28d7f11022 47 LCD16x2, /**< 16x2 LCD panel (default) */
smayr 0:2b28d7f11022 48
smayr 0:2b28d7f11022 49 LCD16x2B, /**< 16x2 LCD panel alternate addressing */
smayr 0:2b28d7f11022 50 LCD20x2, /**< 20x2 LCD panel */
smayr 0:2b28d7f11022 51 LCD20x4, /**< 20x4 LCD panel */
smayr 0:2b28d7f11022 52 LCD16x1, /**< 16x1 LCD panel */
smayr 0:2b28d7f11022 53 LCD8x2 /**< 16x1 LCD panel */
smayr 0:2b28d7f11022 54 };
smayr 0:2b28d7f11022 55
smayr 0:2b28d7f11022 56 /** Create a TextLCD interface
smayr 0:2b28d7f11022 57 *
smayr 0:2b28d7f11022 58 * @param rs Instruction/data control line
smayr 0:2b28d7f11022 59 * @param e Enable line (clock)
smayr 0:2b28d7f11022 60 * @param d0-d3 Data lines
smayr 0:2b28d7f11022 61 * @param type Sets the panel size/addressing mode (default = LCD16x2)
smayr 0:2b28d7f11022 62 */
smayr 0:2b28d7f11022 63 TextLCD(PinName rs, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type=LCD8x2);
smayr 0:2b28d7f11022 64
smayr 0:2b28d7f11022 65 #if DOXYGEN_ONLY
smayr 0:2b28d7f11022 66 /** Write a character to the LCD
smayr 0:2b28d7f11022 67 *
smayr 0:2b28d7f11022 68 * @param c The character to write to the display
smayr 0:2b28d7f11022 69 */
smayr 0:2b28d7f11022 70 int putc(int c);
smayr 0:2b28d7f11022 71
smayr 0:2b28d7f11022 72 /** Write a formated string to the LCD
smayr 0:2b28d7f11022 73 *
smayr 0:2b28d7f11022 74 * @param format A printf-style format string, followed by the
smayr 0:2b28d7f11022 75 * variables to use in formating the string.
smayr 0:2b28d7f11022 76 */
smayr 0:2b28d7f11022 77 int printf(const char* format, ...);
smayr 0:2b28d7f11022 78 #endif
smayr 0:2b28d7f11022 79
smayr 0:2b28d7f11022 80 /** Locate to a screen column and row
smayr 0:2b28d7f11022 81 *
smayr 0:2b28d7f11022 82 * @param column The horizontal position from the left, indexed from 0
smayr 0:2b28d7f11022 83 * @param row The vertical position from the top, indexed from 0
smayr 0:2b28d7f11022 84 */
smayr 0:2b28d7f11022 85 void locate(int column, int row);
smayr 0:2b28d7f11022 86
smayr 0:2b28d7f11022 87 /** Clear the screen and locate to 0,0 */
smayr 0:2b28d7f11022 88 void cls();
smayr 0:2b28d7f11022 89
smayr 0:2b28d7f11022 90 int rows();
smayr 0:2b28d7f11022 91 int columns();
smayr 0:2b28d7f11022 92
smayr 0:2b28d7f11022 93 protected:
smayr 0:2b28d7f11022 94
smayr 0:2b28d7f11022 95 // Stream implementation functions
smayr 0:2b28d7f11022 96 virtual int _putc(int value);
smayr 0:2b28d7f11022 97 virtual int _getc();
smayr 0:2b28d7f11022 98
smayr 0:2b28d7f11022 99 int address(int column, int row);
smayr 0:2b28d7f11022 100 void character(int column, int row, int c);
smayr 0:2b28d7f11022 101 void writeByte(int value);
smayr 0:2b28d7f11022 102 void writeCommand(int command);
smayr 0:2b28d7f11022 103 void writeData(int data);
smayr 0:2b28d7f11022 104
smayr 0:2b28d7f11022 105 DigitalOut _rs, _e;
smayr 0:2b28d7f11022 106 BusOut _d;
smayr 0:2b28d7f11022 107 LCDType _type;
smayr 0:2b28d7f11022 108
smayr 0:2b28d7f11022 109 int _column;
smayr 0:2b28d7f11022 110 int _row;
smayr 0:2b28d7f11022 111 };
smayr 0:2b28d7f11022 112
smayr 0:2b28d7f11022 113 #endif