fork of original freetronics library

Dependents:   AwsomeStation

Fork of Freetronics_16x2_LCD by Components

Files at this revision

API Documentation at this revision

Comitter:
rba90
Date:
Thu Sep 02 08:00:12 2021 +0000
Parent:
4:b4b2435f4a7f
Commit message:
Add support to MbedOS 6

Changed in this revision

freetronicsLCDShield.cpp Show annotated file Show diff for this revision Revisions of this file
freetronicsLCDShield.h Show annotated file Show diff for this revision Revisions of this file
--- 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) {
--- a/freetronicsLCDShield.h	Thu Jun 02 13:31:16 2016 +0000
+++ b/freetronicsLCDShield.h	Thu Sep 02 08:00:12 2021 +0000
@@ -19,6 +19,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+ 
+#include "Stream.h"
 
 #ifndef FREETRONICSLCDSHIELD_H
 #define FREETRONICSLCDSHIELD_H