Modified TextLCD lib. The RW signal is also connected to a IO pin. This enable to read out the display memory and the busy flag. The timing is switched from delays to wait for the busy flag. Added writeCGRAM function to define user chars 0-7.
Dependents: TwitterClient CSVParser _EXAMPLE_RFM12B mbed_blinky6 ... more
Diff: TextLCD.cpp
- Revision:
- 4:a7c74d4c6911
- Parent:
- 0:2ceba7f90dd4
--- a/TextLCD.cpp Mon Dec 06 00:07:57 2010 +0000 +++ b/TextLCD.cpp Tue Dec 14 16:47:47 2010 +0000 @@ -36,16 +36,16 @@ // send "Display Settings" 3 times (Only top nibble of 0x30 as we've got 4-bit bus) for (int i=0; i<3; i++) { _e = 1; - wait(0.000001f); + __nop(); _d = 0x3; - wait(0.000001f); + __nop(); _e = 0; wait(0.004f); // 4ms } _e = 1; - wait(0.000001f); + __nop(); _d = 0x2; // 4 Bit mode - wait(0.000001f); + __nop(); _e = 0; writeCommand(0x28); // Function set 4 Bit, 2Line, 5*7 @@ -102,15 +102,15 @@ void TextLCD::writeByte(int value) { _e = 1; - wait(0.000001f); + __nop(); _d = value >> 4; - wait(0.000001f); + __nop(); _e = 0; - wait(0.000001f); + __nop(); _e = 1; - wait(0.000001f); + __nop(); _d = value >> 0; - wait(0.000001f); + __nop(); _e = 0; } @@ -125,15 +125,15 @@ waitBusy(); _rw = 1; _rs = 1; - wait(0.000001f); + __nop(); _d.input(); // switch Data port to input _e = 1; - wait(0.000001f); + __nop(); input = _d.read() << 4; // high nibble _e = 0; - wait(0.000001f); + __nop(); _e = 1; - wait(0.000001f); + __nop(); input = input | _d.read(); // low nibble _e = 0; return (input); @@ -143,16 +143,16 @@ int input; _rw = 1; _rs = 0; - wait(0.000001f); + __nop(); _d.input(); // switch Data port to input do{ _e = 1; - wait(0.000001f); + __nop(); input = _d.read(); _e = 0; - wait(0.000001f); + __nop(); _e = 1; - wait(0.000001f); + __nop(); _e = 0; }while((0x8 & input) == 0x8); // wait until display is ready _rw = 0;