source: rtos_arduino/trunk/arduino_lib/hardware/arduino/samd/cores/validation/validation_I2C_multi/build_as6/LiquidCrystal_I2C.h@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 3.2 KB
Line 
1//DFRobot.com
2#ifndef LiquidCrystal_I2C_h
3#define LiquidCrystal_I2C_h
4
5//#include <inttypes.h>
6#include "Print.h"
7//#include <Wire.h>
8
9// commands
10#define LCD_CLEARDISPLAY 0x01
11#define LCD_RETURNHOME 0x02
12#define LCD_ENTRYMODESET 0x04
13#define LCD_DISPLAYCONTROL 0x08
14#define LCD_CURSORSHIFT 0x10
15#define LCD_FUNCTIONSET 0x20
16#define LCD_SETCGRAMADDR 0x40
17#define LCD_SETDDRAMADDR 0x80
18
19// flags for display entry mode
20#define LCD_ENTRYRIGHT 0x00
21#define LCD_ENTRYLEFT 0x02
22#define LCD_ENTRYSHIFTINCREMENT 0x01
23#define LCD_ENTRYSHIFTDECREMENT 0x00
24
25// flags for display on/off control
26#define LCD_DISPLAYON 0x04
27#define LCD_DISPLAYOFF 0x00
28#define LCD_CURSORON 0x02
29#define LCD_CURSOROFF 0x00
30#define LCD_BLINKON 0x01
31#define LCD_BLINKOFF 0x00
32
33// flags for display/cursor shift
34#define LCD_DISPLAYMOVE 0x08
35#define LCD_CURSORMOVE 0x00
36#define LCD_MOVERIGHT 0x04
37#define LCD_MOVELEFT 0x00
38
39// flags for function set
40#define LCD_8BITMODE 0x10
41#define LCD_4BITMODE 0x00
42#define LCD_2LINE 0x08
43#define LCD_1LINE 0x00
44#define LCD_5x10DOTS 0x04
45#define LCD_5x8DOTS 0x00
46
47// flags for backlight control
48#define LCD_BACKLIGHT 0x08
49#define LCD_NOBACKLIGHT 0x00
50
51#define En B00000100 // Enable bit
52#define Rw B00000010 // Read/Write bit
53#define Rs B00000001 // Register select bit
54
55class LiquidCrystal_I2C : public Print {
56public:
57 LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);
58 void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );
59 void clear();
60 void home();
61 void noDisplay();
62 void display();
63 void noBlink();
64 void blink();
65 void noCursor();
66 void cursor();
67 void scrollDisplayLeft();
68 void scrollDisplayRight();
69 void printLeft();
70 void printRight();
71 void leftToRight();
72 void rightToLeft();
73 void shiftIncrement();
74 void shiftDecrement();
75 void noBacklight();
76 void backlight();
77 void autoscroll();
78 void noAutoscroll();
79 void createChar(uint8_t, uint8_t[]);
80 void setCursor(uint8_t, uint8_t);
81#if defined(ARDUINO) && ARDUINO >= 100
82 virtual size_t write(uint8_t);
83#else
84 virtual void write(uint8_t);
85#endif
86 void command(uint8_t);
87 void init();
88
89////compatibility API function aliases
90void blink_on(); // alias for blink()
91void blink_off(); // alias for noBlink()
92void cursor_on(); // alias for cursor()
93void cursor_off(); // alias for noCursor()
94void setBacklight(uint8_t new_val); // alias for backlight() and nobacklight()
95void load_custom_character(uint8_t char_num, uint8_t *rows); // alias for createChar()
96void printstr(const char[]);
97
98////Unsupported API functions (not implemented in this library)
99uint8_t status();
100void setContrast(uint8_t new_val);
101uint8_t keypad();
102void setDelay(int,int);
103void on();
104void off();
105uint8_t init_bargraph(uint8_t graphtype);
106void draw_horizontal_graph(uint8_t row, uint8_t column, uint8_t len, uint8_t pixel_col_end);
107void draw_vertical_graph(uint8_t row, uint8_t column, uint8_t len, uint8_t pixel_col_end);
108
109
110private:
111 void init_priv();
112 void send(uint8_t, uint8_t);
113 void write4bits(uint8_t);
114 void expanderWrite(uint8_t);
115 void pulseEnable(uint8_t);
116 uint8_t _Addr;
117 uint8_t _displayfunction;
118 uint8_t _displaycontrol;
119 uint8_t _displaymode;
120 uint8_t _numlines;
121 uint8_t _cols;
122 uint8_t _rows;
123 uint8_t _backlightval;
124};
125
126#endif
Note: See TracBrowser for help on using the repository browser.