Fork of SSD1289 lib for Landtiger board

Revision:
2:799c4fb113c5
Parent:
1:f4f77e6729cd
diff -r f4f77e6729cd -r 799c4fb113c5 ssd1289.cpp
--- a/ssd1289.cpp	Wed Nov 21 23:11:20 2012 +0000
+++ b/ssd1289.cpp	Thu Nov 22 08:42:01 2012 +0000
@@ -10,135 +10,23 @@
 typedef unsigned short ushort;
 #endif
 
-SSD1289::SSD1289( PinName CS_PIN, PinName RESET_PIN, PinName RS_PIN, PinName WR_PIN, PinName RD_PIN, BusOut* DATA_PORT )
-    : _lcd_pin_cs( CS_PIN ), _lcd_pin_reset( RESET_PIN ), _lcd_pin_rs( RS_PIN ), _lcd_pin_wr( WR_PIN ), _lcd_pin_rd( RD_PIN )
+SSD1289::SSD1289( PinName CS_PIN, PinName RESET_PIN, PinName RS_PIN, PinName WR_PIN, BusOut* DATA_PORT, PinName RD_PIN )
+    : _lcd_pin_cs( CS_PIN ), _lcd_pin_reset( RESET_PIN ), _lcd_pin_rs( RS_PIN ), _lcd_pin_wr( WR_PIN )
 {
     _lcd_port = DATA_PORT;
-}
-
-/*
-
-void SSD1289::PrintNumI( long num, int x, int y )
-{
-    char buf[ 25 ];
-    char st[ 27 ];
-    bool neg = false;
-    int c = 0;
-
-    if ( num == 0 )
-    {
-        st[ 0 ] = 48;
-        st[ 1 ] = 0;
-    }
+    if ( RD_PIN != NC )
+        _lcd_pin_rd = new DigitalOut( RD_PIN );
     else
-    {
-        if ( num < 0 )
-        {
-            neg = true;
-            num = -num;
-        }
-
-        while ( num > 0 )
-        {
-            buf[ c ] = 48 + ( num % 10 );
-            c++;
-            num = ( num - ( num % 10 ) ) / 10;
-        }
-        buf[ c ] = 0;
-
-        if ( neg )
-        {
-            st[ 0 ] = 45;
-        }
-
-        for ( int i = 0; i < c; i++ )
-        {
-            st[ i + neg ] = buf[ c - i - 1 ];
-        }
-        st[ c + neg ] = 0;
-    }
-
-    Print( st, x, y );
+        _lcd_pin_rd = 0;
+    
+    SetForeground();
+    SetBackground();
+    _font.font = 0;
 }
 
-void SSD1289::PrintNumF( double num, uint8_t dec, int x, int y, char divider )
-{
-    char buf[ 25 ];
-    char st[ 27 ];
-    bool neg = false;
-    int c = 0;
-    int c2, mult;
-    unsigned long inum;
-
-    if ( num == 0 )
-    {
-        st[ 0 ] = 48;
-        st[ 1 ] = divider;
-        for ( int i = 0; i < dec; i++ )
-            st[ 2 + i ] = 48;
-        st[ 2 + dec ] = 0;
-    }
-    else
-    {
-        if ( num < 0 )
-        {
-            neg = true;
-            num = -num;
-        }
-
-        if ( dec < 1 )
-            dec = 1;
-        if ( dec > 5 )
-            dec = 5;
-
-        mult = 1;
-        for ( int j = 0; j < dec; j++ )
-            mult = mult * 10;
-        inum = long( num * mult + 0.5 );
-
-        while ( inum > 0 )
-        {
-            buf[ c ] = 48 + ( inum % 10 );
-            c++;
-            inum = ( inum - ( inum % 10 ) ) / 10;
-        }
-        if ( ( num < 1 ) and ( num > 0 ) )
-        {
-            buf[ c ] = 48;
-            c++;
-        }
-        buf[ c ] = 0;
-
-        if ( neg )
-        {
-            st[ 0 ] = 45;
-        }
-
-        c2 = neg;
-        for ( int i = 0; i < c; i++ )
-        {
-            st[ c2 ] = buf[ c - i - 1 ];
-            c2++;
-            if ( ( c - ( c2 - neg ) ) == dec )
-            {
-                st[ c2 ] = divider;
-                c2++;
-            }
-        }
-        st[ c2 ] = 0;
-    }
-
-    Print( st, x, y );
-}
-
-*/
-
 void SSD1289::Initialize( orientation_t orientation )
 {
     _orientation = orientation;
-    SetForeground();
-    SetBackground();
-    _font.font = 0;
     
     _lcd_pin_reset = HIGH;
     wait_ms( 5 );
@@ -146,7 +34,8 @@
     wait_ms( 15 );
     _lcd_pin_reset = HIGH;
     _lcd_pin_cs = HIGH;
-    _lcd_pin_rd = HIGH;
+    if ( _lcd_pin_rd != 0 )
+        *_lcd_pin_rd = HIGH;
     _lcd_pin_wr = HIGH;
     wait_ms( 15 );
     
@@ -750,13 +639,3 @@
     _lcd_pin_cs = HIGH;
     clearXY();
 }
-
-int SSD1289::_getc()
-{
-    return ( -1 );
-}
-
-int SSD1289::_putc( int value )
-{
-    return ( value );
-}