Extended library from C12832 Lib. by Peter Drescher, Chris Styles & Mihail Stoyanov. LCD in the market such as AQM1248A (Akizuki), AD-12864-SPI (antendo), NHD-C12832 (Newhaven), ST7565 (adafruit) and so on
Dependents: CW_Decoder_using_FFT_on_F446 LPC1114_SPI_LCD_ST7565family_test
Fork of C12832 by
Original library is below link.
http://mbed.org/teams/components/code/C12832/
https://mbed.org/users/dreschpe/code/C12832_lcd/
I extended applicable LCD's not only 128 x 32 but also 128 x 48 and 128 x 64 type of SPI LCD using ST7565 controller.
I have checked AD-12864-SPI and AQM1248 LCD.
Import programLPC1114_SPI_LCD_ST7565family_test
Controller chip is ST7565
TextDisplay.h@23:233a0d635d9d, 2020-08-05 (annotated)
- Committer:
- kenjiArai
- Date:
- Wed Aug 05 05:08:59 2020 +0000
- Revision:
- 23:233a0d635d9d
- Parent:
- 17:1c3011afe95d
added #include "Stream.h" line for running on mbed-os6.2.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreschpe | 0:4bbc531be6e2 | 1 | /* mbed TextDisplay Library Base Class |
dreschpe | 0:4bbc531be6e2 | 2 | * Copyright (c) 2007-2009 sford |
dreschpe | 0:4bbc531be6e2 | 3 | * Released under the MIT License: http://mbed.org/license/mit |
dreschpe | 0:4bbc531be6e2 | 4 | * |
dreschpe | 0:4bbc531be6e2 | 5 | * A common base class for Text displays |
dreschpe | 0:4bbc531be6e2 | 6 | * To port a new display, derive from this class and implement |
dreschpe | 0:4bbc531be6e2 | 7 | * the constructor (setup the display), character (put a character |
dreschpe | 0:4bbc531be6e2 | 8 | * at a location), rows and columns (number of rows/cols) functions. |
dreschpe | 0:4bbc531be6e2 | 9 | * Everything else (locate, printf, putc, cls) will come for free |
dreschpe | 0:4bbc531be6e2 | 10 | * |
dreschpe | 0:4bbc531be6e2 | 11 | * The model is the display will wrap at the right and bottom, so you can |
dreschpe | 0:4bbc531be6e2 | 12 | * keep writing and will always get valid characters. The location is |
dreschpe | 0:4bbc531be6e2 | 13 | * maintained internally to the class to make this easy |
dreschpe | 0:4bbc531be6e2 | 14 | */ |
dreschpe | 0:4bbc531be6e2 | 15 | |
dreschpe | 0:4bbc531be6e2 | 16 | #ifndef MBED_TEXTDISPLAY_H |
dreschpe | 0:4bbc531be6e2 | 17 | #define MBED_TEXTDISPLAY_H |
dreschpe | 0:4bbc531be6e2 | 18 | |
dreschpe | 0:4bbc531be6e2 | 19 | #include "mbed.h" |
kenjiArai | 23:233a0d635d9d | 20 | #include "Stream.h" // need on mbed-os-6.2.0, Aug. 5th, 2020 by JH1PJL |
dreschpe | 0:4bbc531be6e2 | 21 | |
screamer | 17:1c3011afe95d | 22 | /** |
screamer | 17:1c3011afe95d | 23 | * TextDisplay interface |
screamer | 17:1c3011afe95d | 24 | */ |
dreschpe | 0:4bbc531be6e2 | 25 | class TextDisplay : public Stream { |
dreschpe | 0:4bbc531be6e2 | 26 | public: |
dreschpe | 0:4bbc531be6e2 | 27 | |
screamer | 17:1c3011afe95d | 28 | /** |
screamer | 17:1c3011afe95d | 29 | * Create a TextDisplay interface |
dreschpe | 0:4bbc531be6e2 | 30 | * |
dreschpe | 0:4bbc531be6e2 | 31 | * @param name The name used in the path to access the strean through the filesystem |
dreschpe | 0:4bbc531be6e2 | 32 | */ |
dreschpe | 0:4bbc531be6e2 | 33 | TextDisplay(const char *name = NULL); |
dreschpe | 0:4bbc531be6e2 | 34 | |
screamer | 17:1c3011afe95d | 35 | /** |
screamer | 17:1c3011afe95d | 36 | * Output a character at the given position |
dreschpe | 0:4bbc531be6e2 | 37 | * |
dreschpe | 0:4bbc531be6e2 | 38 | * @param column column where charater must be written |
dreschpe | 0:4bbc531be6e2 | 39 | * @param row where character must be written |
dreschpe | 0:4bbc531be6e2 | 40 | * @param c the character to be written to the TextDisplay |
dreschpe | 0:4bbc531be6e2 | 41 | */ |
dreschpe | 0:4bbc531be6e2 | 42 | virtual void character(int column, int row, int c) = 0; |
dreschpe | 0:4bbc531be6e2 | 43 | |
screamer | 17:1c3011afe95d | 44 | /** |
screamer | 17:1c3011afe95d | 45 | * Return number of rows on TextDisplay |
screamer | 17:1c3011afe95d | 46 | * |
screamer | 17:1c3011afe95d | 47 | * @results number of rows |
dreschpe | 0:4bbc531be6e2 | 48 | */ |
dreschpe | 0:4bbc531be6e2 | 49 | virtual int rows() = 0; |
dreschpe | 0:4bbc531be6e2 | 50 | |
screamer | 17:1c3011afe95d | 51 | /** |
screamer | 17:1c3011afe95d | 52 | * Return number if columns on TextDisplay\ |
screamer | 17:1c3011afe95d | 53 | * |
screamer | 17:1c3011afe95d | 54 | * @results number of rows |
screamer | 17:1c3011afe95d | 55 | */ |
dreschpe | 0:4bbc531be6e2 | 56 | virtual int columns() = 0; |
dreschpe | 0:4bbc531be6e2 | 57 | |
dreschpe | 0:4bbc531be6e2 | 58 | // functions that come for free, but can be overwritten |
dreschpe | 0:4bbc531be6e2 | 59 | |
screamer | 17:1c3011afe95d | 60 | /** |
screamer | 17:1c3011afe95d | 61 | * Redirect output from a stream (stoud, sterr) to display |
screamer | 17:1c3011afe95d | 62 | * |
screamer | 17:1c3011afe95d | 63 | * @param stream stream that shall be redirected to the TextDisplay |
screamer | 17:1c3011afe95d | 64 | */ |
dreschpe | 0:4bbc531be6e2 | 65 | virtual bool claim (FILE *stream); |
dreschpe | 0:4bbc531be6e2 | 66 | |
screamer | 17:1c3011afe95d | 67 | /** |
screamer | 17:1c3011afe95d | 68 | * Clear screen |
screamer | 17:1c3011afe95d | 69 | */ |
dreschpe | 0:4bbc531be6e2 | 70 | virtual void cls(); |
screamer | 17:1c3011afe95d | 71 | |
screamer | 17:1c3011afe95d | 72 | /** |
screamer | 17:1c3011afe95d | 73 | * Change the cursor position to column, row (in pixels) |
screamer | 17:1c3011afe95d | 74 | */ |
dreschpe | 0:4bbc531be6e2 | 75 | virtual void locate(int column, int row); |
screamer | 17:1c3011afe95d | 76 | |
dreschpe | 0:4bbc531be6e2 | 77 | virtual void foreground(uint16_t colour); |
dreschpe | 0:4bbc531be6e2 | 78 | virtual void background(uint16_t colour); |
dreschpe | 0:4bbc531be6e2 | 79 | // putc (from Stream) |
dreschpe | 0:4bbc531be6e2 | 80 | // printf (from Stream) |
dreschpe | 0:4bbc531be6e2 | 81 | |
dreschpe | 0:4bbc531be6e2 | 82 | protected: |
dreschpe | 0:4bbc531be6e2 | 83 | |
dreschpe | 0:4bbc531be6e2 | 84 | virtual int _putc(int value); |
dreschpe | 0:4bbc531be6e2 | 85 | virtual int _getc(); |
dreschpe | 0:4bbc531be6e2 | 86 | |
dreschpe | 0:4bbc531be6e2 | 87 | // character location |
dreschpe | 0:4bbc531be6e2 | 88 | uint16_t _column; |
dreschpe | 0:4bbc531be6e2 | 89 | uint16_t _row; |
dreschpe | 0:4bbc531be6e2 | 90 | |
dreschpe | 0:4bbc531be6e2 | 91 | // colours |
dreschpe | 0:4bbc531be6e2 | 92 | uint16_t _foreground; |
dreschpe | 0:4bbc531be6e2 | 93 | uint16_t _background; |
dreschpe | 0:4bbc531be6e2 | 94 | char *_path; |
dreschpe | 0:4bbc531be6e2 | 95 | }; |
dreschpe | 0:4bbc531be6e2 | 96 | |
dreschpe | 0:4bbc531be6e2 | 97 | #endif |