C12832 LCD kanji interface.
Fork of GraphicOLED by
- 8×8 ドット日本語フォント「美咲フォント」
- misaki2cpp.py 美咲フォントをC++コードへ変換。
- app-board-LCD
C12832_KANJI.h@4:28a12c8608db, 2014-09-04 (annotated)
- Committer:
- va009039
- Date:
- Thu Sep 04 03:43:30 2014 +0000
- Revision:
- 4:28a12c8608db
- Parent:
- GraphicOLED.h@3:a6650dd2dbc8
for C12832 LCD
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 4:28a12c8608db | 1 | // C12832_KANJI.h |
va009039 | 2:337a2655f815 | 2 | #pragma once |
va009039 | 2:337a2655f815 | 3 | #include "mbed.h" |
va009039 | 0:67d983a1ed3e | 4 | |
va009039 | 4:28a12c8608db | 5 | /** C12832 interface |
va009039 | 1:a104653979bf | 6 | * |
va009039 | 2:337a2655f815 | 7 | * Currently support UTF-8 KANJI(misaki font) |
va009039 | 1:a104653979bf | 8 | * |
va009039 | 1:a104653979bf | 9 | * @code |
va009039 | 1:a104653979bf | 10 | * #include "mbed.h" |
va009039 | 4:28a12c8608db | 11 | * #include "C12832_KANJI.h" |
va009039 | 1:a104653979bf | 12 | * |
va009039 | 4:28a12c8608db | 13 | * C12832_KANJI lcd(p5, p7, p6, p8, p11); |
va009039 | 1:a104653979bf | 14 | * |
va009039 | 1:a104653979bf | 15 | * int main() { |
va009039 | 4:28a12c8608db | 16 | * led.printf("Hello World!\n"); |
va009039 | 1:a104653979bf | 17 | * } |
va009039 | 1:a104653979bf | 18 | * @endcode |
va009039 | 1:a104653979bf | 19 | */ |
va009039 | 4:28a12c8608db | 20 | class C12832_KANJI : public Stream { |
va009039 | 0:67d983a1ed3e | 21 | public: |
va009039 | 4:28a12c8608db | 22 | /** Create a C12832_KANJI interface |
va009039 | 1:a104653979bf | 23 | */ |
va009039 | 4:28a12c8608db | 24 | C12832_KANJI(PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs); |
va009039 | 2:337a2655f815 | 25 | |
va009039 | 2:337a2655f815 | 26 | #if DOXYGEN_ONLY |
va009039 | 4:28a12c8608db | 27 | /** Write a character to the LCD |
va009039 | 2:337a2655f815 | 28 | * |
va009039 | 2:337a2655f815 | 29 | * @param c The character to write to the display |
va009039 | 2:337a2655f815 | 30 | */ |
va009039 | 2:337a2655f815 | 31 | int putc(int c); |
va009039 | 2:337a2655f815 | 32 | |
va009039 | 4:28a12c8608db | 33 | /** Write a formated string to the LCD |
va009039 | 2:337a2655f815 | 34 | * |
va009039 | 2:337a2655f815 | 35 | * @param format A printf-style format string, followed by the |
va009039 | 2:337a2655f815 | 36 | * variables to use in formating the string. |
va009039 | 2:337a2655f815 | 37 | */ |
va009039 | 2:337a2655f815 | 38 | int printf(const char* format, ...); |
va009039 | 2:337a2655f815 | 39 | #endif |
va009039 | 2:337a2655f815 | 40 | |
va009039 | 2:337a2655f815 | 41 | /** Locate to a screen column and row |
va009039 | 2:337a2655f815 | 42 | * |
va009039 | 2:337a2655f815 | 43 | * @param column The horizontal position from the left, indexed from 0 |
va009039 | 2:337a2655f815 | 44 | * @param row The vertical position from the top, indexed from 0 |
va009039 | 2:337a2655f815 | 45 | */ |
va009039 | 2:337a2655f815 | 46 | void locate(int column, int row); |
va009039 | 2:337a2655f815 | 47 | |
va009039 | 2:337a2655f815 | 48 | /** Clear the screen and locate to 0,0 */ |
va009039 | 0:67d983a1ed3e | 49 | void cls(); |
va009039 | 2:337a2655f815 | 50 | |
va009039 | 2:337a2655f815 | 51 | int rows(); |
va009039 | 0:67d983a1ed3e | 52 | int columns(); |
va009039 | 2:337a2655f815 | 53 | |
va009039 | 2:337a2655f815 | 54 | void g_write(uint8_t pat, int x, int y); |
va009039 | 2:337a2655f815 | 55 | void g_write(uint8_t *buf, int len, int x, int y); |
va009039 | 2:337a2655f815 | 56 | |
va009039 | 2:337a2655f815 | 57 | private: |
va009039 | 3:a6650dd2dbc8 | 58 | int _uni_len; |
va009039 | 3:a6650dd2dbc8 | 59 | uint32_t _unicode; |
va009039 | 2:337a2655f815 | 60 | |
va009039 | 2:337a2655f815 | 61 | // Stream implementation functions |
va009039 | 2:337a2655f815 | 62 | virtual int _putc(int value); |
va009039 | 2:337a2655f815 | 63 | virtual int _getc(); |
va009039 | 2:337a2655f815 | 64 | |
va009039 | 3:a6650dd2dbc8 | 65 | int character(int column, int row, int c); |
va009039 | 2:337a2655f815 | 66 | void writeByte(uint8_t value); |
va009039 | 2:337a2655f815 | 67 | void writeCommand(uint8_t command); |
va009039 | 2:337a2655f815 | 68 | void writeData(uint8_t data); |
va009039 | 2:337a2655f815 | 69 | |
va009039 | 4:28a12c8608db | 70 | SPI _spi; |
va009039 | 4:28a12c8608db | 71 | DigitalOut _reset,_A0,_CS; |
va009039 | 2:337a2655f815 | 72 | |
va009039 | 2:337a2655f815 | 73 | int _column; |
va009039 | 2:337a2655f815 | 74 | int _row; |
va009039 | 0:67d983a1ed3e | 75 | }; |
va009039 | 2:337a2655f815 | 76 |