Graphic OLED 100x16 pixels interface
Dependents: mbed_nicovideo_search_api mbed_recent_nicovideo_display_pub
- グラフィック有機ELモジュール100x16
- 8×8 ドット日本語フォント「美咲フォント」
- misaki2cpp.py 美咲フォントをC++コードへ変換。
Diff: GraphicOLED.h
- Revision:
- 2:337a2655f815
- Parent:
- 1:a104653979bf
- Child:
- 3:a6650dd2dbc8
--- a/GraphicOLED.h Wed Apr 18 10:17:51 2012 +0000 +++ b/GraphicOLED.h Mon Aug 04 06:17:36 2014 +0000 @@ -1,14 +1,14 @@ // GraphicOLED.h -#ifndef MBED_GRAPHIC_OLED_H -#define MBED_GRAPHIC_OLED_H -#include "TextLCD.h" +#pragma once + +#include "mbed.h" #define iskanji(c) ((c)>=0x81 && (c)<=0x9F || (c)>=0xE0 && (c)<=0xFC) #define iskanji2(c) ((c)>=0x40 && (c)<=0xFC && (c)!=0x7F) /** GraphicOLED interface for WS0010 * - * Currently support shift-jis KANJI(misaki font) + * Currently support UTF-8 KANJI(misaki font) * * @code * #include "mbed.h" @@ -21,7 +21,7 @@ * } * @endcode */ -class GraphicOLED : public TextLCD { +class GraphicOLED : public Stream { public: /** Create a GraphicOLED interface * @@ -30,15 +30,57 @@ * @param d4-d7 Data lines for using as a 4-bit interface */ GraphicOLED(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7); + +#if DOXYGEN_ONLY + /** Write a character to the LCD + * + * @param c The character to write to the display + */ + int putc(int c); + + /** Write a formated string to the LCD + * + * @param format A printf-style format string, followed by the + * variables to use in formating the string. + */ + int printf(const char* format, ...); +#endif + + /** Locate 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 locate(int column, int row); + + /** Clear the screen and locate to 0,0 */ void cls(); + + int rows(); int columns(); -protected: - void g_wrtie(int pat, int x, int y); - void g_wrtie(char *buf, int len, int x, int y); - virtual int _putc(int value); - void character(int column, int row, int c); + + void g_write(uint8_t pat, int x, int y); + void g_write(uint8_t *buf, int len, int x, int y); + +private: void character2(int column, int row, int c); bool _kanji_flag; int _kanji_1st; + + // Stream implementation functions + virtual int _putc(int value); + virtual int _getc(); + + int address(int column, int row); + void character(int column, int row, int c); + void writeByte(uint8_t value); + void writeCommand(uint8_t command); + void writeData(uint8_t data); + + DigitalOut _rs, _e; + BusOut _d; + + int _column; + int _row; }; -#endif \ No newline at end of file +