Chris BAYLEY / Mbed 2 deprecated UARTSnoop

Dependencies:   MODSERIAL Terminal mbed

Revision:
3:b8bad606d4f2
Parent:
2:60e6df8211f2
diff -r 60e6df8211f2 -r b8bad606d4f2 stripe.cpp
--- a/stripe.cpp	Wed Aug 01 02:17:00 2012 +0000
+++ b/stripe.cpp	Thu Aug 02 21:23:04 2012 +0000
@@ -36,7 +36,7 @@
 
 int Stripe::advance( void )
 {
-    if ( ++ this->wp >= 16 )
+    if ( ++ wp >= 16 )
         return 0;
     else
         return 1;
@@ -44,38 +44,37 @@
 
 int Stripe::inbyte( uint8_t b )
 {
-    sprintf(&this->strip.row[1].hex[this->wp*3], "%02X ", b );
+    sprintf(&strip.row[1].hex[wp*3], "%02X ", b );
     
     if (b >=0x20 && b<=0x80)
     {
-         this->strip.row[1].asc[this->wp] = b;
+         strip.row[1].asc[wp] = b;
     }else{
-         this->strip.row[1].asc[this->wp] = '.';
+         strip.row[1].asc[wp] = '.';
     }
-    return 0;
+    return advance();
 }
 
 int Stripe::outbyte( uint8_t b )
 {
-    sprintf(&this->strip.row[0].hex[this->wp*3], "%02X ", b );
+    sprintf(&strip.row[0].hex[wp*3], "%02X ", b );
     
     if (b >=0x20 && b<=0x80)
     {
-         this->strip.row[0].asc[this->wp] = b;
+         strip.row[0].asc[wp] = b;
     }else{
-         this->strip.row[0].asc[this->wp] = '.';
+         strip.row[0].asc[wp] = '.';
     }
-    return 0;
+    return advance();
 }
 
-uint8_t
-Stripe::getc( void )
+uint8_t Stripe::getc( void )
 {
     char c;
     
-    while ( this->rp < sizeof(this->strip) )
+    while ( rp < sizeof(strip) )
     {
-        c = ((char*)(&this->strip))[this->rp++];
+        c = ((char*)(&strip))[rp++];
         if (c)
             return c;
     }