wifi test
Dependencies: X_NUCLEO_IKS01A2 mbed-http
WncControllerK64F.h
00001 /* 00002 Copyright (c) 2016 Fred Kellerman 00003 00004 Permission is hereby granted, free of charge, to any person obtaining a copy 00005 of this software and associated documentation files (the "Software"), to deal 00006 in the Software without restriction, including without limitation the rights 00007 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00008 copies of the Software, and to permit persons to whom the Software is 00009 furnished to do so, subject to the following conditions: 00010 00011 The above copyright notice and this permission notice shall be included in 00012 all copies or substantial portions of the Software. 00013 00014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00017 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00018 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00019 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00020 THE SOFTWARE. 00021 00022 @file WncControllerK64F.h 00023 @purpose Contains K64F and mbed specifics to control the WNC modem using the WncController base class. 00024 @version 1.0 00025 @date July 2016 00026 @author Fred Kellerman 00027 */ 00028 00029 #ifndef __WNCCONTROLLERK64F_H_ 00030 #define __WNCCONTROLLERK64F_H_ 00031 00032 #include <string> 00033 #include <stdint.h> 00034 #include "mbed.h" 00035 #include "WNCDebug.h" 00036 #include "WNCIO.h" 00037 #include "WncController.h" 00038 00039 namespace WncControllerK64F_fk { 00040 00041 using namespace WncController_fk; 00042 using namespace std; 00043 00044 /** List of K64F pins that are used to control and setup the ATT IoT Kit WNC Shield */ 00045 struct WncGpioPinListK64F { 00046 ///////////////////////////////////////////////////// 00047 // NXP GPIO Pins that are used to initialize the WNC Shield 00048 ///////////////////////////////////////////////////// 00049 DigitalOut * mdm_uart2_rx_boot_mode_sel; // on powerup, 0 = boot mode, 1 = normal boot 00050 DigitalOut * mdm_power_on; // 0 = turn modem on, 1 = turn modem off (should be held high for >5 seconds to cycle modem) 00051 DigitalOut * mdm_wakeup_in; // 0 = let modem sleep, 1 = keep modem awake -- Note: pulled high on shield 00052 DigitalOut * mdm_reset; // active high 00053 DigitalOut * shield_3v3_1v8_sig_trans_ena; // 0 = disabled (all signals high impedence, 1 = translation active 00054 DigitalOut * mdm_uart1_cts; 00055 }; 00056 00057 00058 /** 00059 * @author Fred Kellerman 00060 * @see API 00061 * 00062 * <b>WncControllerK64F</b> This mbed C++ class is for controlling the WNC 00063 * Cellular modem from the NXP K64F Freedom board. It uses the control code 00064 * from it's base class WncController to handle the WNC Modem AT cmds. This 00065 * class fulfills various pure virtual methods of the base class. The point of 00066 * this class is to have the platform specific code in it thus isolating the 00067 * control code logic from any particular platform or OS. 00068 */ 00069 class WncControllerK64F : public WncController 00070 { 00071 public: 00072 00073 /** 00074 * 00075 * Sets up the resources to control the WNC modem shield. 00076 * @ingroup API 00077 * @param pPins - pointer to a list of K64F pins that are used to setup and control the ATT IoT Kit's WNC Shield. 00078 * @param wnc_uart - a pointer to the serial uart that is used to communicate with the WNC modem. 00079 * @param debug_uart - a pointer to a serial uart for the debug output to go out of, if NULL debug will not be output. 00080 */ 00081 WncControllerK64F (struct WncGpioPinListK64F * pPins, WncIO * wnc_uart, WNCDebug * debug_uart = NULL); 00082 00083 /** 00084 * 00085 * Activates a mode where the user can send text to and from the K64F 00086 * debug Serial port directly to the WNC. The mode is entered via this 00087 * call. The mode is exited when the user types CTRL-Q. While in this 00088 * mode all text to and from the WNC is consumed by the debug Serial port. 00089 * No other methods in the class will receive any of the WNC output. 00090 * @ingroup API 00091 * @param pUart - a pointer to a uart to use to collect the user input and put the output from the WNC. 00092 * @param echoOn - set to true to echo what is input back to the output of pUart. 00093 */ 00094 bool enterWncTerminalMode(WncIO *pUart, bool echoOn); 00095 00096 private: 00097 00098 // Disallow copy 00099 WncControllerK64F operator=(WncControllerK64F lhs); 00100 00101 // Users must define these functionalities: 00102 virtual int putc(char c); 00103 virtual int puts(const char * s); 00104 virtual char getc(void); 00105 virtual int charReady(void); 00106 virtual int dbgWriteChar(char b); 00107 virtual int dbgWriteChars(const char *b); 00108 virtual bool initWncModem(uint8_t powerUpTimeoutSecs); 00109 virtual void waitMs(int t); 00110 virtual void waitUs(int t); 00111 00112 virtual int getLogTimerTicks(void); 00113 virtual void startTimerA(void); 00114 virtual void stopTimerA(void); 00115 virtual int getTimerTicksA_mS(void); 00116 virtual void startTimerB(void); 00117 virtual void stopTimerB(void); 00118 virtual int getTimerTicksB_mS(void); 00119 00120 WNCDebug * m_pDbgUart; 00121 WncIO * m_pWncUart; 00122 WncGpioPinListK64F m_gpioPinList; 00123 Timer m_logTimer; 00124 Timer m_timerA; 00125 Timer m_timerB; 00126 }; 00127 00128 }; // End namespace WncController_fk 00129 00130 #endif 00131
Generated on Tue Jul 12 2022 17:09:10 by 1.7.2