wifi test

Dependencies:   X_NUCLEO_IKS01A2 mbed-http

Committer:
JMF
Date:
Wed Sep 05 14:28:24 2018 +0000
Revision:
0:24d3eb812fd4
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JMF 0:24d3eb812fd4 1 /*
JMF 0:24d3eb812fd4 2 Copyright (c) 2016 Fred Kellerman
JMF 0:24d3eb812fd4 3
JMF 0:24d3eb812fd4 4 Permission is hereby granted, free of charge, to any person obtaining a copy
JMF 0:24d3eb812fd4 5 of this software and associated documentation files (the "Software"), to deal
JMF 0:24d3eb812fd4 6 in the Software without restriction, including without limitation the rights
JMF 0:24d3eb812fd4 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
JMF 0:24d3eb812fd4 8 copies of the Software, and to permit persons to whom the Software is
JMF 0:24d3eb812fd4 9 furnished to do so, subject to the following conditions:
JMF 0:24d3eb812fd4 10
JMF 0:24d3eb812fd4 11 The above copyright notice and this permission notice shall be included in
JMF 0:24d3eb812fd4 12 all copies or substantial portions of the Software.
JMF 0:24d3eb812fd4 13
JMF 0:24d3eb812fd4 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
JMF 0:24d3eb812fd4 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
JMF 0:24d3eb812fd4 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
JMF 0:24d3eb812fd4 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
JMF 0:24d3eb812fd4 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
JMF 0:24d3eb812fd4 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
JMF 0:24d3eb812fd4 20 THE SOFTWARE.
JMF 0:24d3eb812fd4 21
JMF 0:24d3eb812fd4 22 @file WncControllerK64F.h
JMF 0:24d3eb812fd4 23 @purpose Contains K64F and mbed specifics to control the WNC modem using the WncController base class.
JMF 0:24d3eb812fd4 24 @version 1.0
JMF 0:24d3eb812fd4 25 @date July 2016
JMF 0:24d3eb812fd4 26 @author Fred Kellerman
JMF 0:24d3eb812fd4 27 */
JMF 0:24d3eb812fd4 28
JMF 0:24d3eb812fd4 29 #ifndef __WNCCONTROLLERK64F_H_
JMF 0:24d3eb812fd4 30 #define __WNCCONTROLLERK64F_H_
JMF 0:24d3eb812fd4 31
JMF 0:24d3eb812fd4 32 #include <string>
JMF 0:24d3eb812fd4 33 #include <stdint.h>
JMF 0:24d3eb812fd4 34 #include "mbed.h"
JMF 0:24d3eb812fd4 35 #include "WNCDebug.h"
JMF 0:24d3eb812fd4 36 #include "WNCIO.h"
JMF 0:24d3eb812fd4 37 #include "WncController.h"
JMF 0:24d3eb812fd4 38
JMF 0:24d3eb812fd4 39 namespace WncControllerK64F_fk {
JMF 0:24d3eb812fd4 40
JMF 0:24d3eb812fd4 41 using namespace WncController_fk;
JMF 0:24d3eb812fd4 42 using namespace std;
JMF 0:24d3eb812fd4 43
JMF 0:24d3eb812fd4 44 /** List of K64F pins that are used to control and setup the ATT IoT Kit WNC Shield */
JMF 0:24d3eb812fd4 45 struct WncGpioPinListK64F {
JMF 0:24d3eb812fd4 46 /////////////////////////////////////////////////////
JMF 0:24d3eb812fd4 47 // NXP GPIO Pins that are used to initialize the WNC Shield
JMF 0:24d3eb812fd4 48 /////////////////////////////////////////////////////
JMF 0:24d3eb812fd4 49 DigitalOut * mdm_uart2_rx_boot_mode_sel; // on powerup, 0 = boot mode, 1 = normal boot
JMF 0:24d3eb812fd4 50 DigitalOut * mdm_power_on; // 0 = turn modem on, 1 = turn modem off (should be held high for >5 seconds to cycle modem)
JMF 0:24d3eb812fd4 51 DigitalOut * mdm_wakeup_in; // 0 = let modem sleep, 1 = keep modem awake -- Note: pulled high on shield
JMF 0:24d3eb812fd4 52 DigitalOut * mdm_reset; // active high
JMF 0:24d3eb812fd4 53 DigitalOut * shield_3v3_1v8_sig_trans_ena; // 0 = disabled (all signals high impedence, 1 = translation active
JMF 0:24d3eb812fd4 54 DigitalOut * mdm_uart1_cts;
JMF 0:24d3eb812fd4 55 };
JMF 0:24d3eb812fd4 56
JMF 0:24d3eb812fd4 57
JMF 0:24d3eb812fd4 58 /**
JMF 0:24d3eb812fd4 59 * @author Fred Kellerman
JMF 0:24d3eb812fd4 60 * @see API
JMF 0:24d3eb812fd4 61 *
JMF 0:24d3eb812fd4 62 * <b>WncControllerK64F</b> This mbed C++ class is for controlling the WNC
JMF 0:24d3eb812fd4 63 * Cellular modem from the NXP K64F Freedom board. It uses the control code
JMF 0:24d3eb812fd4 64 * from it's base class WncController to handle the WNC Modem AT cmds. This
JMF 0:24d3eb812fd4 65 * class fulfills various pure virtual methods of the base class. The point of
JMF 0:24d3eb812fd4 66 * this class is to have the platform specific code in it thus isolating the
JMF 0:24d3eb812fd4 67 * control code logic from any particular platform or OS.
JMF 0:24d3eb812fd4 68 */
JMF 0:24d3eb812fd4 69 class WncControllerK64F : public WncController
JMF 0:24d3eb812fd4 70 {
JMF 0:24d3eb812fd4 71 public:
JMF 0:24d3eb812fd4 72
JMF 0:24d3eb812fd4 73 /**
JMF 0:24d3eb812fd4 74 *
JMF 0:24d3eb812fd4 75 * Sets up the resources to control the WNC modem shield.
JMF 0:24d3eb812fd4 76 * @ingroup API
JMF 0:24d3eb812fd4 77 * @param pPins - pointer to a list of K64F pins that are used to setup and control the ATT IoT Kit's WNC Shield.
JMF 0:24d3eb812fd4 78 * @param wnc_uart - a pointer to the serial uart that is used to communicate with the WNC modem.
JMF 0:24d3eb812fd4 79 * @param debug_uart - a pointer to a serial uart for the debug output to go out of, if NULL debug will not be output.
JMF 0:24d3eb812fd4 80 */
JMF 0:24d3eb812fd4 81 WncControllerK64F(struct WncGpioPinListK64F * pPins, WncIO * wnc_uart, WNCDebug * debug_uart = NULL);
JMF 0:24d3eb812fd4 82
JMF 0:24d3eb812fd4 83 /**
JMF 0:24d3eb812fd4 84 *
JMF 0:24d3eb812fd4 85 * Activates a mode where the user can send text to and from the K64F
JMF 0:24d3eb812fd4 86 * debug Serial port directly to the WNC. The mode is entered via this
JMF 0:24d3eb812fd4 87 * call. The mode is exited when the user types CTRL-Q. While in this
JMF 0:24d3eb812fd4 88 * mode all text to and from the WNC is consumed by the debug Serial port.
JMF 0:24d3eb812fd4 89 * No other methods in the class will receive any of the WNC output.
JMF 0:24d3eb812fd4 90 * @ingroup API
JMF 0:24d3eb812fd4 91 * @param pUart - a pointer to a uart to use to collect the user input and put the output from the WNC.
JMF 0:24d3eb812fd4 92 * @param echoOn - set to true to echo what is input back to the output of pUart.
JMF 0:24d3eb812fd4 93 */
JMF 0:24d3eb812fd4 94 bool enterWncTerminalMode(WncIO *pUart, bool echoOn);
JMF 0:24d3eb812fd4 95
JMF 0:24d3eb812fd4 96 private:
JMF 0:24d3eb812fd4 97
JMF 0:24d3eb812fd4 98 // Disallow copy
JMF 0:24d3eb812fd4 99 WncControllerK64F operator=(WncControllerK64F lhs);
JMF 0:24d3eb812fd4 100
JMF 0:24d3eb812fd4 101 // Users must define these functionalities:
JMF 0:24d3eb812fd4 102 virtual int putc(char c);
JMF 0:24d3eb812fd4 103 virtual int puts(const char * s);
JMF 0:24d3eb812fd4 104 virtual char getc(void);
JMF 0:24d3eb812fd4 105 virtual int charReady(void);
JMF 0:24d3eb812fd4 106 virtual int dbgWriteChar(char b);
JMF 0:24d3eb812fd4 107 virtual int dbgWriteChars(const char *b);
JMF 0:24d3eb812fd4 108 virtual bool initWncModem(uint8_t powerUpTimeoutSecs);
JMF 0:24d3eb812fd4 109 virtual void waitMs(int t);
JMF 0:24d3eb812fd4 110 virtual void waitUs(int t);
JMF 0:24d3eb812fd4 111
JMF 0:24d3eb812fd4 112 virtual int getLogTimerTicks(void);
JMF 0:24d3eb812fd4 113 virtual void startTimerA(void);
JMF 0:24d3eb812fd4 114 virtual void stopTimerA(void);
JMF 0:24d3eb812fd4 115 virtual int getTimerTicksA_mS(void);
JMF 0:24d3eb812fd4 116 virtual void startTimerB(void);
JMF 0:24d3eb812fd4 117 virtual void stopTimerB(void);
JMF 0:24d3eb812fd4 118 virtual int getTimerTicksB_mS(void);
JMF 0:24d3eb812fd4 119
JMF 0:24d3eb812fd4 120 WNCDebug * m_pDbgUart;
JMF 0:24d3eb812fd4 121 WncIO * m_pWncUart;
JMF 0:24d3eb812fd4 122 WncGpioPinListK64F m_gpioPinList;
JMF 0:24d3eb812fd4 123 Timer m_logTimer;
JMF 0:24d3eb812fd4 124 Timer m_timerA;
JMF 0:24d3eb812fd4 125 Timer m_timerB;
JMF 0:24d3eb812fd4 126 };
JMF 0:24d3eb812fd4 127
JMF 0:24d3eb812fd4 128 }; // End namespace WncController_fk
JMF 0:24d3eb812fd4 129
JMF 0:24d3eb812fd4 130 #endif
JMF 0:24d3eb812fd4 131