├── README ├── ST7032.cpp ├── ST7032.h ├── arduino_st7032_sch.CE3 ├── arduino_st7032_sch.png ├── component.mk ├── examples ├── Autoscroll │ └── Autoscroll.ino ├── Blink │ └── Blink.ino ├── Cursor │ └── Cursor.ino ├── CustomCharacter │ └── CustomCharacter.ino ├── Display │ └── Display.ino ├── HelloWorld │ └── HelloWorld.ino ├── Icon │ └── Icon.ino ├── Scroll │ └── Scroll.ino ├── SerialDisplay │ └── SerialDisplay.ino ├── TextDirection │ └── TextDirection.ino └── setCursor │ └── setCursor.ino ├── keywords.txt └── library.json /README: -------------------------------------------------------------------------------- 1 | ST7032 - Arduino LiquidCrystal compatible library 2 | http://ore-kb.net/archives/195 3 | 4 | ------------------------------------------------------------- 5 | 概要 6 | ------------------------------------------------------------- 7 | 8 | コントローラに ST7032i を使った I2C LCD ディスプレイの 9 | Arduino ライブラリです。 10 | LiquidCrystal ライブラリのソースを元に作成しています。 11 | LiquidCrystal ライブラリのメンバ関数と互換性があるため、 12 | クラスを差し替えるだけで使用できます。 13 | 14 | 動作確認済み 15 | 16 | SB1602B Strawberry Linux 17 | SB0802G Strawberry Linux 18 | AQM0802A-RN-GBW 秋月電子通商 19 | 20 | 動作すると思われるもの 21 | 22 | SB1602E Strawberry Linux 23 | LCD16X2-I2C aitendo 24 | SPLC792-I2C-M aitendo 25 | 16X2-SPLC792-I2C aitendo 26 | 27 | 28 | ------------------------------------------------------------- 29 | 更新履歴 30 | ------------------------------------------------------------- 31 | 32 | 2014.10.13 コントラスト値のbit7がBONビットに影響する不具合を修正 33 | 2014.08.23 コンストラクタでI2Cアドレスを設定可能にした 34 | 2013.05.21 1st release 35 | 36 | 37 | ------------------------------------------------------------- 38 | ライセンス 39 | ------------------------------------------------------------- 40 | 41 | 作成者: 42 | tomozh (tomozh@gmail.com) 43 | 44 | ライセンス形態: 45 | MIT 46 | 47 | 48 | ------------------------------------------------------------- 49 | 使用方法 50 | ------------------------------------------------------------- 51 | 52 | 1) モジュールと Arduino を以下のように接続します 53 | 54 | ------------------------ 55 | Arduino ST7032 56 | ------------------------ 57 | 3.3V --+-- VDD 58 | +-- -RES 59 | A4(SDA) --*-- SDA 60 | A5(SCL) --*-- SCL 61 | GND ----- GND 62 | 63 | *... 10Kohm pull-up 64 | ------------------------ 65 | 66 | LCDを確実にリセットしたい場合は、RST 端子を Arduino の 67 | 空き端子で制御してください。(Low:リセット) 68 | 69 | 2) ST7032 フォルダを Arduino の libraries フォルダにコピーします 70 | 71 | 72 | ST7032 独自のメンバ関数は以下の2種類です。 73 | 74 | コンストラクタ 75 | ST7032 lcd(int i2c_addr); 76 | i2c_addr: スレーブアドレス 77 | コンストラクタ引数を省略した場合は 0x3E 78 | 79 | コントラスト設定 80 | void setContrast(uint8_t cont) 81 | cont: コントラスト値 (0~63) 82 | 83 | アイコン表示 (※アイコン表示機能の無いLCDは無効) 84 | void setIcon(uint8_t addr, uint8_t bit) 85 | addr : アイコンアドレス (0~15) 86 | bit : アイコン表示ビット (0x00~0x1F) 87 | 88 | 簡単な使い方 89 | 90 | #include 91 | #include 92 | 93 | ST7032 lcd; 94 | 95 | lcd.setContrast(30); // コントラスト設定 96 | lcd.print("hello, world!"); 97 | 98 | 99 | スレーブアドレスを指定する場合 100 | 101 | ST7032 lcd(0x3E); 102 | 103 | 104 | 105 | ------------------------------------------------------------- 106 | ファイル構成 107 | ------------------------------------------------------------- 108 | 109 | ST7032\ 110 | keywords.txt 111 | ST7032.cpp ST7032 ライブラリ 112 | ST7032.h ST7032 ライブラリ 113 | examples\ 114 | Icon Strawberry Linux SB1602B 用アイコン表示デモ 115 | Autoscroll (*) 116 | Blink (*) 117 | Cursor (*) 118 | CustomCharacter (*) 119 | Display (*) 120 | HelloWorld (*) 121 | Scroll (*) 122 | SerialDisplay (*) 123 | setCursor (*) 124 | TextDirection (*) 125 | 126 | (*)…LiquidCrystal liblary を ST032 用に改変 127 | 128 | 129 | -------------------------------------------------------------------------------- /ST7032.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032.cpp - Arduino LiquidCrystal compatible library 3 | 4 | Original source is Arduino LiquidCrystal liblary 5 | 6 | Author: tomozh@gmail.com 7 | License: MIT 8 | 9 | History: 10 | 2014.10.13 コントラスト値のbit7がBONビットに影響する不具合を修正 11 | 2014.08.23 コンストラクタでI2Cアドレスを設定可能にした 12 | 2013.05.21 1st release 13 | 14 | ------------------------ 15 | Arduino ST7032i 16 | ------------------------ 17 | 3.3V --+-- VDD 18 | +-- -RES 19 | A4(SDA) --*-- SDA 20 | A5(SCL) --*-- SCL 21 | GND ----- GND 22 | 23 | *... 10Kohm pull-up 24 | ------------------------ 25 | 26 | */ 27 | 28 | 29 | #include "ST7032.h" 30 | #include "Arduino.h" 31 | #include 32 | #if defined(__AVR__) 33 | #include 34 | #endif 35 | 36 | // private methods 37 | 38 | void ST7032::setDisplayControl(uint8_t setBit) { 39 | _displaycontrol |= setBit; 40 | command(LCD_DISPLAYCONTROL | _displaycontrol); 41 | } 42 | 43 | void ST7032::resetDisplayControl(uint8_t resetBit) { 44 | _displaycontrol &= ~resetBit; 45 | command(LCD_DISPLAYCONTROL | _displaycontrol); 46 | } 47 | 48 | void ST7032::setEntryMode(uint8_t setBit) { 49 | _displaymode |= setBit; 50 | command(LCD_ENTRYMODESET | _displaymode); 51 | } 52 | 53 | void ST7032::resetEntryMode(uint8_t resetBit) { 54 | _displaymode &= ~resetBit; 55 | command(LCD_ENTRYMODESET | _displaymode); 56 | } 57 | 58 | void ST7032::normalFunctionSet() { 59 | command(LCD_FUNCTIONSET | _displayfunction); 60 | } 61 | 62 | void ST7032::extendFunctionSet() { 63 | command(LCD_FUNCTIONSET | _displayfunction | LCD_EX_INSTRUCTION); 64 | } 65 | 66 | 67 | // public methods 68 | 69 | 70 | ST7032::ST7032(int i2c_addr) 71 | : _displaycontrol(0x00) 72 | , _displaymode(0x00) 73 | , _i2c_addr((uint8_t)i2c_addr) 74 | { 75 | // begin(16, 1); 76 | } 77 | 78 | void ST7032::begin(uint8_t cols, uint8_t lines, uint8_t dotsize) { 79 | 80 | _displayfunction = LCD_8BITMODE | LCD_1LINE | LCD_5x8DOTS; 81 | 82 | if (lines > 1) { 83 | _displayfunction |= LCD_2LINE; 84 | } 85 | _numlines = lines; 86 | _currline = 0; 87 | 88 | // for some 1 line displays you can select a 10 pixel high font 89 | if ((dotsize != 0) && (lines == 1)) { 90 | _displayfunction |= LCD_5x10DOTS; 91 | } 92 | 93 | Wire.begin(); 94 | delay(40); // Wait time >40ms After VDD stable 95 | 96 | // finally, set # lines, font size, etc. 97 | normalFunctionSet(); 98 | 99 | extendFunctionSet(); 100 | command(LCD_EX_SETBIASOSC | LCD_BIAS_1_5 | LCD_OSC_183HZ); // 1/5bias, OSC=183Hz@3.0V 101 | command(LCD_EX_FOLLOWERCONTROL | LCD_FOLLOWER_ON | LCD_RAB_2_00); // internal follower circuit is turn on 102 | delay(200); // Wait time >200ms (for power stable) 103 | normalFunctionSet(); 104 | 105 | // turn the display on with no cursor or blinking default 106 | // display(); 107 | _displaycontrol = 0x00;//LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF; 108 | setDisplayControl(LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF); 109 | 110 | // clear it off 111 | clear(); 112 | 113 | // Initialize to default text direction (for romance languages) 114 | // command(LCD_ENTRYMODESET | _displaymode); 115 | _displaymode = 0x00;//LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT; 116 | setEntryMode(LCD_ENTRYLEFT | LCD_ENTRYSHIFTDECREMENT); 117 | } 118 | 119 | void ST7032::setContrast(uint8_t cont) 120 | { 121 | extendFunctionSet(); 122 | command(LCD_EX_CONTRASTSETL | (cont & 0x0f)); // Contrast set 123 | command(LCD_EX_POWICONCONTRASTH | LCD_ICON_ON | LCD_BOOST_ON | ((cont >> 4) & 0x03)); // Power, ICON, Contrast control 124 | normalFunctionSet(); 125 | } 126 | 127 | void ST7032::setIcon(uint8_t addr, uint8_t bit) { 128 | extendFunctionSet(); 129 | command(LCD_EX_SETICONRAMADDR | (addr & 0x0f)); // ICON address 130 | write(bit); 131 | normalFunctionSet(); 132 | } 133 | 134 | /********** high level commands, for the user! */ 135 | void ST7032::clear() 136 | { 137 | command(LCD_CLEARDISPLAY); // clear display, set cursor position to zero 138 | delayMicroseconds(2000); // this command takes a long time! 139 | } 140 | 141 | void ST7032::home() 142 | { 143 | command(LCD_RETURNHOME); // set cursor position to zero 144 | delayMicroseconds(2000); // this command takes a long time! 145 | } 146 | 147 | void ST7032::setCursor(uint8_t col, uint8_t row) 148 | { 149 | const int row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; 150 | 151 | if ( row > _numlines ) { 152 | row = _numlines-1; // we count rows starting w/0 153 | } 154 | 155 | command(LCD_SETDDRAMADDR | (col + row_offsets[row])); 156 | } 157 | 158 | // Turn the display on/off (quickly) 159 | void ST7032::noDisplay() { 160 | resetDisplayControl(LCD_DISPLAYON); 161 | } 162 | void ST7032::display() { 163 | setDisplayControl(LCD_DISPLAYON); 164 | } 165 | 166 | // Turns the underline cursor on/off 167 | void ST7032::noCursor() { 168 | resetDisplayControl(LCD_CURSORON); 169 | } 170 | void ST7032::cursor() { 171 | setDisplayControl(LCD_CURSORON); 172 | } 173 | 174 | // Turn on and off the blinking cursor 175 | void ST7032::noBlink() { 176 | resetDisplayControl(LCD_BLINKON); 177 | } 178 | void ST7032::blink() { 179 | setDisplayControl(LCD_BLINKON); 180 | } 181 | 182 | // These commands scroll the display without changing the RAM 183 | void ST7032::scrollDisplayLeft(void) { 184 | command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT); 185 | } 186 | 187 | void ST7032::scrollDisplayRight(void) { 188 | command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT); 189 | } 190 | 191 | // This is for text that flows Left to Right 192 | void ST7032::leftToRight(void) { 193 | setEntryMode(LCD_ENTRYLEFT); 194 | } 195 | 196 | // This is for text that flows Right to Left 197 | void ST7032::rightToLeft(void) { 198 | resetEntryMode(LCD_ENTRYLEFT); 199 | } 200 | 201 | // This will 'right justify' text from the cursor 202 | void ST7032::autoscroll(void) { 203 | setEntryMode(LCD_ENTRYSHIFTINCREMENT); 204 | } 205 | 206 | // This will 'left justify' text from the cursor 207 | void ST7032::noAutoscroll(void) { 208 | resetEntryMode(LCD_ENTRYSHIFTINCREMENT); 209 | } 210 | 211 | // Allows us to fill the first 8 CGRAM locations 212 | // with custom characters 213 | void ST7032::createChar(uint8_t location, uint8_t charmap[]) { 214 | location &= 0x7; // we only have 8 locations 0-7 215 | command(LCD_SETCGRAMADDR | (location << 3)); 216 | for (int i=0; i<8; i++) { 217 | write(charmap[i]); 218 | } 219 | } 220 | 221 | /*********** mid level commands, for sending data/cmds */ 222 | 223 | void ST7032::command(uint8_t value) { 224 | Wire.beginTransmission(_i2c_addr); 225 | Wire.write((uint8_t)0x00); 226 | Wire.write(value); 227 | Wire.endTransmission(); 228 | delayMicroseconds(27); // >26.3us 229 | } 230 | 231 | size_t ST7032::write(uint8_t value) { 232 | Wire.beginTransmission(_i2c_addr); 233 | Wire.write((uint8_t)0x40); 234 | Wire.write(value); 235 | Wire.endTransmission(); 236 | delayMicroseconds(27); // >26.3us 237 | 238 | return 1; 239 | } 240 | 241 | -------------------------------------------------------------------------------- /ST7032.h: -------------------------------------------------------------------------------- 1 | #ifndef __ST7032_H__ 2 | #define __ST7032_H__ 3 | 4 | #include 5 | #include 6 | 7 | 8 | #define ST7032_I2C_DEFAULT_ADDR 0x3E 9 | 10 | 11 | // commands 12 | #define LCD_CLEARDISPLAY 0x01 13 | #define LCD_RETURNHOME 0x02 14 | #define LCD_ENTRYMODESET 0x04 15 | #define LCD_DISPLAYCONTROL 0x08 16 | #define LCD_CURSORSHIFT 0x10 17 | #define LCD_FUNCTIONSET 0x20 18 | #define LCD_SETCGRAMADDR 0x40 19 | #define LCD_SETDDRAMADDR 0x80 20 | 21 | #define LCD_EX_SETBIASOSC 0x10 // Bias selection / Internal OSC frequency adjust 22 | #define LCD_EX_SETICONRAMADDR 0x40 // Set ICON RAM address 23 | #define LCD_EX_POWICONCONTRASTH 0x50 // Power / ICON control / Contrast set(high byte) 24 | #define LCD_EX_FOLLOWERCONTROL 0x60 // Follower control 25 | #define LCD_EX_CONTRASTSETL 0x70 // Contrast set(low byte) 26 | 27 | // flags for display entry mode 28 | #define LCD_ENTRYRIGHT 0x00 29 | #define LCD_ENTRYLEFT 0x02 30 | #define LCD_ENTRYSHIFTINCREMENT 0x01 31 | #define LCD_ENTRYSHIFTDECREMENT 0x00 32 | 33 | // flags for display on/off control 34 | #define LCD_DISPLAYON 0x04 35 | #define LCD_DISPLAYOFF 0x00 36 | #define LCD_CURSORON 0x02 37 | #define LCD_CURSOROFF 0x00 38 | #define LCD_BLINKON 0x01 39 | #define LCD_BLINKOFF 0x00 40 | 41 | // flags for display/cursor shift 42 | #define LCD_DISPLAYMOVE 0x08 43 | #define LCD_CURSORMOVE 0x00 44 | #define LCD_MOVERIGHT 0x04 45 | #define LCD_MOVELEFT 0x00 46 | 47 | // flags for function set 48 | #define LCD_8BITMODE 0x10 49 | #define LCD_4BITMODE 0x00 50 | #define LCD_2LINE 0x08 51 | #define LCD_1LINE 0x00 52 | #define LCD_5x10DOTS 0x04 53 | #define LCD_5x8DOTS 0x00 54 | #define LCD_EX_INSTRUCTION 0x01 // IS: instruction table select 55 | 56 | // flags for Bias selection 57 | #define LCD_BIAS_1_4 0x08 // bias will be 1/4 58 | #define LCD_BIAS_1_5 0x00 // bias will be 1/5 59 | 60 | // flags Power / ICON control / Contrast set(high byte) 61 | #define LCD_ICON_ON 0x08 // ICON display on 62 | #define LCD_ICON_OFF 0x00 // ICON display off 63 | #define LCD_BOOST_ON 0x04 // booster circuit is turn on 64 | #define LCD_BOOST_OFF 0x00 // booster circuit is turn off 65 | #define LCD_OSC_122HZ 0x00 // 122Hz@3.0V 66 | #define LCD_OSC_131HZ 0x01 // 131Hz@3.0V 67 | #define LCD_OSC_144HZ 0x02 // 144Hz@3.0V 68 | #define LCD_OSC_161HZ 0x03 // 161Hz@3.0V 69 | #define LCD_OSC_183HZ 0x04 // 183Hz@3.0V 70 | #define LCD_OSC_221HZ 0x05 // 221Hz@3.0V 71 | #define LCD_OSC_274HZ 0x06 // 274Hz@3.0V 72 | #define LCD_OSC_347HZ 0x07 // 347Hz@3.0V 73 | 74 | // flags Follower control 75 | #define LCD_FOLLOWER_ON 0x08 // internal follower circuit is turn on 76 | #define LCD_FOLLOWER_OFF 0x00 // internal follower circuit is turn off 77 | #define LCD_RAB_1_00 0x00 // 1+(Rb/Ra)=1.00 78 | #define LCD_RAB_1_25 0x01 // 1+(Rb/Ra)=1.25 79 | #define LCD_RAB_1_50 0x02 // 1+(Rb/Ra)=1.50 80 | #define LCD_RAB_1_80 0x03 // 1+(Rb/Ra)=1.80 81 | #define LCD_RAB_2_00 0x04 // 1+(Rb/Ra)=2.00 82 | #define LCD_RAB_2_50 0x05 // 1+(Rb/Ra)=2.50 83 | #define LCD_RAB_3_00 0x06 // 1+(Rb/Ra)=3.00 84 | #define LCD_RAB_3_75 0x07 // 1+(Rb/Ra)=3.75 85 | 86 | 87 | class ST7032 : public Print { 88 | public: 89 | ST7032(int i2c_addr = ST7032_I2C_DEFAULT_ADDR); 90 | 91 | void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS); 92 | 93 | void setContrast(uint8_t cont); 94 | void setIcon(uint8_t addr, uint8_t bit); 95 | void clear(); 96 | void home(); 97 | 98 | void noDisplay(); 99 | void display(); 100 | void noBlink(); 101 | void blink(); 102 | void noCursor(); 103 | void cursor(); 104 | void scrollDisplayLeft(); 105 | void scrollDisplayRight(); 106 | void leftToRight(); 107 | void rightToLeft(); 108 | void autoscroll(); 109 | void noAutoscroll(); 110 | 111 | void createChar(uint8_t location, uint8_t charmap[]); 112 | void setCursor(uint8_t col, uint8_t row); 113 | virtual size_t write(uint8_t value); 114 | void command(uint8_t value); 115 | 116 | private: 117 | void setDisplayControl(uint8_t setBit); 118 | void resetDisplayControl(uint8_t resetBit); 119 | void setEntryMode(uint8_t setBit); 120 | void resetEntryMode(uint8_t resetBit); 121 | void normalFunctionSet(); 122 | void extendFunctionSet(); 123 | 124 | // void send(uint8_t, uint8_t); 125 | /* 126 | uint8_t _rs_pin; // LOW: command. HIGH: character. 127 | uint8_t _rw_pin; // LOW: write to LCD. HIGH: read from LCD. 128 | uint8_t _enable_pin; // activated by a HIGH pulse. 129 | uint8_t _data_pins[8]; 130 | */ 131 | uint8_t _displayfunction; 132 | uint8_t _displaycontrol; 133 | uint8_t _displaymode; 134 | // uint8_t _iconfunction; 135 | 136 | uint8_t _initialized; 137 | 138 | uint8_t _numlines; 139 | uint8_t _currline; 140 | 141 | uint8_t _i2c_addr; 142 | }; 143 | 144 | #endif // __ST7032_H__ 145 | -------------------------------------------------------------------------------- /arduino_st7032_sch.CE3: -------------------------------------------------------------------------------- 1 | +BSCH3_DATA_V.1.0 2 | +SHEETINFO,EL:0,VL:255,W:1550,H:1050,-SHEETINFO 3 | +TAG,L:0,X:170,Y:210,D:1,T:2,S:GND%20%20%20%20%20%20,-TAG 4 | +COMPONENT 5 | +BSCH3_LIB_V.1.0 6 | +PTN,N:10k,X:21,Y:31 7 | +BMP 8 | @@B@@G 9 | @@B@@G 10 | @@B@@G 11 | @@B@@G 12 | @@F@@G 13 | @AH@@G 14 | @F@@@G 15 | @AH@@G 16 | @@F@@G 17 | @@AH@G 18 | @@@F@G 19 | @@AH@G 20 | @@F@@G 21 | @AH@@G 22 | @F@@@G 23 | @AH@@G 24 | @@F@@G 25 | @@AH@G 26 | @@@F@G 27 | @@AH@G 28 | @@F@@G 29 | @AH@@G 30 | @F@@@G 31 | @AH@@G 32 | @@F@@G 33 | @@AH@G 34 | @@@F@G 35 | @@AH@G 36 | @@B@@G 37 | @@B@@G 38 | @@B@@G 39 | -BMP 40 | +L,W:1,S:0,X:10,Y:0,X:10,Y:4,-L 41 | +L,W:1,S:0,X:10,Y:4,X:5,Y:6,-L 42 | +L,W:1,S:0,X:5,Y:6,X:14,Y:10,-L 43 | +L,W:1,S:0,X:14,Y:10,X:5,Y:14,-L 44 | +L,W:1,S:0,X:5,Y:14,X:14,Y:18,-L 45 | +L,W:1,S:0,X:14,Y:18,X:5,Y:22,-L 46 | +L,W:1,S:0,X:5,Y:22,X:14,Y:26,-L 47 | +L,W:1,S:0,X:14,Y:26,X:10,Y:28,-L 48 | +L,W:1,S:0,X:10,Y:28,X:10,Y:31,-L 49 | -PTN 50 | +COMP,N:10k 51 | X:2,Y:3,B:1 52 | R:R 53 | P:10k 54 | +PIN,N:,L:T1,T:Sm,M:1,-PIN 55 | +PIN,N:,L:B1,T:Sm,M:2,-PIN 56 | -COMP 57 | -BSCH3_LIB_V.1.0 58 | L:0,X:370,Y:110,LIB:R,DIR:0,BLK:0,N:10k,NX:2,NY:9,R:,RX:2,RY:10,NOTE:,-COMPONENT 59 | +JUNCTION,L:0,X:360,Y:140,-JUNCTION 60 | +JUNCTION,L:0,X:330,Y:70,-JUNCTION 61 | +JUNCTION,L:0,X:360,Y:70,-JUNCTION 62 | +WIRE,L:0,X1:260,Y1:210,X2:470,Y2:210,-WIRE 63 | +WIRE,L:0,X1:470,Y1:230,X2:550,Y2:230,-WIRE 64 | +WIRE,L:0,X1:550,Y1:50,X2:550,Y2:230,-WIRE 65 | +WIRE,L:0,X1:470,Y1:50,X2:550,Y2:50,-WIRE 66 | +COMMENT,L:0,X:480,Y:130,S:SCL,FN:Tahoma,FS:12,FF:,-COMMENT 67 | +COMMENT,L:0,X:480,Y:150,S:SDA,FN:Tahoma,FS:12,FF:,-COMMENT 68 | +COMPONENT 69 | +BSCH3_LIB_V.1.0 70 | +PTN,N:10k,X:21,Y:31 71 | +BMP 72 | @@B@@G 73 | @@B@@G 74 | @@B@@G 75 | @@B@@G 76 | @@F@@G 77 | @AH@@G 78 | @F@@@G 79 | @AH@@G 80 | @@F@@G 81 | @@AH@G 82 | @@@F@G 83 | @@AH@G 84 | @@F@@G 85 | @AH@@G 86 | @F@@@G 87 | @AH@@G 88 | @@F@@G 89 | @@AH@G 90 | @@@F@G 91 | @@AH@G 92 | @@F@@G 93 | @AH@@G 94 | @F@@@G 95 | @AH@@G 96 | @@F@@G 97 | @@AH@G 98 | @@@F@G 99 | @@AH@G 100 | @@B@@G 101 | @@B@@G 102 | @@B@@G 103 | -BMP 104 | +L,W:1,S:0,X:10,Y:0,X:10,Y:4,-L 105 | +L,W:1,S:0,X:10,Y:4,X:5,Y:6,-L 106 | +L,W:1,S:0,X:5,Y:6,X:14,Y:10,-L 107 | +L,W:1,S:0,X:14,Y:10,X:5,Y:14,-L 108 | +L,W:1,S:0,X:5,Y:14,X:14,Y:18,-L 109 | +L,W:1,S:0,X:14,Y:18,X:5,Y:22,-L 110 | +L,W:1,S:0,X:5,Y:22,X:14,Y:26,-L 111 | +L,W:1,S:0,X:14,Y:26,X:10,Y:28,-L 112 | +L,W:1,S:0,X:10,Y:28,X:10,Y:31,-L 113 | -PTN 114 | +COMP,N:10k 115 | X:2,Y:3,B:1 116 | R:R 117 | P:10k 118 | +PIN,N:,L:T1,T:Sm,M:1,-PIN 119 | +PIN,N:,L:B1,T:Sm,M:2,-PIN 120 | -COMP 121 | -BSCH3_LIB_V.1.0 122 | L:0,X:340,Y:110,LIB:R,DIR:0,BLK:0,N:10k,NX:0,NY:9,R:,RX:2,RY:10,NOTE:,-COMPONENT 123 | +COMMENT,L:0,X:170,Y:50,S:Arduino%20UNO,FN:Tahoma,FS:12,FF:,-COMMENT 124 | +WIRE,L:0,X1:260,Y1:70,X2:330,Y2:70,-WIRE 125 | +WIRE,L:0,X1:360,Y1:120,X2:360,Y2:140,-WIRE 126 | +WIRE,L:0,X1:330,Y1:70,X2:360,Y2:70,-WIRE 127 | +WIRE,L:0,X1:360,Y1:70,X2:470,Y2:70,-WIRE 128 | +TAG,L:0,X:170,Y:70,D:1,T:2,S:+3.3V%20%20%20%20,-TAG 129 | +JUNCTION,L:0,X:330,Y:120,-JUNCTION 130 | +WIRE,L:0,X1:260,Y1:140,X2:360,Y2:140,-WIRE 131 | +WIRE,L:0,X1:360,Y1:140,X2:470,Y2:140,-WIRE 132 | +WIRE,L:0,X1:260,Y1:120,X2:330,Y2:120,-WIRE 133 | +WIRE,L:0,X1:330,Y1:120,X2:470,Y2:120,-WIRE 134 | +TAG,L:0,X:170,Y:140,D:1,T:3,S:A4%20(SDA)%20,-TAG 135 | +TAG,L:0,X:170,Y:120,D:1,T:3,S:A5%20(SCL)%20,-TAG 136 | +COMMENT,L:0,X:480,Y:80,S:VDD,FN:Tahoma,FS:12,FF:,-COMMENT 137 | +COMMENT,L:0,X:480,Y:220,S:VSS,FN:Tahoma,FS:12,FF:,-COMMENT 138 | +WIRE,L:0,X1:470,Y1:50,X2:470,Y2:230,-WIRE 139 | +WIRE,L:0,X1:460,Y1:170,X2:470,Y2:170,-WIRE 140 | +WIRE,L:0,X1:450,Y1:70,X2:450,Y2:170,-WIRE 141 | +WIRE,L:0,X1:450,Y1:170,X2:460,Y2:170,-WIRE 142 | +JUNCTION,L:0,X:450,Y:70,-JUNCTION 143 | +COMMENT,L:0,X:470,Y:50,S:ST7032i%20I2C%20LCD,FN:Tahoma,FS:12,FF:,-COMMENT 144 | +COMMENT,L:0,X:480,Y:180,S:-RES,FN:Tahoma,FS:12,FF:,-COMMENT 145 | -BSCH3_DATA_V.1.0 146 | -------------------------------------------------------------------------------- /arduino_st7032_sch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomozh/arduino_ST7032/501bf64fe602678061d5487e1221dbcc12aff2cc/arduino_st7032_sch.png -------------------------------------------------------------------------------- /component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := . 2 | -------------------------------------------------------------------------------- /examples/Autoscroll/Autoscroll.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : Autoscroll.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - Autoscroll 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch demonstrates the use of the autoscroll() 16 | and noAutoscroll() functions to make new text scroll or not. 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K resistor: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | 30 | Library originally added 18 Apr 2008 31 | by David A. Mellis 32 | library modified 5 Jul 2009 33 | by Limor Fried (http://www.ladyada.net) 34 | example added 9 Jul 2009 35 | by Tom Igoe 36 | modified 22 Nov 2010 37 | by Tom Igoe 38 | 39 | This example code is in the public domain. 40 | 41 | http://arduino.cc/en/Tutorial/LiquidCrystalAutoscroll 42 | 43 | */ 44 | 45 | // include the library code: 46 | //#include 47 | #include 48 | #include 49 | 50 | // initialize the library with the numbers of the interface pins 51 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 52 | ST7032 lcd; 53 | 54 | void setup() { 55 | // set up the LCD's number of columns and rows: 56 | lcd.begin(16,2); 57 | lcd.setContrast(40); 58 | } 59 | 60 | void loop() { 61 | // set the cursor to (0,0): 62 | lcd.setCursor(0, 0); 63 | // print from 0 to 9: 64 | for (int thisChar = 0; thisChar < 10; thisChar++) { 65 | lcd.print(thisChar); 66 | delay(500); 67 | } 68 | 69 | // set the cursor to (16,1): 70 | lcd.setCursor(16,1); 71 | // set the display to automatically scroll: 72 | lcd.autoscroll(); 73 | // print from 0 to 9: 74 | for (int thisChar = 0; thisChar < 10; thisChar++) { 75 | lcd.print(thisChar); 76 | delay(500); 77 | } 78 | // turn off automatic scrolling 79 | lcd.noAutoscroll(); 80 | 81 | // clear screen for the next loop: 82 | lcd.clear(); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /examples/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : Blink.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - Blink 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints "Hello World!" to the LCD and makes the 16 | cursor block blink. 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K resistor: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | 30 | Library originally added 18 Apr 2008 31 | by David A. Mellis 32 | library modified 5 Jul 2009 33 | by Limor Fried (http://www.ladyada.net) 34 | example added 9 Jul 2009 35 | by Tom Igoe 36 | modified 22 Nov 2010 37 | by Tom Igoe 38 | 39 | This example code is in the public domain. 40 | 41 | http://arduino.cc/en/Tutorial/LiquidCrystalBlink 42 | 43 | */ 44 | 45 | // include the library code: 46 | //#include 47 | #include 48 | #include 49 | 50 | // initialize the library with the numbers of the interface pins 51 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 52 | ST7032 lcd; 53 | 54 | void setup() { 55 | // set up the LCD's number of columns and rows: 56 | lcd.begin(16, 2); 57 | lcd.setContrast(40); 58 | // Print a message to the LCD. 59 | lcd.print("hello, world!"); 60 | } 61 | 62 | void loop() { 63 | // Turn off the blinking cursor: 64 | lcd.noBlink(); 65 | delay(3000); 66 | // Turn on the blinking cursor: 67 | lcd.blink(); 68 | delay(3000); 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /examples/Cursor/Cursor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : Cursor.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - Cursor 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints "Hello World!" to the LCD and 16 | uses the cursor() and noCursor() methods to turn 17 | on and off the cursor. 18 | 19 | The circuit: 20 | * LCD RS pin to digital pin 12 21 | * LCD Enable pin to digital pin 11 22 | * LCD D4 pin to digital pin 5 23 | * LCD D5 pin to digital pin 4 24 | * LCD D6 pin to digital pin 3 25 | * LCD D7 pin to digital pin 2 26 | * LCD R/W pin to ground 27 | * 10K resistor: 28 | * ends to +5V and ground 29 | * wiper to LCD VO pin (pin 3) 30 | 31 | Library originally added 18 Apr 2008 32 | by David A. Mellis 33 | library modified 5 Jul 2009 34 | by Limor Fried (http://www.ladyada.net) 35 | example added 9 Jul 2009 36 | by Tom Igoe 37 | modified 22 Nov 2010 38 | by Tom Igoe 39 | 40 | This example code is in the public domain. 41 | 42 | http://arduino.cc/en/Tutorial/LiquidCrystalCursor 43 | 44 | */ 45 | 46 | // include the library code: 47 | //#include 48 | #include 49 | #include 50 | 51 | // initialize the library with the numbers of the interface pins 52 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 53 | ST7032 lcd; 54 | 55 | void setup() { 56 | // set up the LCD's number of columns and rows: 57 | lcd.begin(16, 2); 58 | lcd.setContrast(40); 59 | // Print a message to the LCD. 60 | lcd.print("hello, world!"); 61 | } 62 | 63 | void loop() { 64 | // Turn off the cursor: 65 | lcd.noCursor(); 66 | delay(500); 67 | // Turn on the cursor: 68 | lcd.cursor(); 69 | delay(500); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /examples/CustomCharacter/CustomCharacter.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : CustomCharacter.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - Custom Characters 9 | 10 | Demonstrates how to add custom characters on an LCD display. 11 | The LiquidCrystal library works with all LCD displays that are 12 | compatible with the Hitachi HD44780 driver. There are many of 13 | them out there, and you can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints "I Arduino!" and a little dancing man 16 | to the LCD. 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K potentiometer: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | * 10K poterntiometer on pin A0 30 | 31 | created21 Mar 2011 32 | by Tom Igoe 33 | Based on Adafruit's example at 34 | https://github.com/adafruit/SPI_VFD/blob/master/examples/createChar/createChar.pde 35 | 36 | This example code is in the public domain. 37 | http://www.arduino.cc/en/Tutorial/LiquidCrystal 38 | 39 | Also useful: 40 | http://icontexto.com/charactercreator/ 41 | 42 | */ 43 | 44 | // include the library code: 45 | //#include 46 | #include 47 | #include 48 | 49 | // initialize the library with the numbers of the interface pins 50 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 51 | ST7032 lcd; 52 | 53 | // make some custom characters: 54 | byte heart[8] = { 55 | 0b00000, 56 | 0b01010, 57 | 0b11111, 58 | 0b11111, 59 | 0b11111, 60 | 0b01110, 61 | 0b00100, 62 | 0b00000 63 | }; 64 | 65 | byte smiley[8] = { 66 | 0b00000, 67 | 0b00000, 68 | 0b01010, 69 | 0b00000, 70 | 0b00000, 71 | 0b10001, 72 | 0b01110, 73 | 0b00000 74 | }; 75 | 76 | byte frownie[8] = { 77 | 0b00000, 78 | 0b00000, 79 | 0b01010, 80 | 0b00000, 81 | 0b00000, 82 | 0b00000, 83 | 0b01110, 84 | 0b10001 85 | }; 86 | 87 | byte armsDown[8] = { 88 | 0b00100, 89 | 0b01010, 90 | 0b00100, 91 | 0b00100, 92 | 0b01110, 93 | 0b10101, 94 | 0b00100, 95 | 0b01010 96 | }; 97 | 98 | byte armsUp[8] = { 99 | 0b00100, 100 | 0b01010, 101 | 0b00100, 102 | 0b10101, 103 | 0b01110, 104 | 0b00100, 105 | 0b00100, 106 | 0b01010 107 | }; 108 | void setup() { 109 | // set up the lcd's number of columns and rows: 110 | lcd.begin(16, 2); 111 | lcd.setContrast(40); 112 | 113 | // create a new character 114 | lcd.createChar(0, heart); 115 | // create a new character 116 | lcd.createChar(1, smiley); 117 | // create a new character 118 | lcd.createChar(2, frownie); 119 | // create a new character 120 | lcd.createChar(3, armsDown); 121 | // create a new character 122 | lcd.createChar(4, armsUp); 123 | 124 | lcd.setCursor(0, 0); 125 | 126 | // Print a message to the lcd. 127 | lcd.print("I "); 128 | lcd.write(0); 129 | lcd.print(" Arduino! "); 130 | lcd.write(1); 131 | 132 | } 133 | 134 | void loop() { 135 | // read the potentiometer on A0: 136 | int sensorReading = analogRead(A0); 137 | // map the result to 200 - 1000: 138 | int delayTime = map(sensorReading, 0, 1023, 200, 1000); 139 | // set the cursor to the bottom row, 5th position: 140 | lcd.setCursor(4, 1); 141 | // draw the little man, arms down: 142 | lcd.write(3); 143 | delay(delayTime); 144 | lcd.setCursor(4, 1); 145 | // draw him arms up: 146 | lcd.write(4); 147 | delay(delayTime); 148 | 149 | } 150 | 151 | 152 | -------------------------------------------------------------------------------- /examples/Display/Display.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : Display.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - display() and noDisplay() 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints "Hello World!" to the LCD and uses the 16 | display() and noDisplay() functions to turn on and off 17 | the display. 18 | 19 | The circuit: 20 | * LCD RS pin to digital pin 12 21 | * LCD Enable pin to digital pin 11 22 | * LCD D4 pin to digital pin 5 23 | * LCD D5 pin to digital pin 4 24 | * LCD D6 pin to digital pin 3 25 | * LCD D7 pin to digital pin 2 26 | * LCD R/W pin to ground 27 | * 10K resistor: 28 | * ends to +5V and ground 29 | * wiper to LCD VO pin (pin 3) 30 | 31 | Library originally added 18 Apr 2008 32 | by David A. Mellis 33 | library modified 5 Jul 2009 34 | by Limor Fried (http://www.ladyada.net) 35 | example added 9 Jul 2009 36 | by Tom Igoe 37 | modified 22 Nov 2010 38 | by Tom Igoe 39 | 40 | This example code is in the public domain. 41 | 42 | http://arduino.cc/en/Tutorial/LiquidCrystalDisplay 43 | 44 | */ 45 | 46 | // include the library code: 47 | //#include 48 | #include 49 | #include 50 | 51 | // initialize the library with the numbers of the interface pins 52 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 53 | ST7032 lcd; 54 | 55 | void setup() { 56 | // set up the LCD's number of columns and rows: 57 | lcd.begin(16, 2); 58 | lcd.setContrast(40); 59 | // Print a message to the LCD. 60 | lcd.print("hello, world!"); 61 | } 62 | 63 | void loop() { 64 | // Turn off the display: 65 | lcd.noDisplay(); 66 | delay(500); 67 | // Turn on the display: 68 | lcd.display(); 69 | delay(500); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /examples/HelloWorld/HelloWorld.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : HelloWorld.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - Hello World 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints "Hello World!" to the LCD 16 | and shows the time. 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K resistor: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | 30 | Library originally added 18 Apr 2008 31 | by David A. Mellis 32 | library modified 5 Jul 2009 33 | by Limor Fried (http://www.ladyada.net) 34 | example added 9 Jul 2009 35 | by Tom Igoe 36 | modified 22 Nov 2010 37 | by Tom Igoe 38 | 39 | This example code is in the public domain. 40 | 41 | http://www.arduino.cc/en/Tutorial/LiquidCrystal 42 | */ 43 | 44 | // include the library code: 45 | //#include 46 | #include 47 | #include 48 | 49 | // initialize the library with the numbers of the interface pins 50 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 51 | ST7032 lcd; 52 | 53 | void setup() { 54 | // set up the LCD's number of columns and rows: 55 | lcd.begin(16, 2); 56 | lcd.setContrast(40); 57 | // Print a message to the LCD. 58 | lcd.print("hello, world!"); 59 | } 60 | 61 | void loop() { 62 | // set the cursor to column 0, line 1 63 | // (note: line 1 is the second row, since counting begins with 0): 64 | lcd.setCursor(0, 1); 65 | // print the number of seconds since reset: 66 | lcd.print(millis()/1000); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /examples/Icon/Icon.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD Controler - Icon Display Example 3 | 2013/05/11 tomozh@gmail.com 4 | 5 | ------------------------ 6 | Arduino ST7032 7 | ------------------------ 8 | 3.3V --+-- VDD 9 | +-- RST 10 | A4(SDA) --*-- SDA 11 | A5(SCL) --*-- SCL 12 | GND ----- GND 13 | 14 | *... 10Kohm pull-up 15 | ------------------------ 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | 22 | #define NELEMS(arg) (sizeof(arg) / sizeof((arg)[0])) 23 | 24 | typedef struct tagICON_MAP { 25 | byte addr; 26 | byte pat; 27 | }ICON_MAP; 28 | 29 | static const ICON_MAP iconMap[] = { 30 | { 0x00, (1<<4) }, // 0 31 | { 0x02, (1<<4) }, // 1 32 | { 0x04, (1<<4) }, // 2 33 | { 0x06, (1<<4) }, // 3 34 | { 0x07, (1<<4) }, // 4 35 | { 0x07, (1<<3) }, // 5 36 | { 0x09, (1<<4) }, // 6 37 | { 0x0B, (1<<4) }, // 7 38 | { 0x0D, (1<<4) }, // 8 39 | { 0x0D, (1<<3) }, // 9 40 | { 0x0D, (1<<2) }, // 10 41 | { 0x0D, (1<<1) }, // 11 42 | { 0x0F, (1<<4) }, // 12 43 | }; 44 | 45 | static byte iconTmp[16]; 46 | bool showIcon = true; 47 | ST7032 lcd; 48 | 49 | static void setIndexedIcon(uint8_t index, bool show) { 50 | if((0 <= index) && (index < NELEMS(iconMap))) { 51 | const ICON_MAP* pMap = &iconMap[index]; 52 | byte* pTmp = &iconTmp[pMap->addr]; 53 | 54 | if(show) { 55 | *pTmp |= pMap->pat; 56 | } else { 57 | *pTmp &= ~pMap->pat; 58 | } 59 | 60 | lcd.setIcon(pMap->addr, *pTmp); 61 | } 62 | } 63 | 64 | void setup(){ 65 | lcd.begin(16, 2, LCD_5x8DOTS); 66 | lcd.setContrast(40); 67 | lcd.print("ST7032 ICON TEST"); 68 | } 69 | 70 | void loop(){ 71 | int i; 72 | 73 | for(i = 0; i < NELEMS(iconMap); i++) { 74 | setIndexedIcon(i, showIcon); 75 | lcd.setCursor(0, 1); 76 | lcd.print("No."); 77 | lcd.print(i); 78 | lcd.print(" "); 79 | 80 | delay(500); 81 | } 82 | 83 | while(1){} 84 | 85 | showIcon = !showIcon; 86 | } 87 | -------------------------------------------------------------------------------- /examples/Scroll/Scroll.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : Scroll.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - scrollDisplayLeft() and scrollDisplayRight() 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints "Hello World!" to the LCD and uses the 16 | scrollDisplayLeft() and scrollDisplayRight() methods to scroll 17 | the text. 18 | 19 | The circuit: 20 | * LCD RS pin to digital pin 12 21 | * LCD Enable pin to digital pin 11 22 | * LCD D4 pin to digital pin 5 23 | * LCD D5 pin to digital pin 4 24 | * LCD D6 pin to digital pin 3 25 | * LCD D7 pin to digital pin 2 26 | * LCD R/W pin to ground 27 | * 10K resistor: 28 | * ends to +5V and ground 29 | * wiper to LCD VO pin (pin 3) 30 | 31 | Library originally added 18 Apr 2008 32 | by David A. Mellis 33 | library modified 5 Jul 2009 34 | by Limor Fried (http://www.ladyada.net) 35 | example added 9 Jul 2009 36 | by Tom Igoe 37 | modified 22 Nov 2010 38 | by Tom Igoe 39 | 40 | This example code is in the public domain. 41 | 42 | http://arduino.cc/en/Tutorial/LiquidCrystalScroll 43 | 44 | */ 45 | 46 | // include the library code: 47 | //#include 48 | #include 49 | #include 50 | 51 | // initialize the library with the numbers of the interface pins 52 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 53 | ST7032 lcd; 54 | 55 | void setup() { 56 | // set up the LCD's number of columns and rows: 57 | lcd.begin(16, 2); 58 | lcd.setContrast(40); 59 | // Print a message to the LCD. 60 | lcd.print("hello, world!"); 61 | delay(1000); 62 | } 63 | 64 | void loop() { 65 | // scroll 13 positions (string length) to the left 66 | // to move it offscreen left: 67 | for (int positionCounter = 0; positionCounter < 13; positionCounter++) { 68 | // scroll one position left: 69 | lcd.scrollDisplayLeft(); 70 | // wait a bit: 71 | delay(150); 72 | } 73 | 74 | // scroll 29 positions (string length + display length) to the right 75 | // to move it offscreen right: 76 | for (int positionCounter = 0; positionCounter < 29; positionCounter++) { 77 | // scroll one position right: 78 | lcd.scrollDisplayRight(); 79 | // wait a bit: 80 | delay(150); 81 | } 82 | 83 | // scroll 16 positions (display length + string length) to the left 84 | // to move it back to center: 85 | for (int positionCounter = 0; positionCounter < 16; positionCounter++) { 86 | // scroll one position left: 87 | lcd.scrollDisplayLeft(); 88 | // wait a bit: 89 | delay(150); 90 | } 91 | 92 | // delay at the end of the full loop: 93 | delay(1000); 94 | 95 | } 96 | 97 | -------------------------------------------------------------------------------- /examples/SerialDisplay/SerialDisplay.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : SerialDisplay.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - Serial Input 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch displays text sent over the serial port 16 | (e.g. from the Serial Monitor) on an attached LCD. 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K resistor: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | 30 | Library originally added 18 Apr 2008 31 | by David A. Mellis 32 | library modified 5 Jul 2009 33 | by Limor Fried (http://www.ladyada.net) 34 | example added 9 Jul 2009 35 | by Tom Igoe 36 | modified 22 Nov 2010 37 | by Tom Igoe 38 | 39 | This example code is in the public domain. 40 | 41 | http://arduino.cc/en/Tutorial/LiquidCrystalSerial 42 | */ 43 | 44 | // include the library code: 45 | //#include 46 | #include 47 | #include 48 | 49 | // initialize the library with the numbers of the interface pins 50 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 51 | ST7032 lcd; 52 | 53 | void setup(){ 54 | // set up the LCD's number of columns and rows: 55 | lcd.begin(16, 2); 56 | lcd.setContrast(40); 57 | // initialize the serial communications: 58 | Serial.begin(9600); 59 | } 60 | 61 | void loop() 62 | { 63 | // when characters arrive over the serial port... 64 | if (Serial.available()) { 65 | // wait a bit for the entire message to arrive 66 | delay(100); 67 | // clear the screen 68 | lcd.clear(); 69 | // read all the available characters 70 | while (Serial.available() > 0) { 71 | // display each character to the LCD 72 | lcd.write(Serial.read()); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /examples/TextDirection/TextDirection.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : TextDirection.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - TextDirection 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch demonstrates how to use leftToRight() and rightToLeft() 16 | to move the cursor. 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K resistor: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | 30 | Library originally added 18 Apr 2008 31 | by David A. Mellis 32 | library modified 5 Jul 2009 33 | by Limor Fried (http://www.ladyada.net) 34 | example added 9 Jul 2009 35 | by Tom Igoe 36 | modified 22 Nov 2010 37 | by Tom Igoe 38 | 39 | This example code is in the public domain. 40 | 41 | http://arduino.cc/en/Tutorial/LiquidCrystalTextDirection 42 | 43 | */ 44 | 45 | // include the library code: 46 | //#include 47 | #include 48 | #include 49 | 50 | // initialize the library with the numbers of the interface pins 51 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 52 | ST7032 lcd; 53 | 54 | int thisChar = 'a'; 55 | 56 | void setup() { 57 | // set up the LCD's number of columns and rows: 58 | lcd.begin(16, 2); 59 | lcd.setContrast(40); 60 | // turn on the cursor: 61 | lcd.cursor(); 62 | } 63 | 64 | void loop() { 65 | // reverse directions at 'm': 66 | if (thisChar == 'm') { 67 | // go right for the next letter 68 | lcd.rightToLeft(); 69 | } 70 | // reverse again at 's': 71 | if (thisChar == 's') { 72 | // go left for the next letter 73 | lcd.leftToRight(); 74 | } 75 | // reset at 'z': 76 | if (thisChar > 'z') { 77 | // go to (0,0): 78 | lcd.home(); 79 | // start again at 0 80 | thisChar = 'a'; 81 | } 82 | // print the character 83 | lcd.write(thisChar); 84 | // wait a second: 85 | delay(1000); 86 | // increment the letter: 87 | thisChar++; 88 | } 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /examples/setCursor/setCursor.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ST7032 I2C LCD control sample 3 | Original source : setCursor.ino (LiquidCrystal Library) 4 | 2013/05/21 tomozh@gmail.com 5 | */ 6 | 7 | /* 8 | LiquidCrystal Library - setCursor 9 | 10 | Demonstrates the use a 16x2 LCD display. The LiquidCrystal 11 | library works with all LCD displays that are compatible with the 12 | Hitachi HD44780 driver. There are many of them out there, and you 13 | can usually tell them by the 16-pin interface. 14 | 15 | This sketch prints to all the positions of the LCD using the 16 | setCursor(0 method: 17 | 18 | The circuit: 19 | * LCD RS pin to digital pin 12 20 | * LCD Enable pin to digital pin 11 21 | * LCD D4 pin to digital pin 5 22 | * LCD D5 pin to digital pin 4 23 | * LCD D6 pin to digital pin 3 24 | * LCD D7 pin to digital pin 2 25 | * LCD R/W pin to ground 26 | * 10K resistor: 27 | * ends to +5V and ground 28 | * wiper to LCD VO pin (pin 3) 29 | 30 | Library originally added 18 Apr 2008 31 | by David A. Mellis 32 | library modified 5 Jul 2009 33 | by Limor Fried (http://www.ladyada.net) 34 | example added 9 Jul 2009 35 | by Tom Igoe 36 | modified 22 Nov 2010 37 | by Tom Igoe 38 | 39 | This example code is in the public domain. 40 | 41 | http://arduino.cc/en/Tutorial/LiquidCrystalSetCursor 42 | 43 | */ 44 | 45 | // include the library code: 46 | //#include 47 | #include 48 | #include 49 | 50 | // these constants won't change. But you can change the size of 51 | // your LCD using them: 52 | const int numRows = 2; 53 | const int numCols = 16; 54 | 55 | // initialize the library with the numbers of the interface pins 56 | //LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 57 | ST7032 lcd; 58 | 59 | void setup() { 60 | // set up the LCD's number of columns and rows: 61 | lcd.begin(numCols,numRows); 62 | lcd.setContrast(40); 63 | } 64 | 65 | void loop() { 66 | // loop from ASCII 'a' to ASCII 'z': 67 | for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) { 68 | // loop over the columns: 69 | for (int thisCol = 0; thisCol < numRows; thisCol++) { 70 | // loop over the rows: 71 | for (int thisRow = 0; thisRow < numCols; thisRow++) { 72 | // set the cursor position: 73 | lcd.setCursor(thisRow,thisCol); 74 | // print the letter: 75 | lcd.write(thisLetter); 76 | delay(200); 77 | } 78 | } 79 | } 80 | } 81 | 82 | 83 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For ST7032 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ST7032 KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | setContrast KEYWORD2 17 | setIcon KEYWORD2 18 | clear KEYWORD2 19 | home KEYWORD2 20 | noDisplay KEYWORD2 21 | display KEYWORD2 22 | noBlink KEYWORD2 23 | blink KEYWORD2 24 | noCursor KEYWORD2 25 | cursor KEYWORD2 26 | scrollDisplayLeft KEYWORD2 27 | scrollDisplayRight KEYWORD2 28 | leftToRight KEYWORD2 29 | rightToLeft KEYWORD2 30 | autoscroll KEYWORD2 31 | noAutoscroll KEYWORD2 32 | createChar KEYWORD2 33 | setCursor KEYWORD2 34 | command KEYWORD2 35 | 36 | ###################################### 37 | # Instances (KEYWORD2) 38 | ####################################### 39 | 40 | ####################################### 41 | # Constants (LITERAL1) 42 | ####################################### 43 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ST7032", 3 | "keywords": "display, i2c", 4 | "description": "Library for ST7032i display", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/tomozh/arduino_ST7032.git" 9 | }, 10 | "frameworks": "arduino", 11 | "platforms": "atmelavr" 12 | } 13 | --------------------------------------------------------------------------------