TI's CC3100. A test demo with very little testing done!

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dflet
Date:
Thu Sep 03 13:43:50 2015 +0000
Parent:
6:778b081f6a13
Commit message:
Oooops SPI mode change from 1 to 0. Must be some clock skew to get away with that! Other updates.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
simplelink/G_functions/fPtr_func.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_sl_common.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spi.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Mar 19 15:39:08 2015 +0000
+++ b/main.cpp	Thu Sep 03 13:43:50 2015 +0000
@@ -72,8 +72,8 @@
 #elif (THIS_BOARD == ST_MBED_NUCLEOF103)
 cc3100 _cc3100(PA_9, PC_7, PB_6, SPI(PA_7, PA_6, PA_5));//nucleoF103  irq, nHib, cs, mosi, miso, sck
 Serial pc(SERIAL_TX, SERIAL_RX);
-#elif (THIS_BOARD == Seed_Arch_Max)
-cc3100 _cc3100(PE_5, PE_4, PE_6, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
+#elif (THIS_BOARD == Seeed_Arch_Max)
+cc3100 _cc3100(PD_12, PD_13, PD_11, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
 Serial pc(USBTX, USBRX);
 #else
 
--- a/mbed.bld	Thu Mar 19 15:39:08 2015 +0000
+++ b/mbed.bld	Thu Sep 03 13:43:50 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file
--- a/simplelink/G_functions/fPtr_func.cpp	Thu Mar 19 15:39:08 2015 +0000
+++ b/simplelink/G_functions/fPtr_func.cpp	Thu Sep 03 13:43:50 2015 +0000
@@ -43,9 +43,6 @@
     
 using namespace mbed_cc3100;    
     
-cc3100_driver *_driver;
-cc3100_nonos  *_nonos;
-cc3100_netapp *_netapp;
 cc3100        *_cc3100_;
 
 #ifdef __cplusplus
@@ -372,15 +369,15 @@
 {
     _SocketAddrResponse_u *pMsgArgs = (_SocketAddrResponse_u *)_SL_RESP_ARGS_START(pVoidBuf);
 
-    _driver->_SlDrvProtectionObjLockWaitForever();
+    _cc3100_->_driver._SlDrvProtectionObjLockWaitForever();
 
     VERIFY_PROTOCOL(( pMsgArgs->IpV4.sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS);
     VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
 
     memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs,sizeof(_SocketAddrResponse_u));
-    _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+    _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
 
-    _driver->_SlDrvProtectionObjUnLock();
+    _cc3100_->_driver._SlDrvProtectionObjUnLock();
     return;
 }
 
@@ -391,7 +388,7 @@
 {
     _SocketResponse_t *pMsgArgs = (_SocketResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
 
-    _driver->_SlDrvProtectionObjLockWaitForever();
+    _cc3100_->_driver._SlDrvProtectionObjLockWaitForever();
 
     VERIFY_PROTOCOL((pMsgArgs->sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS);
     VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
@@ -399,8 +396,8 @@
     ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->sd = pMsgArgs->sd;
     ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->statusOrLen = pMsgArgs->statusOrLen;
 
-    _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
-    _driver->_SlDrvProtectionObjUnLock();
+    _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+    _cc3100_->_driver._SlDrvProtectionObjUnLock();
     return;
 }
 
@@ -411,14 +408,14 @@
 {
     _SelectAsyncResponse_t     *pMsgArgs   = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
 
-    _driver->_SlDrvProtectionObjLockWaitForever();    
+    _cc3100_->_driver._SlDrvProtectionObjLockWaitForever();    
 
     VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
 
     memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t));
 
-    _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
-    _driver->_SlDrvProtectionObjUnLock();
+    _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+    _cc3100_->_driver._SlDrvProtectionObjUnLock();
 
     return;
 }
@@ -432,7 +429,7 @@
 {
     _GetHostByNameIPv4AsyncResponse_t *pMsgArgs = (_GetHostByNameIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
 
-    _driver->_SlDrvProtectionObjLockWaitForever();
+    _cc3100_->_driver._SlDrvProtectionObjLockWaitForever();
 
     VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
 
@@ -446,8 +443,8 @@
         memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv4AsyncResponse_t));
     }
     
-    _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
-    _driver->_SlDrvProtectionObjUnLock();
+    _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+    _cc3100_->_driver._SlDrvProtectionObjUnLock();
     
     return;
 }
@@ -563,7 +560,7 @@
 
 
         /**************************************************************************************************/
-        _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+        _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
         return;
     }
 }
