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.
Dependencies: TextLCD mbed MMA8451Q TSI
Diff: MyLCD.cpp
- Branch:
- mono
- Revision:
- 17:01fe47dda43b
- Parent:
- 16:b3cc7cf41a1b
--- a/MyLCD.cpp	Mon Oct 26 13:20:14 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#include "mbed.h"
-#include "TextLCD.h"
-#include <string>
-#ifndef MYLCD
-#define MYLCD
-class MyLCD
-{
-public:
-    MyLCD(int refreshRate, PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7): lcd(rs, e, d4, d5, d6, d7) {
-        bufferOld[0]='\0';
-        if (refreshRate>0)
-            t.attach(this, &MyLCD::update, 1.0/refreshRate);
-        else
-            t.attach(this, &MyLCD::update, 1.0/20);
-    }
-    
-    void printf(string text) {
-        text.copy(buffer, 32, 0 );
-        buffer[32]='\0';
-    }
-    
-    void printf(string text, float number, string nav) {
-        char tmp2[33];
-        sprintf(tmp2,text.append(": %.0f\n%s\0").c_str(), number, nav);
-        printf(tmp2);
-    }
-
-private:
-    TextLCD lcd;
-    Ticker t;
-    char buffer[33], bufferOld [33];
-
-    void update() {
-        if(!strcmp(bufferOld,buffer)==0) {
-            lcd.cls();
-            lcd.printf("%s\0", buffer);
-            strncpy(bufferOld, buffer, 32);
-        }
-    }
-};
-
-#endif
\ No newline at end of file
    