Host library for controlling a WiConnect enabled Wi-Fi module.
Dependents: wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more
sdk.h
00001 /** 00002 * ACKme WiConnect Host Library is licensed under the BSD licence: 00003 * 00004 * Copyright (c)2014 ACKme Networks. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without modification, 00008 * are permitted provided that the following conditions are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright notice, 00011 * this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright notice, 00013 * this list of conditions and the following disclaimer in the documentation 00014 * and/or other materials provided with the distribution. 00015 * 3. The name of the author may not be used to endorse or promote products 00016 * derived from this software without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS AND ANY EXPRESS OR IMPLIED 00019 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00020 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00021 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00022 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00023 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00026 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00027 * OF SUCH DAMAGE. 00028 */ 00029 #pragma once 00030 00031 00032 #define MBED_SDK 00033 00034 #include "mbed.h" 00035 00036 00037 00038 00039 namespace wiconnect 00040 { 00041 00042 /** 00043 * @ingroup api_core_macro 00044 * @brief This is the minimum supported WiConnect version. If your 00045 * WiFi module's firmware is out-dated, use the updateFirmware() 00046 * API call to update your module's firmware. 00047 */ 00048 #define WICONNECT_MINIMUM_VERSION FILE_MAKE_VERSION(2, 0, 0, 11) 00049 00050 /** 00051 * @ingroup api_core_macro 00052 * @brief When defined enables asynchronous command processing 00053 */ 00054 #define WICONNECT_ASYNC_TIMER_ENABLED 00055 /** 00056 * @ingroup api_core_macro 00057 * @brief When defined enables user supplied dynamic memory allocation 00058 */ 00059 #define WICONNECT_ENABLE_MALLOC 00060 /** 00061 * @ingroup api_core_macro 00062 * @brief When defined enables Host<->Wiconnect Module serial RX buffering 00063 */ 00064 #define WICONNECT_SERIAL_RX_BUFFER 00065 /** 00066 * @ingroup api_core_macro 00067 * @brief When defined enables certain conversion API functions to use a default buffer to store string 00068 */ 00069 #define WICONNECT_USE_DEFAULT_STRING_BUFFERS 00070 00071 /** 00072 * @ingroup api_core_macro 00073 * @brief When defined enables external interrupts on specified gpios 00074 */ 00075 #define WICONNECT_GPIO_IRQ_ENABLED 00076 00077 /** 00078 * @ingroup api_core_macro 00079 * @brief When WICONNECT_ENABLE_MALLOC defined, this is the default malloc function 00080 */ 00081 #define WICONNECT_DEFAULT_MALLOC malloc 00082 /** 00083 * @ingroup api_core_macro 00084 * @brief When WICONNECT_ENABLE_MALLOC defined, this is the default free function 00085 */ 00086 #define WICONNECT_DEFAULT_FREE free 00087 00088 /** 00089 * @ingroup api_core_macro 00090 * @brief The default Host<->Wiconnect Module serial BAUD rate 00091 */ 00092 #define WICONNECT_DEFAULT_BAUD 115200 00093 /** 00094 * @ingroup api_core_macro 00095 * @brief The default command timeout (i.e max command executing time) 00096 */ 00097 #define WICONNECT_DEFAULT_TIMEOUT 3000 // ms 00098 /** 00099 * @ingroup api_core_macro 00100 * @brief When WICONNECT_ASYNC_TIMER_ENABLED, this specifies the max number of asynchronous commands that may be queued 00101 */ 00102 #define WICONNECT_MAX_QUEUED_COMMANDS 8 00103 /** 00104 * @ingroup api_core_macro 00105 * @brief When WICONNECT_ASYNC_TIMER_ENABLED, this specifies the period in milliseconds commands should be processed 00106 */ 00107 #define WICONNECT_DEFAULT_COMMAND_PROCESSING_PERIOD 50 // ms 00108 00109 /** 00110 * @ingroup api_core_macro 00111 * @brief The default blocking mode of the Library. 00112 */ 00113 #define WICONNECT_DEFAULT_NONBLOCKING false 00114 00115 /** 00116 * @ingroup api_core_macro 00117 * @brief If defined, enables low-level debugging 00118 */ 00119 #define WICONNECT_ENABLE_DEBUGGING 00120 00121 00122 // ---------------------------------------------------------------------------- 00123 00124 #define WICONNECT_GPIO_BASE_CLASS : DigitalOut 00125 #define WICONNECT_SERIAL_BASE_CLASS : RawSerial 00126 #define WICONNECT_PERIODIC_TIMER_BASE_CLASS : Ticker 00127 #define WICONNECT_EXTERNAL_INTERRUPT_GPIO_BASE_CLASS : InterruptIn 00128 00129 #define WICONNECT_MAX_PIN_IRQ_HANDLERS 3 00130 00131 00132 /** 00133 * @ingroup api_core_macro 00134 * @brief Default value for a pin, Not connected 00135 */ 00136 #define PIN_NC NC 00137 00138 /** 00139 * @ingroup api_core_types 00140 * @brief Pin name on HOST 00141 */ 00142 typedef PinName Pin; 00143 00144 /** 00145 * @ingroup api_core_types 00146 * @brief Host<->Wiconnect Module serial configuration 00147 */ 00148 class SerialConfig 00149 { 00150 public: 00151 Pin rx; 00152 Pin tx; 00153 Pin cts; 00154 Pin rts; 00155 int baud; 00156 void *serialRxBuffer; 00157 int serialRxBufferSize; 00158 00159 SerialConfig(Pin rx, Pin tx, Pin cts, Pin rts, int baud, int serialRxBufferSize, void *serialRxBuffer = NULL) 00160 { 00161 this->rx =rx; 00162 this->tx =tx; 00163 this->cts =cts; 00164 this->rts =rts; 00165 this->baud = baud; 00166 this->serialRxBuffer =serialRxBuffer; 00167 this->serialRxBufferSize =serialRxBufferSize; 00168 } 00169 00170 SerialConfig(Pin rx, Pin tx, int serialRxBufferSize, void *serialRxBuffer = NULL) 00171 { 00172 this->rx =rx; 00173 this->tx =tx; 00174 this->cts = PIN_NC; 00175 this->rts = PIN_NC; 00176 this->baud = WICONNECT_DEFAULT_BAUD; 00177 this->serialRxBuffer =serialRxBuffer; 00178 this->serialRxBufferSize =serialRxBufferSize; 00179 } 00180 00181 SerialConfig(Pin rx, Pin tx) 00182 { 00183 this->rx =rx; 00184 this->tx =tx; 00185 this->cts =PIN_NC; 00186 this->rts =PIN_NC; 00187 this->baud = WICONNECT_DEFAULT_BAUD; 00188 this->serialRxBuffer =NULL; 00189 this->serialRxBufferSize =0; 00190 } 00191 00192 }; 00193 00194 00195 /** 00196 * @ingroup api_core_macro 00197 * @brief Function to stop processor for specified number of milliseconds 00198 */ 00199 #define delayMs(ms) wait_ms(ms) 00200 00201 00202 00203 00204 }
Generated on Tue Jul 12 2022 17:35:58 by 1.7.2