SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html
Dependents: SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more
Fork of YDwifiInterface by
Diff: SNIC_WifiInterface.cpp
- Revision:
- 36:f33fcf5975ab
- Parent:
- 31:15c22824cc46
- Child:
- 37:f3a2053627c2
--- a/SNIC_WifiInterface.cpp Tue Jun 10 10:19:48 2014 +0000 +++ b/SNIC_WifiInterface.cpp Thu Jun 19 10:15:47 2014 +0000 @@ -13,6 +13,8 @@ #include "SNIC_WifiInterface.h" #include "SNIC_UartMsgUtil.h" +#define UART_CONNECT_BUF_SIZE 512 +unsigned char gCONNECT_BUF[UART_CONNECT_BUF_SIZE]; C_SNIC_WifiInterface::C_SNIC_WifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud) { @@ -39,6 +41,7 @@ /* Initialize UART */ snic_core_p->initUart( mUART_tx, mUART_rx, mUART_baud ); + wait(0.5); /* Initialize SNIC API */ // Get buffer for response payload from MemoryPool tagMEMPOOL_BLOCK_T *payload_buf = snic_core_p->allocCmdBuf(); @@ -131,7 +134,6 @@ return 0; } -unsigned char gCONNECT_BUF[UART_REQUEST_PAYLOAD_MAX]; int C_SNIC_WifiInterface::connect(const char *ssid_p, unsigned char ssid_len, E_SECURITY sec_type , const char *sec_key_p, unsigned char sec_key_len) { @@ -164,7 +166,7 @@ unsigned int buf_len = 0; unsigned int command_len; - memset( buf, 0, UART_REQUEST_PAYLOAD_MAX ); + memset( buf, 0, UART_CONNECT_BUF_SIZE ); // Make request buf[0] = UART_CMD_SID_WIFI_JOIN_REQ; buf_len++; @@ -641,5 +643,5 @@ } snic_core_p->freeCmdBuf( payload_buf ); - return 0; + return ret; }