fork of original freetronics library

Dependents:   AwsomeStation

Fork of Freetronics_16x2_LCD by Components

Revision:
5:7b216d7781f8
Parent:
4:b4b2435f4a7f
diff -r b4b2435f4a7f -r 7b216d7781f8 freetronicsLCDShield.cpp
--- a/freetronicsLCDShield.cpp	Thu Jun 02 13:31:16 2016 +0000
+++ b/freetronicsLCDShield.cpp	Thu Sep 02 08:00:12 2021 +0000
@@ -21,11 +21,12 @@
  */
 
 #include "mbed.h"
+#include "mbed_wait_api.h"
 #include "freetronicsLCDShield.h"
 
-#define PULSE_E     wait(0.000001f);    \
+#define PULSE_E     wait_ns(1);    \
                     _e = 0;             \
-                    wait(0.000001f);    \
+                    wait_ns(1);    \
                     _e = 1;
 
 
@@ -35,11 +36,11 @@
     // Init the display, wait 15ms to insure the power is up
     _e = true;
     _rs = false;
-    wait(0.015f);
+    ThisThread::sleep_for(15);
     
     for (int i = 0; i < 3; i++){
         writeByte(0x3);
-        wait(0.00164f);  // this command takes 1.64ms, so wait for it
+        wait_us(1640);  // this command takes 1.64ms, so wait for it
     }
 
     writeByte(0x2);     // 4-bit mode
@@ -92,13 +93,13 @@
 void freetronicsLCDShield::cls(void) {
     // Clear the display and place the cursor at 0, 0
     writeCommand(0x01);
-    wait(0.00164f);
+    wait_us(1640);
 }
 
 void freetronicsLCDShield::home(void) {
     // Undo shift operations and place cursor at 0,0
     writeCommand(0x02);
-    wait(0.00164f);
+    wait_us(1640);
 }
 
 void freetronicsLCDShield::writeCGRAM (char address, const char *ptr, char nbytes) {
@@ -119,7 +120,7 @@
     _d = byte >> 0;
     PULSE_E;
     // Most instructions take 40us
-    wait(0.000040f);  
+    wait_us(40); 
 }
 
 void freetronicsLCDShield::writeData (int data) {