Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sam_grove 5:3f93dd1d4cb3 1 /* mbed Microcontroller Library
sam_grove 5:3f93dd1d4cb3 2 * Copyright (c) 2006-2013 ARM Limited
sam_grove 5:3f93dd1d4cb3 3 *
sam_grove 5:3f93dd1d4cb3 4 * Licensed under the Apache License, Version 2.0 (the "License");
sam_grove 5:3f93dd1d4cb3 5 * you may not use this file except in compliance with the License.
sam_grove 5:3f93dd1d4cb3 6 * You may obtain a copy of the License at
sam_grove 5:3f93dd1d4cb3 7 *
sam_grove 5:3f93dd1d4cb3 8 * http://www.apache.org/licenses/LICENSE-2.0
sam_grove 5:3f93dd1d4cb3 9 *
sam_grove 5:3f93dd1d4cb3 10 * Unless required by applicable law or agreed to in writing, software
sam_grove 5:3f93dd1d4cb3 11 * distributed under the License is distributed on an "AS IS" BASIS,
sam_grove 5:3f93dd1d4cb3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sam_grove 5:3f93dd1d4cb3 13 * See the License for the specific language governing permissions and
sam_grove 5:3f93dd1d4cb3 14 * limitations under the License.
sam_grove 5:3f93dd1d4cb3 15 */
sam_grove 5:3f93dd1d4cb3 16 #ifndef MBED_INTERRUPTIN_H
sam_grove 5:3f93dd1d4cb3 17 #define MBED_INTERRUPTIN_H
sam_grove 5:3f93dd1d4cb3 18
sam_grove 5:3f93dd1d4cb3 19 #include "platform.h"
sam_grove 5:3f93dd1d4cb3 20
sam_grove 5:3f93dd1d4cb3 21 #if DEVICE_INTERRUPTIN
sam_grove 5:3f93dd1d4cb3 22
sam_grove 5:3f93dd1d4cb3 23 #include "gpio_api.h"
sam_grove 5:3f93dd1d4cb3 24 #include "gpio_irq_api.h"
sam_grove 5:3f93dd1d4cb3 25
sam_grove 5:3f93dd1d4cb3 26 #include "FunctionPointer.h"
sam_grove 5:3f93dd1d4cb3 27 #include "CallChain.h"
sam_grove 5:3f93dd1d4cb3 28
sam_grove 5:3f93dd1d4cb3 29 namespace mbed {
sam_grove 5:3f93dd1d4cb3 30
sam_grove 5:3f93dd1d4cb3 31 /** A digital interrupt input, used to call a function on a rising or falling edge
sam_grove 5:3f93dd1d4cb3 32 *
sam_grove 5:3f93dd1d4cb3 33 * Example:
sam_grove 5:3f93dd1d4cb3 34 * @code
sam_grove 5:3f93dd1d4cb3 35 * // Flash an LED while waiting for events
sam_grove 5:3f93dd1d4cb3 36 *
sam_grove 5:3f93dd1d4cb3 37 * #include "mbed.h"
sam_grove 5:3f93dd1d4cb3 38 *
sam_grove 5:3f93dd1d4cb3 39 * InterruptIn event(p16);
sam_grove 5:3f93dd1d4cb3 40 * DigitalOut led(LED1);
sam_grove 5:3f93dd1d4cb3 41 *
sam_grove 5:3f93dd1d4cb3 42 * void trigger() {
sam_grove 5:3f93dd1d4cb3 43 * printf("triggered!\n");
sam_grove 5:3f93dd1d4cb3 44 * }
sam_grove 5:3f93dd1d4cb3 45 *
sam_grove 5:3f93dd1d4cb3 46 * int main() {
sam_grove 5:3f93dd1d4cb3 47 * event.rise(&trigger);
sam_grove 5:3f93dd1d4cb3 48 * while(1) {
sam_grove 5:3f93dd1d4cb3 49 * led = !led;
sam_grove 5:3f93dd1d4cb3 50 * wait(0.25);
sam_grove 5:3f93dd1d4cb3 51 * }
sam_grove 5:3f93dd1d4cb3 52 * }
sam_grove 5:3f93dd1d4cb3 53 * @endcode
sam_grove 5:3f93dd1d4cb3 54 */
sam_grove 5:3f93dd1d4cb3 55 class InterruptIn {
sam_grove 5:3f93dd1d4cb3 56
sam_grove 5:3f93dd1d4cb3 57 public:
sam_grove 5:3f93dd1d4cb3 58
sam_grove 5:3f93dd1d4cb3 59 /** Create an InterruptIn connected to the specified pin
sam_grove 5:3f93dd1d4cb3 60 *
sam_grove 5:3f93dd1d4cb3 61 * @param pin InterruptIn pin to connect to
sam_grove 5:3f93dd1d4cb3 62 * @param name (optional) A string to identify the object
sam_grove 5:3f93dd1d4cb3 63 */
sam_grove 5:3f93dd1d4cb3 64 InterruptIn(PinName pin);
sam_grove 5:3f93dd1d4cb3 65 virtual ~InterruptIn();
sam_grove 5:3f93dd1d4cb3 66
sam_grove 5:3f93dd1d4cb3 67 int read();
sam_grove 5:3f93dd1d4cb3 68 #ifdef MBED_OPERATORS
sam_grove 5:3f93dd1d4cb3 69 operator int();
sam_grove 5:3f93dd1d4cb3 70
sam_grove 5:3f93dd1d4cb3 71 #endif
sam_grove 5:3f93dd1d4cb3 72
sam_grove 5:3f93dd1d4cb3 73 /** Attach a function to call when a rising edge occurs on the input
sam_grove 5:3f93dd1d4cb3 74 *
sam_grove 5:3f93dd1d4cb3 75 * @param fptr A pointer to a void function, or 0 to set as none
sam_grove 5:3f93dd1d4cb3 76 *
sam_grove 5:3f93dd1d4cb3 77 * @returns
sam_grove 5:3f93dd1d4cb3 78 * The function object created for 'fptr'
sam_grove 5:3f93dd1d4cb3 79 */
sam_grove 5:3f93dd1d4cb3 80 pFunctionPointer_t rise(void (*fptr)(void));
sam_grove 5:3f93dd1d4cb3 81
sam_grove 5:3f93dd1d4cb3 82 /** Add a function to be called when a rising edge occurs at the end of the call chain
sam_grove 5:3f93dd1d4cb3 83 *
sam_grove 5:3f93dd1d4cb3 84 * @param fptr the function to add
sam_grove 5:3f93dd1d4cb3 85 *
sam_grove 5:3f93dd1d4cb3 86 * @returns
sam_grove 5:3f93dd1d4cb3 87 * The function object created for 'fptr'
sam_grove 5:3f93dd1d4cb3 88 */
sam_grove 5:3f93dd1d4cb3 89 pFunctionPointer_t rise_add(void (*fptr)(void)) {
sam_grove 5:3f93dd1d4cb3 90 return rise_add_common(fptr);
sam_grove 5:3f93dd1d4cb3 91 }
sam_grove 5:3f93dd1d4cb3 92
sam_grove 5:3f93dd1d4cb3 93 /** Add a function to be called when a rising edge occurs at the beginning of the call chain
sam_grove 5:3f93dd1d4cb3 94 *
sam_grove 5:3f93dd1d4cb3 95 * @param fptr the function to add
sam_grove 5:3f93dd1d4cb3 96 *
sam_grove 5:3f93dd1d4cb3 97 * @returns
sam_grove 5:3f93dd1d4cb3 98 * The function object created for 'fptr'
sam_grove 5:3f93dd1d4cb3 99 */
sam_grove 5:3f93dd1d4cb3 100 pFunctionPointer_t rise_add_front(void (*fptr)(void)) {
sam_grove 5:3f93dd1d4cb3 101 return rise_add_common(fptr, true);
sam_grove 5:3f93dd1d4cb3 102 }
sam_grove 5:3f93dd1d4cb3 103
sam_grove 5:3f93dd1d4cb3 104 /** Attach a member function to call when a rising edge occurs on the input
sam_grove 5:3f93dd1d4cb3 105 *
sam_grove 5:3f93dd1d4cb3 106 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 107 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 108 *
sam_grove 5:3f93dd1d4cb3 109 * @returns
sam_grove 5:3f93dd1d4cb3 110 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 111 */
sam_grove 5:3f93dd1d4cb3 112 template<typename T>
sam_grove 5:3f93dd1d4cb3 113 pFunctionPointer_t rise(T* tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 114 _rise.clear();
sam_grove 5:3f93dd1d4cb3 115 pFunctionPointer_t pf = _rise.add(tptr, mptr);
sam_grove 5:3f93dd1d4cb3 116 gpio_irq_set(&gpio_irq, IRQ_RISE, 1);
sam_grove 5:3f93dd1d4cb3 117 return pf;
sam_grove 5:3f93dd1d4cb3 118 }
sam_grove 5:3f93dd1d4cb3 119
sam_grove 5:3f93dd1d4cb3 120 /** Add a function to be called when a rising edge occurs at the end of the call chain
sam_grove 5:3f93dd1d4cb3 121 *
sam_grove 5:3f93dd1d4cb3 122 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 123 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 124 *
sam_grove 5:3f93dd1d4cb3 125 * @returns
sam_grove 5:3f93dd1d4cb3 126 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 127 */
sam_grove 5:3f93dd1d4cb3 128 template<typename T>
sam_grove 5:3f93dd1d4cb3 129 pFunctionPointer_t rise_add(T* tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 130 return rise_add_common(tptr, mptr);
sam_grove 5:3f93dd1d4cb3 131 }
sam_grove 5:3f93dd1d4cb3 132
sam_grove 5:3f93dd1d4cb3 133 /** Add a function to be called when a rising edge occurs at the beginning of the call chain
sam_grove 5:3f93dd1d4cb3 134 *
sam_grove 5:3f93dd1d4cb3 135 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 136 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 137 *
sam_grove 5:3f93dd1d4cb3 138 * @returns
sam_grove 5:3f93dd1d4cb3 139 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 140 */
sam_grove 5:3f93dd1d4cb3 141 template<typename T>
sam_grove 5:3f93dd1d4cb3 142 pFunctionPointer_t rise_add_front(T* tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 143 return rise_add_common(tptr, mptr, true);
sam_grove 5:3f93dd1d4cb3 144 }
sam_grove 5:3f93dd1d4cb3 145
sam_grove 5:3f93dd1d4cb3 146 /** Remove a function from the list of functions to be called when a rising edge occurs
sam_grove 5:3f93dd1d4cb3 147 *
sam_grove 5:3f93dd1d4cb3 148 * @param pf the function object to remove
sam_grove 5:3f93dd1d4cb3 149 *
sam_grove 5:3f93dd1d4cb3 150 * @returns
sam_grove 5:3f93dd1d4cb3 151 * true if the function was found and removed, false otherwise
sam_grove 5:3f93dd1d4cb3 152 */
sam_grove 5:3f93dd1d4cb3 153 bool rise_remove(pFunctionPointer_t pf);
sam_grove 5:3f93dd1d4cb3 154
sam_grove 5:3f93dd1d4cb3 155 /** Attach a function to call when a falling edge occurs on the input
sam_grove 5:3f93dd1d4cb3 156 *
sam_grove 5:3f93dd1d4cb3 157 * @param fptr A pointer to a void function, or 0 to set as none
sam_grove 5:3f93dd1d4cb3 158 *
sam_grove 5:3f93dd1d4cb3 159 * @returns
sam_grove 5:3f93dd1d4cb3 160 * The function object created for 'fptr'
sam_grove 5:3f93dd1d4cb3 161 */
sam_grove 5:3f93dd1d4cb3 162 pFunctionPointer_t fall(void (*fptr)(void));
sam_grove 5:3f93dd1d4cb3 163
sam_grove 5:3f93dd1d4cb3 164 /** Add a function to be called when a falling edge occurs at the end of the call chain
sam_grove 5:3f93dd1d4cb3 165 *
sam_grove 5:3f93dd1d4cb3 166 * @param fptr the function to add
sam_grove 5:3f93dd1d4cb3 167 *
sam_grove 5:3f93dd1d4cb3 168 * @returns
sam_grove 5:3f93dd1d4cb3 169 * The function object created for 'fptr'
sam_grove 5:3f93dd1d4cb3 170 */
sam_grove 5:3f93dd1d4cb3 171 pFunctionPointer_t fall_add(void (*fptr)(void)) {
sam_grove 5:3f93dd1d4cb3 172 return fall_add_common(fptr);
sam_grove 5:3f93dd1d4cb3 173 }
sam_grove 5:3f93dd1d4cb3 174
sam_grove 5:3f93dd1d4cb3 175 /** Add a function to be called when a falling edge occurs at the beginning of the call chain
sam_grove 5:3f93dd1d4cb3 176 *
sam_grove 5:3f93dd1d4cb3 177 * @param fptr the function to add
sam_grove 5:3f93dd1d4cb3 178 *
sam_grove 5:3f93dd1d4cb3 179 * @returns
sam_grove 5:3f93dd1d4cb3 180 * The function object created for 'fptr'
sam_grove 5:3f93dd1d4cb3 181 */
sam_grove 5:3f93dd1d4cb3 182 pFunctionPointer_t fall_add_front(void (*fptr)(void)) {
sam_grove 5:3f93dd1d4cb3 183 return fall_add_common(fptr, true);
sam_grove 5:3f93dd1d4cb3 184 }
sam_grove 5:3f93dd1d4cb3 185
sam_grove 5:3f93dd1d4cb3 186 /** Attach a member function to call when a falling edge occurs on the input
sam_grove 5:3f93dd1d4cb3 187 *
sam_grove 5:3f93dd1d4cb3 188 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 189 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 190 *
sam_grove 5:3f93dd1d4cb3 191 * @returns
sam_grove 5:3f93dd1d4cb3 192 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 193 */
sam_grove 5:3f93dd1d4cb3 194 template<typename T>
sam_grove 5:3f93dd1d4cb3 195 pFunctionPointer_t fall(T* tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 196 _fall.clear();
sam_grove 5:3f93dd1d4cb3 197 pFunctionPointer_t pf = _fall.add(tptr, mptr);
sam_grove 5:3f93dd1d4cb3 198 gpio_irq_set(&gpio_irq, IRQ_FALL, 1);
sam_grove 5:3f93dd1d4cb3 199 return pf;
sam_grove 5:3f93dd1d4cb3 200 }
sam_grove 5:3f93dd1d4cb3 201
sam_grove 5:3f93dd1d4cb3 202 /** Add a function to be called when a falling edge occurs at the end of the call chain
sam_grove 5:3f93dd1d4cb3 203 *
sam_grove 5:3f93dd1d4cb3 204 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 205 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 206 *
sam_grove 5:3f93dd1d4cb3 207 * @returns
sam_grove 5:3f93dd1d4cb3 208 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 209 */
sam_grove 5:3f93dd1d4cb3 210 template<typename T>
sam_grove 5:3f93dd1d4cb3 211 pFunctionPointer_t fall_add(T* tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 212 return fall_add_common(tptr, mptr);
sam_grove 5:3f93dd1d4cb3 213 }
sam_grove 5:3f93dd1d4cb3 214
sam_grove 5:3f93dd1d4cb3 215 /** Add a function to be called when a falling edge occurs at the beginning of the call chain
sam_grove 5:3f93dd1d4cb3 216 *
sam_grove 5:3f93dd1d4cb3 217 * @param tptr pointer to the object to call the member function on
sam_grove 5:3f93dd1d4cb3 218 * @param mptr pointer to the member function to be called
sam_grove 5:3f93dd1d4cb3 219 *
sam_grove 5:3f93dd1d4cb3 220 * @returns
sam_grove 5:3f93dd1d4cb3 221 * The function object created for 'tptr' and 'mptr'
sam_grove 5:3f93dd1d4cb3 222 */
sam_grove 5:3f93dd1d4cb3 223 template<typename T>
sam_grove 5:3f93dd1d4cb3 224 pFunctionPointer_t fall_add_front(T* tptr, void (T::*mptr)(void)) {
sam_grove 5:3f93dd1d4cb3 225 return fall_add_common(tptr, mptr, true);
sam_grove 5:3f93dd1d4cb3 226 }
sam_grove 5:3f93dd1d4cb3 227
sam_grove 5:3f93dd1d4cb3 228 /** Remove a function from the list of functions to be called when a falling edge occurs
sam_grove 5:3f93dd1d4cb3 229 *
sam_grove 5:3f93dd1d4cb3 230 * @param pf the function object to remove
sam_grove 5:3f93dd1d4cb3 231 *
sam_grove 5:3f93dd1d4cb3 232 * @returns
sam_grove 5:3f93dd1d4cb3 233 * true if the function was found and removed, false otherwise
sam_grove 5:3f93dd1d4cb3 234 */
sam_grove 5:3f93dd1d4cb3 235 bool fall_remove(pFunctionPointer_t pf);
sam_grove 5:3f93dd1d4cb3 236
sam_grove 5:3f93dd1d4cb3 237 /** Set the input pin mode
sam_grove 5:3f93dd1d4cb3 238 *
sam_grove 5:3f93dd1d4cb3 239 * @param mode PullUp, PullDown, PullNone
sam_grove 5:3f93dd1d4cb3 240 */
sam_grove 5:3f93dd1d4cb3 241 void mode(PinMode pull);
sam_grove 5:3f93dd1d4cb3 242
sam_grove 5:3f93dd1d4cb3 243 static void _irq_handler(uint32_t id, gpio_irq_event event);
sam_grove 5:3f93dd1d4cb3 244
sam_grove 5:3f93dd1d4cb3 245 protected:
sam_grove 5:3f93dd1d4cb3 246 pFunctionPointer_t rise_add_common(void (*fptr)(void), bool front=false);
sam_grove 5:3f93dd1d4cb3 247 pFunctionPointer_t fall_add_common(void (*fptr)(void), bool front=false);
sam_grove 5:3f93dd1d4cb3 248
sam_grove 5:3f93dd1d4cb3 249 template<typename T>
sam_grove 5:3f93dd1d4cb3 250 pFunctionPointer_t rise_add_common(T* tptr, void (T::*mptr)(void), bool front=false) {
sam_grove 5:3f93dd1d4cb3 251 pFunctionPointer_t pf = front ? _rise.add_front(tptr, mptr) : _rise.add(tptr, mptr);
sam_grove 5:3f93dd1d4cb3 252 gpio_irq_set(&gpio_irq, IRQ_RISE, 1);
sam_grove 5:3f93dd1d4cb3 253 return pf;
sam_grove 5:3f93dd1d4cb3 254 }
sam_grove 5:3f93dd1d4cb3 255 template<typename T>
sam_grove 5:3f93dd1d4cb3 256 pFunctionPointer_t fall_add_common(T* tptr, void (T::*mptr)(void), bool front=false) {
sam_grove 5:3f93dd1d4cb3 257 pFunctionPointer_t pf = front ? _fall.add_front(tptr, mptr) : _fall.add(tptr, mptr);
sam_grove 5:3f93dd1d4cb3 258 gpio_irq_set(&gpio_irq, IRQ_FALL, 1);
sam_grove 5:3f93dd1d4cb3 259 return pf;
sam_grove 5:3f93dd1d4cb3 260 }
sam_grove 5:3f93dd1d4cb3 261
sam_grove 5:3f93dd1d4cb3 262 gpio_t gpio;
sam_grove 5:3f93dd1d4cb3 263 gpio_irq_t gpio_irq;
sam_grove 5:3f93dd1d4cb3 264
sam_grove 5:3f93dd1d4cb3 265 CallChain _rise;
sam_grove 5:3f93dd1d4cb3 266 CallChain _fall;
sam_grove 5:3f93dd1d4cb3 267 };
sam_grove 5:3f93dd1d4cb3 268
sam_grove 5:3f93dd1d4cb3 269 } // namespace mbed
sam_grove 5:3f93dd1d4cb3 270
sam_grove 5:3f93dd1d4cb3 271 #endif
sam_grove 5:3f93dd1d4cb3 272
sam_grove 5:3f93dd1d4cb3 273 #endif