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/mbed/sdk.h@11:ea484e1b7fc4, 2014-08-12 (annotated)
- Committer:
- dan_ackme
- Date:
- Tue Aug 12 02:34:46 2014 -0700
- Revision:
- 11:ea484e1b7fc4
- Parent:
- 1:6ec9998427ad
- Child:
- 13:2b51f5267c92
updated documnetation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dan_ackme | 0:ea85c4bb5e1f | 1 | /* |
dan_ackme | 0:ea85c4bb5e1f | 2 | * Copyright 2014, ACKme Networks |
dan_ackme | 0:ea85c4bb5e1f | 3 | * All Rights Reserved. |
dan_ackme | 0:ea85c4bb5e1f | 4 | * |
dan_ackme | 0:ea85c4bb5e1f | 5 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks; |
dan_ackme | 0:ea85c4bb5e1f | 6 | * the contents of this file may not be disclosed to third parties, copied |
dan_ackme | 0:ea85c4bb5e1f | 7 | * or duplicated in any form, in whole or in part, without the prior |
dan_ackme | 0:ea85c4bb5e1f | 8 | * written permission of ACKme Networks. |
dan_ackme | 0:ea85c4bb5e1f | 9 | */ |
dan_ackme | 0:ea85c4bb5e1f | 10 | |
dan_ackme | 0:ea85c4bb5e1f | 11 | #pragma once |
dan_ackme | 0:ea85c4bb5e1f | 12 | |
dan_ackme | 0:ea85c4bb5e1f | 13 | |
dan_ackme | 0:ea85c4bb5e1f | 14 | #define MBED_SDK |
dan_ackme | 0:ea85c4bb5e1f | 15 | |
dan_ackme | 0:ea85c4bb5e1f | 16 | #include "mbed.h" |
dan_ackme | 0:ea85c4bb5e1f | 17 | |
dan_ackme | 0:ea85c4bb5e1f | 18 | namespace wiconnect |
dan_ackme | 0:ea85c4bb5e1f | 19 | { |
dan_ackme | 0:ea85c4bb5e1f | 20 | |
dan_ackme | 11:ea484e1b7fc4 | 21 | /** |
dan_ackme | 11:ea484e1b7fc4 | 22 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 23 | * @brief When defined enables asynchronous command processing |
dan_ackme | 11:ea484e1b7fc4 | 24 | */ |
dan_ackme | 0:ea85c4bb5e1f | 25 | #define WICONNECT_ASYNC_TIMER_ENABLED |
dan_ackme | 11:ea484e1b7fc4 | 26 | /** |
dan_ackme | 11:ea484e1b7fc4 | 27 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 28 | * @brief When defined enables user supplied dynamic memory allocation |
dan_ackme | 11:ea484e1b7fc4 | 29 | */ |
dan_ackme | 0:ea85c4bb5e1f | 30 | #define WICONNECT_ENABLE_MALLOC |
dan_ackme | 11:ea484e1b7fc4 | 31 | /** |
dan_ackme | 11:ea484e1b7fc4 | 32 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 33 | * @brief When defined enables Host<->Wiconnect Module serial RX buffering |
dan_ackme | 11:ea484e1b7fc4 | 34 | */ |
dan_ackme | 0:ea85c4bb5e1f | 35 | #define WICONNECT_SERIAL_RX_BUFFER |
dan_ackme | 11:ea484e1b7fc4 | 36 | /** |
dan_ackme | 11:ea484e1b7fc4 | 37 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 38 | * @brief When defined enables certain conversion API functions to use a default buffer to store string |
dan_ackme | 11:ea484e1b7fc4 | 39 | */ |
dan_ackme | 0:ea85c4bb5e1f | 40 | #define WICONNECT_USE_DEFAULT_STRING_BUFFERS |
dan_ackme | 0:ea85c4bb5e1f | 41 | |
dan_ackme | 11:ea484e1b7fc4 | 42 | /** |
dan_ackme | 11:ea484e1b7fc4 | 43 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 44 | * @brief When WICONNECT_ENABLE_MALLOC defined, this is the default malloc function |
dan_ackme | 11:ea484e1b7fc4 | 45 | */ |
dan_ackme | 0:ea85c4bb5e1f | 46 | #define WICONNECT_DEFAULT_MALLOC malloc |
dan_ackme | 11:ea484e1b7fc4 | 47 | /** |
dan_ackme | 11:ea484e1b7fc4 | 48 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 49 | * @brief When WICONNECT_ENABLE_MALLOC defined, this is the default free function |
dan_ackme | 11:ea484e1b7fc4 | 50 | */ |
dan_ackme | 0:ea85c4bb5e1f | 51 | #define WICONNECT_DEFAULT_FREE free |
dan_ackme | 0:ea85c4bb5e1f | 52 | |
dan_ackme | 11:ea484e1b7fc4 | 53 | /** |
dan_ackme | 11:ea484e1b7fc4 | 54 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 55 | * @brief The default Host<->Wiconnect Module serial BAUD rate |
dan_ackme | 11:ea484e1b7fc4 | 56 | */ |
dan_ackme | 0:ea85c4bb5e1f | 57 | #define WICONNECT_DEFAULT_BAUD 115200 |
dan_ackme | 11:ea484e1b7fc4 | 58 | /** |
dan_ackme | 11:ea484e1b7fc4 | 59 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 60 | * @brief The default command timeout (i.e max command executing time) |
dan_ackme | 11:ea484e1b7fc4 | 61 | */ |
dan_ackme | 0:ea85c4bb5e1f | 62 | #define WICONNECT_DEFAULT_TIMEOUT 3000 // ms |
dan_ackme | 11:ea484e1b7fc4 | 63 | /** |
dan_ackme | 11:ea484e1b7fc4 | 64 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 65 | * @brief When WICONNECT_ASYNC_TIMER_ENABLED, this specifies the max number of asynchronous commands that may be queued |
dan_ackme | 11:ea484e1b7fc4 | 66 | */ |
dan_ackme | 0:ea85c4bb5e1f | 67 | #define WICONNECT_MAX_QUEUED_COMMANDS 8 |
dan_ackme | 11:ea484e1b7fc4 | 68 | /** |
dan_ackme | 11:ea484e1b7fc4 | 69 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 70 | * @brief When WICONNECT_ASYNC_TIMER_ENABLED, this specifies the period in milliseconds commands should be processed |
dan_ackme | 11:ea484e1b7fc4 | 71 | */ |
dan_ackme | 0:ea85c4bb5e1f | 72 | #define WICONNECT_DEFAULT_COMMAND_PROCESSING_PERIOD 50 // ms |
dan_ackme | 0:ea85c4bb5e1f | 73 | |
dan_ackme | 11:ea484e1b7fc4 | 74 | /** |
dan_ackme | 11:ea484e1b7fc4 | 75 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 76 | * @brief The default blocking mode of the Library. |
dan_ackme | 11:ea484e1b7fc4 | 77 | */ |
dan_ackme | 11:ea484e1b7fc4 | 78 | #define WICONNECT_DEFAULT_NONBLOCKING false |
dan_ackme | 0:ea85c4bb5e1f | 79 | |
dan_ackme | 11:ea484e1b7fc4 | 80 | |
dan_ackme | 11:ea484e1b7fc4 | 81 | |
dan_ackme | 11:ea484e1b7fc4 | 82 | // ---------------------------------------------------------------------------- |
dan_ackme | 0:ea85c4bb5e1f | 83 | |
dan_ackme | 0:ea85c4bb5e1f | 84 | #define WICONNECT_GPIO_BASE_CLASS : DigitalOut |
dan_ackme | 0:ea85c4bb5e1f | 85 | #define WICONNECT_SERIAL_BASE_CLASS : RawSerial |
dan_ackme | 0:ea85c4bb5e1f | 86 | #define WICONNECT_PERIODIC_TIMER_BASE_CLASS : Ticker |
dan_ackme | 0:ea85c4bb5e1f | 87 | #define WICONNECT_EXTERNAL_INTERRUPT_GPIO_BASE_CLASS : InterruptIn |
dan_ackme | 0:ea85c4bb5e1f | 88 | |
dan_ackme | 11:ea484e1b7fc4 | 89 | #define WICONNECT_MAX_PIN_IRQ_HANDLERS 3 |
dan_ackme | 0:ea85c4bb5e1f | 90 | |
dan_ackme | 0:ea85c4bb5e1f | 91 | |
dan_ackme | 11:ea484e1b7fc4 | 92 | /** |
dan_ackme | 11:ea484e1b7fc4 | 93 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 94 | * @brief Default value for a pin, Not connected |
dan_ackme | 11:ea484e1b7fc4 | 95 | */ |
dan_ackme | 0:ea85c4bb5e1f | 96 | #define PIN_NC NC |
dan_ackme | 0:ea85c4bb5e1f | 97 | |
dan_ackme | 11:ea484e1b7fc4 | 98 | /** |
dan_ackme | 11:ea484e1b7fc4 | 99 | * @ingroup types_core |
dan_ackme | 11:ea484e1b7fc4 | 100 | * @brief Pin name on HOST |
dan_ackme | 11:ea484e1b7fc4 | 101 | */ |
dan_ackme | 0:ea85c4bb5e1f | 102 | typedef PinName Pin; |
dan_ackme | 0:ea85c4bb5e1f | 103 | |
dan_ackme | 11:ea484e1b7fc4 | 104 | /** |
dan_ackme | 11:ea484e1b7fc4 | 105 | * @ingroup types_core |
dan_ackme | 11:ea484e1b7fc4 | 106 | * @brief Host<->Wiconnect Module serial configuration |
dan_ackme | 11:ea484e1b7fc4 | 107 | */ |
dan_ackme | 0:ea85c4bb5e1f | 108 | typedef struct _SerialConfig |
dan_ackme | 0:ea85c4bb5e1f | 109 | { |
dan_ackme | 0:ea85c4bb5e1f | 110 | Pin rx; |
dan_ackme | 0:ea85c4bb5e1f | 111 | Pin tx; |
dan_ackme | 0:ea85c4bb5e1f | 112 | Pin cts; |
dan_ackme | 0:ea85c4bb5e1f | 113 | Pin rts; |
dan_ackme | 0:ea85c4bb5e1f | 114 | int baud; |
dan_ackme | 0:ea85c4bb5e1f | 115 | void *serialRxBuffer; |
dan_ackme | 0:ea85c4bb5e1f | 116 | int serialRxBufferSize; |
dan_ackme | 0:ea85c4bb5e1f | 117 | |
dan_ackme | 11:ea484e1b7fc4 | 118 | _SerialConfig(Pin rx, Pin tx, Pin cts, Pin rts, int baud = WICONNECT_DEFAULT_BAUD, int serialRxBufferSize = 0, void *serialRxBuffer = NULL) |
dan_ackme | 0:ea85c4bb5e1f | 119 | { |
dan_ackme | 0:ea85c4bb5e1f | 120 | this->rx =rx; |
dan_ackme | 0:ea85c4bb5e1f | 121 | this->tx =tx; |
dan_ackme | 0:ea85c4bb5e1f | 122 | this->cts =cts; |
dan_ackme | 0:ea85c4bb5e1f | 123 | this->rts =rts; |
dan_ackme | 0:ea85c4bb5e1f | 124 | this->baud = baud; |
dan_ackme | 0:ea85c4bb5e1f | 125 | this->serialRxBuffer =serialRxBuffer; |
dan_ackme | 0:ea85c4bb5e1f | 126 | this->serialRxBufferSize =serialRxBufferSize; |
dan_ackme | 0:ea85c4bb5e1f | 127 | } |
dan_ackme | 0:ea85c4bb5e1f | 128 | |
dan_ackme | 0:ea85c4bb5e1f | 129 | _SerialConfig(Pin rx, Pin tx, int baud = WICONNECT_DEFAULT_BAUD) |
dan_ackme | 0:ea85c4bb5e1f | 130 | { |
dan_ackme | 0:ea85c4bb5e1f | 131 | this->rx =rx; |
dan_ackme | 0:ea85c4bb5e1f | 132 | this->tx =tx; |
dan_ackme | 0:ea85c4bb5e1f | 133 | this->cts =PIN_NC; |
dan_ackme | 0:ea85c4bb5e1f | 134 | this->rts =PIN_NC; |
dan_ackme | 0:ea85c4bb5e1f | 135 | this->baud = baud; |
dan_ackme | 0:ea85c4bb5e1f | 136 | this->serialRxBuffer =NULL; |
dan_ackme | 0:ea85c4bb5e1f | 137 | this->serialRxBufferSize =0; |
dan_ackme | 0:ea85c4bb5e1f | 138 | } |
dan_ackme | 0:ea85c4bb5e1f | 139 | |
dan_ackme | 0:ea85c4bb5e1f | 140 | } SerialConfig; |
dan_ackme | 0:ea85c4bb5e1f | 141 | |
dan_ackme | 0:ea85c4bb5e1f | 142 | |
dan_ackme | 11:ea484e1b7fc4 | 143 | /** |
dan_ackme | 11:ea484e1b7fc4 | 144 | * @ingroup api_core_macro |
dan_ackme | 11:ea484e1b7fc4 | 145 | * @brief Function to stop processor for specified number of milliseconds |
dan_ackme | 11:ea484e1b7fc4 | 146 | */ |
dan_ackme | 0:ea85c4bb5e1f | 147 | #define delayMs(ms) wait_ms(ms) |
dan_ackme | 0:ea85c4bb5e1f | 148 | |
dan_ackme | 0:ea85c4bb5e1f | 149 | |
dan_ackme | 0:ea85c4bb5e1f | 150 | |
dan_ackme | 0:ea85c4bb5e1f | 151 | |
dan_ackme | 0:ea85c4bb5e1f | 152 | } |