Fixed compiler errors/warnings (declaration of _uidx, scope of index variables i)

Dependents:   GPSDevice LogData_UM6-to-SDcard UM6withGPS mbed-cansat-test-GPS ... more

Fork of MODGPS by Andy K

Revision:
7:34a9030f27a4
Parent:
6:64771e31464e
--- a/GPS.cpp	Thu Apr 21 14:06:17 2011 +0000
+++ b/GPS.cpp	Sun Feb 17 17:37:22 2013 +0000
@@ -34,6 +34,23 @@
     
     _vtg = (char *)NULL;
     
+    switch (rx) {
+        case p14:
+            _uidx = 1;
+            break;
+            
+        case p27:
+            _uidx = 2;
+            break;
+            
+        case p10:
+            _uidx = 3;
+            break;
+            
+        default:
+            _uidx = 0;
+    }        
+    
     switch(_uidx) {
         case 1:   _base = LPC_UART1; break;
         case 2:   _base = LPC_UART2; break;
@@ -125,17 +142,17 @@
 
 void
 GPS::ticktock(void)
-{
-    int i;
-    
+{   
     // Increment the time structure by 1/100th of a second.
     ++theTime; 
     
     // Test the serial queue.
     if (process_required) {
+        
         char *s = buffer[active_buffer == 0 ? 1 : 0];
         if (!strncmp(s, "$GPRMC", 6)) {
             if (_rmc) {
+                int i;
                 for(i = 0; s[i] != '\n'; i++) {
                     _rmc[i] = s[i];
                 }
@@ -147,7 +164,8 @@
         }
         else if (!strncmp(s, "$GPGGA", 6)) {
             if (_gga) {
-                for(int i = 0; s[i] != '\n'; i++) {
+                int i;
+                for(i = 0; s[i] != '\n'; i++) {
                     _gga[i] = s[i];
                 }
                 _gga[i++] = '\n'; _gga[i] = '\0';
@@ -157,7 +175,8 @@
         }
         else if (!strncmp(s, "$GPVTG", 6)) {
             if (_vtg) {
-                for(int i = 0; s[i] != '\n'; i++) {
+                int i;
+                for(i = 0; s[i] != '\n'; i++) {
                     _vtg[i] = s[i];
                 }
                 _vtg[i++] = '\n'; _vtg[i] = '\0';
@@ -167,7 +186,8 @@
         }
         else {
             if (_ukn) {
-                for(int i = 0; s[i] != '\n'; i++) {
+                int i;
+                for(i = 0; s[i] != '\n'; i++) {
                     _ukn[i] = s[i];
                 }
                 _ukn[i++] = '\n'; _ukn[i] = '\0';