Board support library for C027 - updated with thread-safe wait()

Fork of C027 by u-blox

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Fri Sep 12 21:00:10 2014 +0000
Parent:
15:37252d7bcd9e
Commit message:
updated with thread-safe wait()

Changed in this revision

C027.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 37252d7bcd9e -r 286a756a8d3f C027.cpp
--- a/C027.cpp	Tue Dec 17 16:25:47 2013 +0000
+++ b/C027.cpp	Fri Sep 12 21:00:10 2014 +0000
@@ -6,6 +6,9 @@
 
 #include "C027.h"
 
+#include "mbed.h"
+#include "rtos.h"
+
 void mbed_die(void)
 {
     DigitalOut led(LED);
@@ -21,7 +24,7 @@
     for (int i = 0; /* nothing */; i = sos[i+1] ? i+1 : 0)
     {
         led = (sos[i] == '=');
-        wait_ms(dot);
+        Thread::wait(dot);
     }
 }
 
@@ -47,7 +50,7 @@
     mdmRst    = 0;  // RESET:  0=reset, 1=operating
     mdmIsEnabled = false;
     mdmUseUsb = false;
-    wait_ms(50); // when USB cable is inserted the interface chip issues 
+    Thread::wait(50); // when USB cable is inserted the interface chip issues 
     // multiple resets to the target CPU We wait here for a short period to 
     // prevent those resets from propagating to the modem and other 
     // components. 
@@ -67,19 +70,19 @@
         mdmLvlOe  = 1;  // LVLEN:  1=disabled
         mdmILvlOe = 0;  // ILVLEN: 0=disabled
         mdmUsbDet = mdmUseUsb ? 1 : 0;  // USBDET: 0=disabled, 1=enabled
-        wait_ms( 10);   //         wait until supply switched off
+        Thread::wait( 10);   //         wait until supply switched off
         mdmEn     = 1;  // LDOEN:  0=off -> 1=on
-        wait_ms( 10);   //         wait until supply stable and on
-        wait_ms(300);   //         power on sequence is triggered by keeping reset 50ms-300ms low
+        Thread::wait( 10);   //         wait until supply stable and on
+        Thread::wait(300);   //         power on sequence is triggered by keeping reset 50ms-300ms low
         mdmRst    = 1;  // RESET:  0=reset -> 1=operating
-        wait_ms(150);   //         LISA-C requires 150ms low to turn on
+        Thread::wait(150);   //         LISA-C requires 150ms low to turn on
         mdmPwrOn  = 1;  // PWRON:  0=turn on -> 1=idle
         mdmIsEnabled = true;
         // the interfaces of the modem should be fully ready after a certain period
         // LISA-U200  5000ms
         // SARA-G350  3000ms
         // LISA-C200       
-        wait_ms(1000);
+        Thread::wait(1000);
         mdmLvlOe  = 0;  // LVLEN:  0=enabled (uart/gpio)
         if (gpsIsEnabled) 
             mdmILvlOe = 1; // ILVLEN: 1=enabled (i2c)
@@ -92,7 +95,7 @@
         mdmLvlOe  = 1;  // LVLEN:  1=disabled (uart/gpio)
         mdmUsbDet = 0;  // USBDET: 0=disabled
         mdmPwrOn  = 0;  // PWRON:  0=active
-        wait_ms(1000);  //         send to sleep
+        Thread::wait(1000);  //         send to sleep
         mdmPwrOn  = 1;  // PWRON:  0=active -> 1=idle
         // now we can savely switch off the ldo
         mdmRst    = 0;  // RESET:  1=operating -> 0=reset
@@ -123,7 +126,7 @@
         // LISA-U200   50ms
         // SARA-G350   50ms
         // LISA-C200  300ms
-        wait_ms(300);
+        Thread::wait(300);
         mdmRst   = 1;   // RESET: 0=reset -> 1=operating
     }
 }
@@ -137,7 +140,7 @@
         // LISA-U200 50-80us
         // SARA-G350     5ms
         // LISA-C200   150ms 
-        wait_ms(150);   
+        Thread::wait(150);   
         mdmPwrOn = 1;
     }
 }
@@ -151,7 +154,7 @@
         // LISA-U200  1000ms
         // SARA-G350     n/a
         // LISA-C200     n/a
-        wait_ms(1000);  
+        Thread::wait(1000);  
         mdmPwrOn = 1;
     }
 }
@@ -162,7 +165,7 @@
     {
         gpsRst   = 0;   // RESET: 0=reset
         gpsEn    = 1;   // LDOEN: 0=off -> 1=on
-        wait_ms(1);     //        wait until stable
+        Thread::wait(1);     //        wait until stable
         gpsRst   = 1;   // RESET: 0=reset -> 1=operating
         gpsIsEnabled = true;
         // the gps schould be fully ready after 50ms
@@ -189,7 +192,7 @@
     if (gpsIsEnabled)
     {
         gpsRst   = 0;    // RESET: 0=reset,1=operating
-        wait_ms(1);
+        Thread::wait(1);
         gpsRst   = 1;    // RESET: 1=operating,0=reset
     }
 }