@@ -579,18 +576,18 @@
     SlPingReport_t pingReport;
 
     if(pPingCallBackFunc) {
-        _netapp->CopyPingResultsToReport(pMsgArgs,&pingReport);
+        _cc3100_->_netapp.CopyPingResultsToReport(pMsgArgs,&pingReport);
         pPingCallBackFunc(&pingReport);
     } else {
 
-        _driver->_SlDrvProtectionObjLockWaitForever();
+        _cc3100_->_driver._SlDrvProtectionObjLockWaitForever();
         VERIFY_SOCKET_CB(NULL != g_pCB->PingCB.PingAsync.pAsyncRsp);
 
         if (NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs) {
             memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_PingReportResponse_t));
-            _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+            _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
         }
-        _driver->_SlDrvProtectionObjUnLock();
+        _cc3100_->_driver._SlDrvProtectionObjUnLock();
     }
     return;
 }
@@ -618,7 +615,7 @@
 
 #else
     
-    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) );
+    OSI_RET_OK_CHECK(_cc3100_->_nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) );
     
 #endif
     
@@ -628,12 +625,12 @@
 
     /*  Messages might have been read by CmdResp context. Therefore after */
     /*  getting LockObj, check again where the Pending Rx Msg is still present. */
-    if(FALSE == (_driver->_SL_PENDING_RX_MSG(g_pCB))) {
-        OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    if(FALSE == (_cc3100_->_driver._SL_PENDING_RX_MSG(g_pCB))) {
+        OSI_RET_OK_CHECK(_cc3100_->_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
         return SL_RET_CODE_OK;
     }
    
-    VERIFY_RET_OK(_driver->_SlDrvMsgRead());
+    VERIFY_RET_OK(_cc3100_->_driver._SlDrvMsgRead());
 
     g_pCB->RxDoneCnt++;
 
@@ -643,7 +640,7 @@
             /*  to be read */
             VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
 
-            _driver->_SlAsyncEventGenericHandler();
+            _cc3100_->_driver._SlAsyncEventGenericHandler();
 
 #if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
             g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;
@@ -662,7 +659,7 @@
             VERIFY_PROTOCOL(0);
     }
 
-    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    OSI_RET_OK_CHECK(_cc3100_->_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
 
     return(SL_RET_CODE_OK);   
 
@@ -678,11 +675,11 @@
 
     VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp);
 
-    _driver->_SlDrvProtectionObjLockWaitForever();
+    _cc3100_->_driver._SlDrvProtectionObjLockWaitForever();
 
     memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t));
-    _driver->_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
-    _driver->_SlDrvProtectionObjUnLock();
+    _cc3100_->_driver._SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
+    _cc3100_->_driver._SlDrvProtectionObjUnLock();
     return;
 }
 
@@ -787,7 +784,7 @@
             Token_value.token_value = httpServerResponse.ResponseData.token_value.data;
 
 
-            _netapp->sl_NetAppSendTokenValue(&Token_value);
+            _cc3100_->_netapp.sl_NetAppSendTokenValue(&Token_value);
 #endif
         }
         break;
--- a/simplelink/cc3100_sl_common.h	Thu Mar 19 15:39:08 2015 +0000
+++ b/simplelink/cc3100_sl_common.h	Thu Sep 03 13:43:50 2015 +0000
@@ -65,10 +65,11 @@
  * Values for below macros shall be modified per the access-point's (AP) properties
  * SimpleLink device will connect to following AP when the application is executed
  */
-
-#define SSID_NAME       "OpenWrt"         /* Access point name to connect to. */
+#define SSID_NAME         "**********"
+//#define SSID_NAME       "OpenWrt"         /* Access point name to connect to. */
 #define SEC_TYPE        SL_SEC_TYPE_WPA_WPA2    /* Security type of the Access point */
-#define PASSKEY         "**********"                  /* Password in case of secure AP */
+#define PASSKEY           "**********"
+//#define PASSKEY         "**********"                  /* Password in case of secure AP */
 #define PASSKEY_LEN     strlen(PASSKEY)  /* Password length in case of secure AP */
 
 /* Configuration of the device when it comes up in AP mode */
--- a/simplelink/cc3100_spi.cpp	Thu Mar 19 15:39:08 2015 +0000
+++ b/simplelink/cc3100_spi.cpp	Thu Sep 03 13:43:50 2015 +0000
@@ -47,7 +47,7 @@
     : _wlan_irq(cc3100_irq), _wlan_nHIB(cc3100_nHIB), _wlan_cs(cc3100_cs), _wlan_spi(cc3100_spi), _driver(driver)
 {
 
-    _wlan_spi.format(8,1);
+    _wlan_spi.format(8,0);
     _wlan_spi.frequency(16000000);
     _wlan_irq.rise(this, &cc3100_spi::IntSpiGPIOHandler);      //_SlDrvRxIrqHandler is triggered after IntSpiGPIOHandler
     _wlan_nHIB = 0;