![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Wave-Player with TLV320
Dependencies: FatFileSystemCpp I2SSlave TLV320 mbed
LCD/LCD.h@0:3087f1924901, 2015-12-09 (annotated)
- Committer:
- HB9GAA
- Date:
- Wed Dec 09 20:58:55 2015 +0000
- Revision:
- 0:3087f1924901
Wave-Player with TLV320
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
HB9GAA | 0:3087f1924901 | 1 | /* mbed LCD Library, for a 4-bit LCD based on HD44780 |
HB9GAA | 0:3087f1924901 | 2 | * Copyright (c) 2007-2012, hb9gaa |
HB9GAA | 0:3087f1924901 | 3 | */ |
HB9GAA | 0:3087f1924901 | 4 | |
HB9GAA | 0:3087f1924901 | 5 | #ifndef MBED_LCD_H |
HB9GAA | 0:3087f1924901 | 6 | #define MBED_LCD_H |
HB9GAA | 0:3087f1924901 | 7 | |
HB9GAA | 0:3087f1924901 | 8 | #include "mbed.h" |
HB9GAA | 0:3087f1924901 | 9 | |
HB9GAA | 0:3087f1924901 | 10 | class TextLCD : public Stream { |
HB9GAA | 0:3087f1924901 | 11 | public: |
HB9GAA | 0:3087f1924901 | 12 | |
HB9GAA | 0:3087f1924901 | 13 | /** LCD panel format */ |
HB9GAA | 0:3087f1924901 | 14 | enum LCDType { |
HB9GAA | 0:3087f1924901 | 15 | LCD16x2 /**< 16x2 LCD panel (default) */ |
HB9GAA | 0:3087f1924901 | 16 | , LCD16x2B /**< 16x2 LCD panel alternate addressing */ |
HB9GAA | 0:3087f1924901 | 17 | , LCD20x2 /**< 20x2 LCD panel */ |
HB9GAA | 0:3087f1924901 | 18 | , LCD20x4 /**< 20x4 LCD panel */ |
HB9GAA | 0:3087f1924901 | 19 | }; |
HB9GAA | 0:3087f1924901 | 20 | |
HB9GAA | 0:3087f1924901 | 21 | /** Create a TextLCD interface |
HB9GAA | 0:3087f1924901 | 22 | * @param rs Instruction/data control line |
HB9GAA | 0:3087f1924901 | 23 | * @param e Enable line (clock) |
HB9GAA | 0:3087f1924901 | 24 | * @param d0-d3 Data lines |
HB9GAA | 0:3087f1924901 | 25 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
HB9GAA | 0:3087f1924901 | 26 | */ |
HB9GAA | 0:3087f1924901 | 27 | TextLCD(PinName rs, PinName rw, PinName e, PinName d0, PinName d1, PinName d2, PinName d3, LCDType type = LCD16x2); |
HB9GAA | 0:3087f1924901 | 28 | |
HB9GAA | 0:3087f1924901 | 29 | /** Write a character to the LCD |
HB9GAA | 0:3087f1924901 | 30 | * @param c The character to write to the display |
HB9GAA | 0:3087f1924901 | 31 | */ |
HB9GAA | 0:3087f1924901 | 32 | int putc(int c); |
HB9GAA | 0:3087f1924901 | 33 | |
HB9GAA | 0:3087f1924901 | 34 | /** Locate to a screen column and row |
HB9GAA | 0:3087f1924901 | 35 | * @param column The horizontal position from the left, indexed from 0 |
HB9GAA | 0:3087f1924901 | 36 | * @param row The vertical position from the top, indexed from 0 |
HB9GAA | 0:3087f1924901 | 37 | */ |
HB9GAA | 0:3087f1924901 | 38 | void locate(int column, int row); |
HB9GAA | 0:3087f1924901 | 39 | void buildChar(unsigned char *p); |
HB9GAA | 0:3087f1924901 | 40 | |
HB9GAA | 0:3087f1924901 | 41 | /** Clear the screen and locate to 0,0 */ |
HB9GAA | 0:3087f1924901 | 42 | void cls(); |
HB9GAA | 0:3087f1924901 | 43 | |
HB9GAA | 0:3087f1924901 | 44 | int rows(); |
HB9GAA | 0:3087f1924901 | 45 | int columns(); |
HB9GAA | 0:3087f1924901 | 46 | |
HB9GAA | 0:3087f1924901 | 47 | protected: |
HB9GAA | 0:3087f1924901 | 48 | |
HB9GAA | 0:3087f1924901 | 49 | // Stream implementation functions |
HB9GAA | 0:3087f1924901 | 50 | virtual int _putc(int value); |
HB9GAA | 0:3087f1924901 | 51 | virtual int _getc(); |
HB9GAA | 0:3087f1924901 | 52 | |
HB9GAA | 0:3087f1924901 | 53 | int address(int column, int row); |
HB9GAA | 0:3087f1924901 | 54 | void character(int column, int row, int c); |
HB9GAA | 0:3087f1924901 | 55 | void writeByte(int value); |
HB9GAA | 0:3087f1924901 | 56 | void writeCommand(int command); |
HB9GAA | 0:3087f1924901 | 57 | void writeData(int data); |
HB9GAA | 0:3087f1924901 | 58 | |
HB9GAA | 0:3087f1924901 | 59 | DigitalOut _rs, _rw, _e; |
HB9GAA | 0:3087f1924901 | 60 | BusOut _d; |
HB9GAA | 0:3087f1924901 | 61 | LCDType _type; |
HB9GAA | 0:3087f1924901 | 62 | |
HB9GAA | 0:3087f1924901 | 63 | int _column; |
HB9GAA | 0:3087f1924901 | 64 | int _row; |
HB9GAA | 0:3087f1924901 | 65 | }; |
HB9GAA | 0:3087f1924901 | 66 | |
HB9GAA | 0:3087f1924901 | 67 | #endif |