modified to get more signal info

Dependencies:   WncControllerModified

Fork of WncControllerK64F by Avnet

Committer:
jmf
Date:
Thu Apr 06 21:43:07 2017 -0400
Revision:
30:11d88f24cde3
Parent:
29:76e8acbafc80
Child:
31:d9558aefb9e0
...

Who changed what in which revision?

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