LCD display
Fork of LCDLib by
Diff: TextLCD.h
- Revision:
- 6:c80d81c3be4d
- Parent:
- 4:264d9b06bf60
- Child:
- 7:5e18f9a04e62
diff -r d9eb6ed84a06 -r c80d81c3be4d TextLCD.h --- a/TextLCD.h Sun Sep 20 12:01:04 2015 +0000 +++ b/TextLCD.h Sun Sep 20 14:13:15 2015 +0000 @@ -1,5 +1,5 @@ /* mbed TextLCD Library,4-bit 16x2 LCD for KS0066U - * Copyright (c) 2015 Rune Langøy + * Copyright (c) 2015 Rune Langøy * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,12 +22,12 @@ #ifndef LCD_H_ #define LCD_H_ -/** A TextLCD interface for driving 4-bit 16x2 KS0066U LCD +/** A TextLCD interface for driving 4-bit 16x2 KS0066U LCD * * @code * #include "mbed.h" * #include "TextLCD.h" - * + * * TextLCD lcd(D11,D10,D9,D5,D4,D3,D2); * int main() * { @@ -43,37 +43,62 @@ * } * @endcode */ -class TextLCD : public Stream +class TextLCD : public Stream { public: - /** Create a TextLCD interface and initiated 16x2 char mode + /** Create a TextLCD interface and initiated 16x2 char mode + * + * @param rs Instruction/data control line + * @param rw Read/Write (is forced to '1') + * @param e Enable line (clock) + * @param d4-d7 Data lines for using as a 4-bit interface + */ + TextLCD(PinName rs,PinName rw, PinName e, PinName d4, PinName d5, + PinName d6, PinName d7) ; + + // + + /** Writes the low nible of data to the LCD-module + * + * @param data Writes the low-nible to the LCD data pins D4 to D7 + */ + void writeLcdBitD4toD7(char data); + + /** Writes a Command to the LCD-module * - * @param rs Instruction/data control line - * @param rw Read/Write (is forced to '1') - * @param e Enable line (clock) - * @param d4-d7 Data lines for using as a 4-bit interface + * @param cmd command to be sendt to the LCD-Controller */ - TextLCD(PinName rs,PinName rw, PinName e, PinName d4, PinName d5, - PinName d6, PinName d7) ; - - //Writes the low lible of data to the LCD-module data pins D4 to D7 - void writeLcdBitD4toD7(char ); - - //Writes the byte comand to the LCD-module using 4 bits mode - void lcdComand(unsigned char); - - //Writes charecters to the LCD display - void lcdData(unsigned char); - + void lcdComand(unsigned char cmd); + + + /** Writes charecters to the LCD display + * + * @param data char to be sendt to the LCD-Controller + */ + void lcdData(unsigned char data); + /** moves text cursor to a screen column and row * * @param column The horizontal position from the left, indexed from 0 * @param row The vertical position from the top, indexed from 0 */ void gotoxy(int , int ); - +#if DOXYGEN_ONLY + /** Write a character to the LCD + * + * @param c The character to write to the display + */ + int putc(int c); + + /** Write a formatted string to the LCD + * + * @param format A printf-style format string, followed by the + * variables to use in formatting the string. + */ + int printf(const char* format, ...); +#endif protected: // EN = 1 for L-to-H / // EN = 0 for H-to-L @@ -81,7 +106,7 @@ void pulseEn(); //Enable 4 bit mode From KS0066U Documentation void init_4BitMode2LinesDisplayOn(); - + // Stream implementation functions /** Write a character to the LCD * @@ -89,7 +114,7 @@ */ virtual int _putc(int value); virtual int _getc(); - + DigitalOut LCD_RS,LCD_RW,LCD_EN; DigitalOut LCD_D4,LCD_D5,LCD_D6,LCD_D7; };