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_PWMOUT_H
sam_grove 5:3f93dd1d4cb3 17 #define MBED_PWMOUT_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_PWMOUT
sam_grove 5:3f93dd1d4cb3 22 #include "pwmout_api.h"
sam_grove 5:3f93dd1d4cb3 23
sam_grove 5:3f93dd1d4cb3 24 namespace mbed {
sam_grove 5:3f93dd1d4cb3 25
sam_grove 5:3f93dd1d4cb3 26 /** A pulse-width modulation digital output
sam_grove 5:3f93dd1d4cb3 27 *
sam_grove 5:3f93dd1d4cb3 28 * Example
sam_grove 5:3f93dd1d4cb3 29 * @code
sam_grove 5:3f93dd1d4cb3 30 * // Fade a led on.
sam_grove 5:3f93dd1d4cb3 31 * #include "mbed.h"
sam_grove 5:3f93dd1d4cb3 32 *
sam_grove 5:3f93dd1d4cb3 33 * PwmOut led(LED1);
sam_grove 5:3f93dd1d4cb3 34 *
sam_grove 5:3f93dd1d4cb3 35 * int main() {
sam_grove 5:3f93dd1d4cb3 36 * while(1) {
sam_grove 5:3f93dd1d4cb3 37 * led = led + 0.01;
sam_grove 5:3f93dd1d4cb3 38 * wait(0.2);
sam_grove 5:3f93dd1d4cb3 39 * if(led == 1.0) {
sam_grove 5:3f93dd1d4cb3 40 * led = 0;
sam_grove 5:3f93dd1d4cb3 41 * }
sam_grove 5:3f93dd1d4cb3 42 * }
sam_grove 5:3f93dd1d4cb3 43 * }
sam_grove 5:3f93dd1d4cb3 44 * @endcode
sam_grove 5:3f93dd1d4cb3 45 *
sam_grove 5:3f93dd1d4cb3 46 * @note
sam_grove 5:3f93dd1d4cb3 47 * On the LPC1768 and LPC2368, the PWMs all share the same
sam_grove 5:3f93dd1d4cb3 48 * period - if you change the period for one, you change it for all.
sam_grove 5:3f93dd1d4cb3 49 * Although routines that change the period maintain the duty cycle
sam_grove 5:3f93dd1d4cb3 50 * for its PWM, all other PWMs will require their duty cycle to be
sam_grove 5:3f93dd1d4cb3 51 * refreshed.
sam_grove 5:3f93dd1d4cb3 52 */
sam_grove 5:3f93dd1d4cb3 53 class PwmOut {
sam_grove 5:3f93dd1d4cb3 54
sam_grove 5:3f93dd1d4cb3 55 public:
sam_grove 5:3f93dd1d4cb3 56
sam_grove 5:3f93dd1d4cb3 57 /** Create a PwmOut connected to the specified pin
sam_grove 5:3f93dd1d4cb3 58 *
sam_grove 5:3f93dd1d4cb3 59 * @param pin PwmOut pin to connect to
sam_grove 5:3f93dd1d4cb3 60 */
sam_grove 5:3f93dd1d4cb3 61 PwmOut(PinName pin) {
sam_grove 5:3f93dd1d4cb3 62 pwmout_init(&_pwm, pin);
sam_grove 5:3f93dd1d4cb3 63 }
sam_grove 5:3f93dd1d4cb3 64
sam_grove 5:3f93dd1d4cb3 65 /** Set the ouput duty-cycle, specified as a percentage (float)
sam_grove 5:3f93dd1d4cb3 66 *
sam_grove 5:3f93dd1d4cb3 67 * @param value A floating-point value representing the output duty-cycle,
sam_grove 5:3f93dd1d4cb3 68 * specified as a percentage. The value should lie between
sam_grove 5:3f93dd1d4cb3 69 * 0.0f (representing on 0%) and 1.0f (representing on 100%).
sam_grove 5:3f93dd1d4cb3 70 * Values outside this range will be saturated to 0.0f or 1.0f.
sam_grove 5:3f93dd1d4cb3 71 */
sam_grove 5:3f93dd1d4cb3 72 void write(float value) {
sam_grove 5:3f93dd1d4cb3 73 pwmout_write(&_pwm, value);
sam_grove 5:3f93dd1d4cb3 74 }
sam_grove 5:3f93dd1d4cb3 75
sam_grove 5:3f93dd1d4cb3 76 /** Return the current output duty-cycle setting, measured as a percentage (float)
sam_grove 5:3f93dd1d4cb3 77 *
sam_grove 5:3f93dd1d4cb3 78 * @returns
sam_grove 5:3f93dd1d4cb3 79 * A floating-point value representing the current duty-cycle being output on the pin,
sam_grove 5:3f93dd1d4cb3 80 * measured as a percentage. The returned value will lie between
sam_grove 5:3f93dd1d4cb3 81 * 0.0f (representing on 0%) and 1.0f (representing on 100%).
sam_grove 5:3f93dd1d4cb3 82 *
sam_grove 5:3f93dd1d4cb3 83 * @note
sam_grove 5:3f93dd1d4cb3 84 * This value may not match exactly the value set by a previous <write>.
sam_grove 5:3f93dd1d4cb3 85 */
sam_grove 5:3f93dd1d4cb3 86 float read() {
sam_grove 5:3f93dd1d4cb3 87 return pwmout_read(&_pwm);
sam_grove 5:3f93dd1d4cb3 88 }
sam_grove 5:3f93dd1d4cb3 89
sam_grove 5:3f93dd1d4cb3 90 /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
sam_grove 5:3f93dd1d4cb3 91 *
sam_grove 5:3f93dd1d4cb3 92 * @note
sam_grove 5:3f93dd1d4cb3 93 * The resolution is currently in microseconds; periods smaller than this
sam_grove 5:3f93dd1d4cb3 94 * will be set to zero.
sam_grove 5:3f93dd1d4cb3 95 */
sam_grove 5:3f93dd1d4cb3 96 void period(float seconds) {
sam_grove 5:3f93dd1d4cb3 97 pwmout_period(&_pwm, seconds);
sam_grove 5:3f93dd1d4cb3 98 }
sam_grove 5:3f93dd1d4cb3 99
sam_grove 5:3f93dd1d4cb3 100 /** Set the PWM period, specified in milli-seconds (int), keeping the duty cycle the same.
sam_grove 5:3f93dd1d4cb3 101 */
sam_grove 5:3f93dd1d4cb3 102 void period_ms(int ms) {
sam_grove 5:3f93dd1d4cb3 103 pwmout_period_ms(&_pwm, ms);
sam_grove 5:3f93dd1d4cb3 104 }
sam_grove 5:3f93dd1d4cb3 105
sam_grove 5:3f93dd1d4cb3 106 /** Set the PWM period, specified in micro-seconds (int), keeping the duty cycle the same.
sam_grove 5:3f93dd1d4cb3 107 */
sam_grove 5:3f93dd1d4cb3 108 void period_us(int us) {
sam_grove 5:3f93dd1d4cb3 109 pwmout_period_us(&_pwm, us);
sam_grove 5:3f93dd1d4cb3 110 }
sam_grove 5:3f93dd1d4cb3 111
sam_grove 5:3f93dd1d4cb3 112 /** Set the PWM pulsewidth, specified in seconds (float), keeping the period the same.
sam_grove 5:3f93dd1d4cb3 113 */
sam_grove 5:3f93dd1d4cb3 114 void pulsewidth(float seconds) {
sam_grove 5:3f93dd1d4cb3 115 pwmout_pulsewidth(&_pwm, seconds);
sam_grove 5:3f93dd1d4cb3 116 }
sam_grove 5:3f93dd1d4cb3 117
sam_grove 5:3f93dd1d4cb3 118 /** Set the PWM pulsewidth, specified in milli-seconds (int), keeping the period the same.
sam_grove 5:3f93dd1d4cb3 119 */
sam_grove 5:3f93dd1d4cb3 120 void pulsewidth_ms(int ms) {
sam_grove 5:3f93dd1d4cb3 121 pwmout_pulsewidth_ms(&_pwm, ms);
sam_grove 5:3f93dd1d4cb3 122 }
sam_grove 5:3f93dd1d4cb3 123
sam_grove 5:3f93dd1d4cb3 124 /** Set the PWM pulsewidth, specified in micro-seconds (int), keeping the period the same.
sam_grove 5:3f93dd1d4cb3 125 */
sam_grove 5:3f93dd1d4cb3 126 void pulsewidth_us(int us) {
sam_grove 5:3f93dd1d4cb3 127 pwmout_pulsewidth_us(&_pwm, us);
sam_grove 5:3f93dd1d4cb3 128 }
sam_grove 5:3f93dd1d4cb3 129
sam_grove 5:3f93dd1d4cb3 130 #ifdef MBED_OPERATORS
sam_grove 5:3f93dd1d4cb3 131 /** A operator shorthand for write()
sam_grove 5:3f93dd1d4cb3 132 */
sam_grove 5:3f93dd1d4cb3 133 PwmOut& operator= (float value) {
sam_grove 5:3f93dd1d4cb3 134 write(value);
sam_grove 5:3f93dd1d4cb3 135 return *this;
sam_grove 5:3f93dd1d4cb3 136 }
sam_grove 5:3f93dd1d4cb3 137
sam_grove 5:3f93dd1d4cb3 138 PwmOut& operator= (PwmOut& rhs) {
sam_grove 5:3f93dd1d4cb3 139 write(rhs.read());
sam_grove 5:3f93dd1d4cb3 140 return *this;
sam_grove 5:3f93dd1d4cb3 141 }
sam_grove 5:3f93dd1d4cb3 142
sam_grove 5:3f93dd1d4cb3 143 /** An operator shorthand for read()
sam_grove 5:3f93dd1d4cb3 144 */
sam_grove 5:3f93dd1d4cb3 145 operator float() {
sam_grove 5:3f93dd1d4cb3 146 return read();
sam_grove 5:3f93dd1d4cb3 147 }
sam_grove 5:3f93dd1d4cb3 148 #endif
sam_grove 5:3f93dd1d4cb3 149
sam_grove 5:3f93dd1d4cb3 150 protected:
sam_grove 5:3f93dd1d4cb3 151 pwmout_t _pwm;
sam_grove 5:3f93dd1d4cb3 152 };
sam_grove 5:3f93dd1d4cb3 153
sam_grove 5:3f93dd1d4cb3 154 } // namespace mbed
sam_grove 5:3f93dd1d4cb3 155
sam_grove 5:3f93dd1d4cb3 156 #endif
sam_grove 5:3f93dd1d4cb3 157
sam_grove 5:3f93dd1d4cb3 158 #endif