SO1602A Lib. SO1602A is Organic LED, has 16 chars and 2 lines. This lib supports printf() of C-Language. http://akizukidenshi.com/catalog/g/gP-08276/
Fork of SO1602A by
Diff: SO1602A.cpp
- Revision:
- 3:eaaedd09fa6b
- Parent:
- 2:45791c1064f6
- Child:
- 4:e17943b827d8
--- a/SO1602A.cpp Fri Oct 02 06:43:18 2015 +0000 +++ b/SO1602A.cpp Mon Oct 19 05:44:49 2015 +0000 @@ -28,18 +28,18 @@ int SO1602A::_putc(int val) // for printf() { if (val == '\n') { - _column = 0; - _row = (_row + 1) % 2; + col = 0; + row = (row + 1) % 2; } else { - locate(_column, _row); + locate(col, row); buf[0]= 0x40; buf[1]= val; i2c.write(addr, buf, 2); - _column++; - if (_column >= 16) { - _column = 0; - _row = (_row + 1) % 2; + col++; + if (col >= 16) { + col = 0; + row = (row + 1) % 2; } } wait_ms(1); @@ -52,15 +52,17 @@ return -1; } -void SO1602A::locate(int col, int row) +void SO1602A::locate(int _col, int _row) { + col= _col; + row= _row; cmd(0x80 + row * 0x20 + col); return; } void SO1602A::init() { - _column= _row= 0; + col= row= 0; buf[0]= 0x00; buf[1]= 0x00; buf[2]= 0x00;