Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TwitterClient CSVParser _EXAMPLE_RFM12B mbed_blinky6 ... more
Revision 4:a7c74d4c6911, committed 2010-12-14
- Comitter:
- dreschpe
- Date:
- Tue Dec 14 16:47:47 2010 +0000
- Parent:
- 3:8582013914a0
- Commit message:
- 0.2 change small delays to __nop();
Changed in this revision
| TextLCD.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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;