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