Fork of LCD-Window which works with Enhanced TextLCD from Wim
Fork of LcdWindow by
Revision 10:d40c70908bf0, committed 2016-01-04
- Comitter:
- charly
- Date:
- Mon Jan 04 20:22:17 2016 +0000
- Parent:
- 9:2fe93daa2106
- Child:
- 11:85f30e1f19fc
- Commit message:
- Adapted for EnhancedLCD. Disabled semaphore as there are problem with new mbed-library.
Changed in this revision
--- a/semaphore.cpp Tue Feb 22 22:57:44 2011 +0000 +++ b/semaphore.cpp Mon Jan 04 20:22:17 2016 +0000 @@ -12,6 +12,7 @@ if (_abort) block=false; int oldval; +/* #if defined(TARGET_LPC1768) // on Cortex-M3 we can use ldrex/strex do { // read the semaphore value @@ -21,14 +22,18 @@ } while ( (block && oldval == SemTaken) || __strex(SemTaken, &s) != 0 ); if ( !block ) __clrex(); // clear exclusive lock set by ldrex #else // on arm7 there's only swp + do { // swp sets the pointed data to the given value and returns the previous one oldval = __swp(SemTaken, &s); // if blocking, loop until the previous value becomes 0 // which would mean we have successfully taken the lock } while (block && oldval == SemTaken); -#endif +//#endif + return oldval == SemFree; +*/ +return true; } // release the semaphore
--- a/textlcdadapter.cpp Tue Feb 22 22:57:44 2011 +0000 +++ b/textlcdadapter.cpp Mon Jan 04 20:22:17 2016 +0000 @@ -25,13 +25,23 @@ #include <stdarg.h> -TextLCDAdapter::TextLCDAdapter(TextLCD *lcd) { +TextLCDAdapter::TextLCDAdapter(TextLCD_Base *lcd) { _lcd=lcd; } void TextLCDAdapter::clear() { _lcd->cls(); } +void TextLCDAdapter::writeText(const unsigned int column, const unsigned int row, const char text[]){ + _lcd->locate(column,row); + int i=0; + while(text[i]!=0) + { + _lcd->putc(text[i]); + i++; + } +} + int TextLCDAdapter::getRows() { return _lcd->rows(); } @@ -39,6 +49,8 @@ return _lcd->columns(); } void TextLCDAdapter::character(int column, int row, int c) { + _lcd->locate(column,row); + _lcd->putc(c); } int TextLCDAdapter::putc(int c) {
--- a/textlcdadapter.h Tue Feb 22 22:57:44 2011 +0000 +++ b/textlcdadapter.h Mon Jan 04 20:22:17 2016 +0000 @@ -32,8 +32,9 @@ class TextLCDAdapter : public Window { public: - TextLCDAdapter(TextLCD* lcd); + TextLCDAdapter(TextLCD_Base* lcd); virtual void clear(); + virtual void writeText(const unsigned int column, const unsigned int row, const char text[]); virtual int getRows(); virtual int getColumns(); @@ -42,7 +43,7 @@ int printf(const char* format, ...); private: - TextLCD *_lcd; + TextLCD_Base *_lcd; };