Get basic debug info from the WNC M14A21.

Dependencies:   JSON M2XStreamClient-JMF WNCInterface mbed-rtos mbed

Fork of WNCInterface_HTTP_example by Avnet

Committer:
rfinn
Date:
Sat Nov 19 16:44:33 2016 +0000
Revision:
6:5467db9f2674
Parent:
3:5cc9de44aea5
initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:50979ffa39b6 1 /* =====================================================================
JMF 0:50979ffa39b6 2 Copyright © 2016, Avnet (R)
JMF 0:50979ffa39b6 3
JMF 0:50979ffa39b6 4 Contributors:
JMF 0:50979ffa39b6 5 * James M Flynn, www.em.avnet.com
JMF 0:50979ffa39b6 6
JMF 0:50979ffa39b6 7 Licensed under the Apache License, Version 2.0 (the "License");
JMF 0:50979ffa39b6 8 you may not use this file except in compliance with the License.
JMF 0:50979ffa39b6 9 You may obtain a copy of the License at
JMF 0:50979ffa39b6 10
JMF 0:50979ffa39b6 11 http://www.apache.org/licenses/LICENSE-2.0
JMF 0:50979ffa39b6 12
JMF 0:50979ffa39b6 13 Unless required by applicable law or agreed to in writing,
JMF 0:50979ffa39b6 14 software distributed under the License is distributed on an
JMF 0:50979ffa39b6 15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
JMF 0:50979ffa39b6 16 either express or implied. See the License for the specific
JMF 0:50979ffa39b6 17 language governing permissions and limitations under the License.
JMF 0:50979ffa39b6 18
JMF 0:50979ffa39b6 19 @file WNCInterface.cpp
JMF 0:50979ffa39b6 20 @version 1.0
JMF 0:50979ffa39b6 21 @date Sept 2016
JMF 0:50979ffa39b6 22
JMF 0:50979ffa39b6 23 ======================================================================== */
JMF 0:50979ffa39b6 24
JMF 0:50979ffa39b6 25 #include "mbed.h"
JMF 0:50979ffa39b6 26 #include "WNCInterface.h"
JMF 0:50979ffa39b6 27
JMF 0:50979ffa39b6 28 #define DEBUG
JMF 0:50979ffa39b6 29 #define MBED_PLATFORM
JMF 0:50979ffa39b6 30 #include "HTTPClient.h"
JMF 0:50979ffa39b6 31
rfinn 6:5467db9f2674 32 #define DELAY_INTERVAL 10000
rfinn 6:5467db9f2674 33
JMF 0:50979ffa39b6 34 #define CRLF "\n\r"
JMF 0:50979ffa39b6 35
JMF 0:50979ffa39b6 36 #define ntohl(n) ((n & 0xff) << 24) |\
JMF 0:50979ffa39b6 37 ((n & 0xff00) << 8) |\
JMF 0:50979ffa39b6 38 ((n & 0xff0000UL) >> 8) |\
JMF 0:50979ffa39b6 39 ((n & 0xff000000UL) >> 24)
rfinn 6:5467db9f2674 40
JMF 0:50979ffa39b6 41 int main() {
JMF 0:50979ffa39b6 42 int ret;
JMF 0:50979ffa39b6 43 WNCInterface wnc;
JMF 2:8fb99c9f5075 44 MODSERIAL pc(USBTX,USBRX,256,256);
JMF 2:8fb99c9f5075 45
JMF 2:8fb99c9f5075 46 pc.baud(115200);
rfinn 6:5467db9f2674 47 pc.printf("STARTING WNCInterface Info" CRLF);
JMF 0:50979ffa39b6 48
rfinn 6:5467db9f2674 49 wnc.doDebug(3);
rfinn 6:5467db9f2674 50 ret = wnc.init();
JMF 3:5cc9de44aea5 51 pc.printf("WNC Module %s initialized (%02X)." CRLF, ret?"IS":"IS NOT", ret);
JMF 0:50979ffa39b6 52 if( !ret ) {
JMF 0:50979ffa39b6 53 printf(" - - - - - - - ALL DONE - - - - - - - " CRLF);
JMF 0:50979ffa39b6 54 while(1);
JMF 0:50979ffa39b6 55 }
JMF 0:50979ffa39b6 56
JMF 0:50979ffa39b6 57 ret = wnc.connect();
JMF 0:50979ffa39b6 58 printf("IP Address: %s " CRLF CRLF, wnc.getIPAddress());
JMF 0:50979ffa39b6 59
JMF 0:50979ffa39b6 60
JMF 0:50979ffa39b6 61
JMF 0:50979ffa39b6 62 wnc.disconnect();
JMF 0:50979ffa39b6 63 printf(" - - - - - - - ALL DONE - - - - - - - " CRLF);
JMF 0:50979ffa39b6 64 }
JMF 0:50979ffa39b6 65