Driver for Text OLED display - 20x4 Winstar or Newhaven, with Winstar WS0010 driver IC
Diff: TextOLED20x4.cpp
- Revision:
- 2:c7834290ea1c
- Parent:
- 1:863e06094dfd
- Child:
- 3:d955c3213b6a
--- a/TextOLED20x4.cpp Wed Dec 19 13:03:42 2012 +0000 +++ b/TextOLED20x4.cpp Wed Dec 19 14:25:18 2012 +0000 @@ -1,4 +1,5 @@ -/* mbed TextLCD Library, for a 4-bit LCD based on HD44780 +/* mbed TextOLED20x4 Library, for a 4-bit LCD based on HD44780 + * CopyLeft Rod Coleman 2012 * Copyright (c) 2007-2010, sford, http://mbed.org * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -20,10 +21,10 @@ * THE SOFTWARE. */ -#include "TextLCD.h" +#include "TextOLED20x4.h" #include "mbed.h" -TextLCD::TextLCD(PinName rs, PinName e, PinName d4, PinName d5, +TextOLED20x4::TextOLED20x4(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type) : _rs(rs), _e(e), _d(d4, d5, d6, d7), _type(type) { @@ -73,24 +74,24 @@ cls();*/ } -void TextLCD::character(int column, int row, int c) { +void TextOLED20x4::character(int column, int row, int c) { int a = address(column, row); writeCommand(a); writeData(c); } -void TextLCD::cls() { +void TextOLED20x4::cls() { writeCommand(0x01); // cls, and set cursor to 0 wait(0.00164f); // This command takes 1.64 ms locate(0, 0); } -void TextLCD::locate(int column, int row) { +void TextOLED20x4::locate(int column, int row) { _column = column; _row = row; } -int TextLCD::_putc(int value) { +int TextOLED20x4::_putc(int value) { if (value == '\n') { _column = 0; _row++; @@ -111,11 +112,11 @@ return value; } -int TextLCD::_getc() { +int TextOLED20x4::_getc() { return -1; } -void TextLCD::writeByte(int value) { +void TextOLED20x4::writeByte(int value) { wait_us(1); _e = 1; // RC added. Must go high at least 20ns after RS settled. _d = value >> 4; @@ -130,19 +131,19 @@ //_e = 1; } -void TextLCD::writeCommand(int command) { +void TextOLED20x4::writeCommand(int command) { _e = 0; _rs = 0; writeByte(command); } -void TextLCD::writeData(int data) { +void TextOLED20x4::writeData(int data) { _e = 0; _rs = 1; writeByte(data); } -int TextLCD::address(int column, int row) { +int TextOLED20x4::address(int column, int row) { /* switch (_type) { case LCD20x4:*/ switch (row) { @@ -164,7 +165,7 @@ }*/ } -int TextLCD::columns() { +int TextOLED20x4::columns() { return 20; /* switch (_type) { case LCD20x4: @@ -177,7 +178,7 @@ }*/ } -int TextLCD::rows() { +int TextOLED20x4::rows() { return 4; /*switch (_type) { case LCD20x4: