USB Host Driver with Socket Modem support. Works with revision 323 of mbed-src but broken with any later version.

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Files at this revision

API Documentation at this revision

Comitter:
fritz291
Date:
Fri Jun 26 16:55:15 2015 +0000
Parent:
24:f4d432f36ec2
Child:
26:53970cabf56d
Commit message:
Added test function to send AT command to Socket Modem

Changed in this revision

USBHostSocketModem/USBHostSocketModem.cpp Show annotated file Show diff for this revision Revisions of this file
USBHostSocketModem/USBHostSocketModem.h Show annotated file Show diff for this revision Revisions of this file
--- a/USBHostSocketModem/USBHostSocketModem.cpp	Wed Jun 24 16:41:24 2015 +0000
+++ b/USBHostSocketModem/USBHostSocketModem.cpp	Fri Jun 26 16:55:15 2015 +0000
@@ -154,6 +154,17 @@
     int res = host->controlWrite(dev, DTR_REQUEST_TYPE, SET_CONTROL_LINE_STATE, DTR, 0, NULL, 0);
 }
 
+void USBHostSocketModem::testAT()
+{
+    uint8_t buf[] = "at\r";
+    uint8_t result[64] = {0};
+    int rc,rt;
+    rc = host->bulkWrite(dev, bulk_out, buf, sizeof(buf));
+    printf("rc = %i\n", rc);
+    rt = host->bulkRead(dev, bulk_in, result, sizeof(result));
+    printf("rt = %i\n", rt);
+    printf("%s\n", result);
+}
 
 
 
--- a/USBHostSocketModem/USBHostSocketModem.h	Wed Jun 24 16:41:24 2015 +0000
+++ b/USBHostSocketModem/USBHostSocketModem.h	Fri Jun 26 16:55:15 2015 +0000
@@ -46,6 +46,12 @@
      * @return true if connection was successful
      */
     bool connect();
+    
+    /**
+     * Send AT command test function.
+     * Sends the "AT" command which responds with "OK" if sim card is present else "ERROR".
+     */
+    void testAT();
 
 protected:
     //From IUSBEnumerator