Vodafone K3770/K3772-Z modems driver & networking library

Dependencies:   Socket USBHostWANDongle lwip-sys lwip

Dependents:   VodafoneUSBModemHTTPClientTest VodafoneUSBModemNTPClientTest VodafoneUSBModemSMSTest VodafoneUSBModemUSSDTest ... more

Fork of VodafoneUSBModem_bleedingedge by Donatien Garnier

This is the driver for the Vodafone K3700 & K3772-Z Dongles:

K3770

More details and instructions can be found here.

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Fri Sep 14 10:13:48 2012 +0000
Parent:
32:157dd8ce4e55
Child:
34:b53c619b036d
Commit message:
Added parameter for power gating pin config

Changed in this revision

VodafoneUSBModem.cpp Show annotated file Show diff for this revision Revisions of this file
VodafoneUSBModem.h Show annotated file Show diff for this revision Revisions of this file
--- a/VodafoneUSBModem.cpp	Thu Sep 13 13:52:42 2012 +0000
+++ b/VodafoneUSBModem.cpp	Fri Sep 14 10:13:48 2012 +0000
@@ -26,11 +26,11 @@
 
 #include "VodafoneUSBModem.h"
 
-VodafoneUSBModem::VodafoneUSBModem(PinName powerGatingPin /*= NC*/) : m_dongle(),
+VodafoneUSBModem::VodafoneUSBModem(PinName powerGatingPin /*= NC*/, powerGatingOnWhenPinHigh /* = true*/) : m_dongle(),
 m_atStream(m_dongle.getSerial(1)), m_pppStream(m_dongle.getSerial(0)), m_at(&m_atStream),
 m_sms(&m_at), m_ussd(&m_at), m_linkMonitor(&m_at), m_ppp(&m_pppStream), 
 m_dongleConnected(false), m_ipInit(false), m_smsInit(false), m_ussdInit(false), m_linkMonitorInit(false), m_atOpen(false),
-m_powerGatingPin(powerGatingPin)
+m_powerGatingPin(powerGatingPin), m_powerGatingOnWhenPinHigh(powerGatingOnWhenPinHigh)
 {
   if( m_powerGatingPin != NC )
   {
@@ -462,7 +462,7 @@
   }
   
   DigitalOut powerGatingOut(m_powerGatingPin);
-  powerGatingOut = enable;
+  powerGatingOut = m_powerGatingOnWhenPinHigh?enable:!enable;
 
   return OK;
 }
@@ -475,7 +475,7 @@
   }
   
   DigitalOut powerGatingOut(m_powerGatingPin);
-  return powerGatingOut;
+  return m_powerGatingOnWhenPinHigh?powerGatingOut:!powerGatingOut;
 }
 
 int VodafoneUSBModem::init()
--- a/VodafoneUSBModem.h	Thu Sep 13 13:52:42 2012 +0000
+++ b/VodafoneUSBModem.h	Fri Sep 14 10:13:48 2012 +0000
@@ -37,8 +37,9 @@
 public:
   /** Create Vodafone USB Modem (K3770/K3772-Z) dongle API instance
       @param powerGatingPin Optional pin commanding a power gating transistor on the modem's power line 
+      @param powerGatingOnWhenPinHigh true if the pin needs to be high to power the dongle, defaults to true
    */
-  VodafoneUSBModem(PinName powerGatingPin = NC);
+  VodafoneUSBModem(PinName powerGatingPin = NC, bool powerGatingOnWhenPinHigh = true);
 
   //Internet-related functions
 
@@ -131,6 +132,7 @@
   bool m_atOpen;
   
   PinName m_powerGatingPin;
+  bool m_powerGatingOnWhenPinHigh;
 };