Had to create default object constructors so that it can be used with the Vodafone library and the mbed rtos when creating dynamic objects on the heap.

Fork of TextLCD by Sukkin Pang

Committer:
nherriot
Date:
Tue Jul 30 13:11:35 2013 +0000
Revision:
1:cb0d67c3953d
Parent:
0:ec079a141883
Creating default constructor with a void type.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pangsk 0:ec079a141883 1 /* mbed TextLCD Library
pangsk 0:ec079a141883 2 * Copyright (c) 2007-2009 sford
pangsk 0:ec079a141883 3 * Released under the MIT License: http://mbed.org/license/mit
pangsk 0:ec079a141883 4 */
pangsk 0:ec079a141883 5
pangsk 0:ec079a141883 6 #ifndef MBED_TEXTLCD_H
pangsk 0:ec079a141883 7 #define MBED_TEXTLCD_H
pangsk 0:ec079a141883 8
pangsk 0:ec079a141883 9 #include "Stream.h"
pangsk 0:ec079a141883 10 #include "DigitalOut.h"
pangsk 0:ec079a141883 11 #include "BusOut.h"
pangsk 0:ec079a141883 12
pangsk 0:ec079a141883 13 namespace mbed {
pangsk 0:ec079a141883 14
pangsk 0:ec079a141883 15 /* Class: TextLCD
pangsk 0:ec079a141883 16 * A 16x2 Text LCD controller
pangsk 0:ec079a141883 17 *
pangsk 0:ec079a141883 18 * Allows you to print to a Text LCD screen, and locate/cls. Could be
pangsk 0:ec079a141883 19 * turned in to a more generic libray.
pangsk 0:ec079a141883 20 *
pangsk 0:ec079a141883 21 * If you are connecting multiple displays, you can connect them all in
pangsk 0:ec079a141883 22 * parallel except for the enable (e) pin, which must be unique for each
pangsk 0:ec079a141883 23 * display.
pangsk 0:ec079a141883 24 *
pangsk 0:ec079a141883 25 * Example:
pangsk 0:ec079a141883 26 * > #include "mbed.h"
pangsk 0:ec079a141883 27 * > #include "TextLCD.h"
pangsk 0:ec079a141883 28 * >
pangsk 0:ec079a141883 29 * > TextLCD lcd(p24, p25, p26, p27, p28, p29, p30); // rs, rw, e, d0, d1, d2, d3
pangsk 0:ec079a141883 30 * >
pangsk 0:ec079a141883 31 * > int main() {
pangsk 0:ec079a141883 32 * > lcd.printf("Hello World!");
pangsk 0:ec079a141883 33 * > }
pangsk 0:ec079a141883 34 */
pangsk 0:ec079a141883 35 class TextLCD : public Stream {
pangsk 0:ec079a141883 36
pangsk 0:ec079a141883 37 public:
pangsk 0:ec079a141883 38 /* Constructor: TextLCD
pangsk 0:ec079a141883 39 * Create a TextLCD object, connected to the specified pins
pangsk 0:ec079a141883 40 *
pangsk 0:ec079a141883 41 * All signals must be connected to DigitalIn compatible pins.
pangsk 0:ec079a141883 42 *
pangsk 0:ec079a141883 43 * Variables:
pangsk 0:ec079a141883 44 * rs - Used to specify data or command
pangsk 0:ec079a141883 45 * rw - Used to determine read or write
pangsk 0:ec079a141883 46 * e - enable
pangsk 0:ec079a141883 47 * d0..d3 - The data lines
pangsk 0:ec079a141883 48 */
nherriot 1:cb0d67c3953d 49 TextLCD(void);
pangsk 0:ec079a141883 50 TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1,
pangsk 0:ec079a141883 51 PinName d2, PinName d3, int columns = 16, int rows = 2);
pangsk 0:ec079a141883 52
pangsk 0:ec079a141883 53 #if 0 // Inhereted from Stream, for documentation only
pangsk 0:ec079a141883 54 /* Function: putc
pangsk 0:ec079a141883 55 * Write a character
pangsk 0:ec079a141883 56 *
pangsk 0:ec079a141883 57 * Variables:
pangsk 0:ec079a141883 58 * c - The character to write to the serial port
pangsk 0:ec079a141883 59 */
pangsk 0:ec079a141883 60 int putc(int c);
pangsk 0:ec079a141883 61
pangsk 0:ec079a141883 62 /* Function: printf
pangsk 0:ec079a141883 63 * Write a formated string
pangsk 0:ec079a141883 64 *
pangsk 0:ec079a141883 65 * Variables:
pangsk 0:ec079a141883 66 * format - A printf-style format string, followed by the
pangsk 0:ec079a141883 67 * variables to use in formating the string.
pangsk 0:ec079a141883 68 */
pangsk 0:ec079a141883 69 int printf(const char* format, ...);
pangsk 0:ec079a141883 70 #endif
pangsk 0:ec079a141883 71
pangsk 0:ec079a141883 72 /* Function: locate
pangsk 0:ec079a141883 73 * Locate to a certian position
pangsk 0:ec079a141883 74 *
pangsk 0:ec079a141883 75 * Variables:
pangsk 0:ec079a141883 76 * column - the column to locate to, from 0..15
pangsk 0:ec079a141883 77 * row - the row to locate to, from 0..1
pangsk 0:ec079a141883 78 */
pangsk 0:ec079a141883 79 virtual void locate(int column, int row);
pangsk 0:ec079a141883 80
pangsk 0:ec079a141883 81 /* Function: cls
pangsk 0:ec079a141883 82 * Clear the screen, and locate to 0,0
pangsk 0:ec079a141883 83 */
pangsk 0:ec079a141883 84 virtual void cls();
pangsk 0:ec079a141883 85
pangsk 0:ec079a141883 86 virtual void reset();
pangsk 0:ec079a141883 87
pangsk 0:ec079a141883 88 protected:
pangsk 0:ec079a141883 89
pangsk 0:ec079a141883 90 void clock();
pangsk 0:ec079a141883 91 void writeData(int data);
pangsk 0:ec079a141883 92 void writeCommand(int command);
pangsk 0:ec079a141883 93 void writeByte(int value);
pangsk 0:ec079a141883 94 void writeNibble(int value);
pangsk 0:ec079a141883 95 virtual int _putc(int c);
pangsk 0:ec079a141883 96 virtual int _getc();
pangsk 0:ec079a141883 97 virtual void newline();
pangsk 0:ec079a141883 98
pangsk 0:ec079a141883 99 int _row;
pangsk 0:ec079a141883 100 int _column;
pangsk 0:ec079a141883 101 DigitalOut _rw, _rs, _e;
pangsk 0:ec079a141883 102 BusOut _d;
pangsk 0:ec079a141883 103 int _columns;
pangsk 0:ec079a141883 104 int _rows;
pangsk 0:ec079a141883 105
pangsk 0:ec079a141883 106 };
pangsk 0:ec079a141883 107
pangsk 0:ec079a141883 108 }
pangsk 0:ec079a141883 109
pangsk 0:ec079a141883 110 #endif