Skip to content

Commit ae77a10

Browse files
committed
Merge branch 'master' into feature/pypi
2 parents d231880 + fe7021d commit ae77a10

File tree

81 files changed

+518
-3790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+518
-3790
lines changed

libraries/mbed/api/InterruptIn.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class InterruptIn {
167167
*
168168
* @returns
169169
* The function object created for 'fptr'
170-
*/
170+
*/
171171
pFunctionPointer_t fall_add(void (*fptr)(void)) {
172172
return fall_add_common(fptr);
173173
}
@@ -240,6 +240,14 @@ class InterruptIn {
240240
*/
241241
void mode(PinMode pull);
242242

243+
/** Enable IRQ
244+
*/
245+
void enable_irq();
246+
247+
/** Disable IRQ
248+
*/
249+
void disable_irq();
250+
243251
static void _irq_handler(uint32_t id, gpio_irq_event event);
244252

245253
protected:

libraries/mbed/common/InterruptIn.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ void InterruptIn::_irq_handler(uint32_t id, gpio_irq_event event) {
9999
}
100100
}
101101

102+
void InterruptIn::enable_irq() {
103+
gpio_irq_enable(&gpio_irq);
104+
}
105+
106+
void InterruptIn::disable_irq() {
107+
gpio_irq_disable(&gpio_irq);
108+
}
109+
102110
#ifdef MBED_OPERATORS
103111
InterruptIn::operator int() {
104112
return read();

libraries/mbed/hal/gpio_irq_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
3737
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
3838
void gpio_irq_free(gpio_irq_t *obj);
3939
void gpio_irq_set (gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
40+
void gpio_irq_enable(gpio_irq_t *obj);
41+
void gpio_irq_disable(gpio_irq_t *obj);
4042

4143
#ifdef __cplusplus
4244
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
154154
// Interrupt configuration and clear interrupt
155155
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
156156
}
157+
158+
void gpio_irq_enable(gpio_irq_t *obj) {
159+
if (obj->port == PortA) {
160+
NVIC_EnableIRQ(PORTA_IRQn);
161+
} else if (obj->port == PortB) {
162+
NVIC_EnableIRQ(PORTB_IRQn);
163+
}
164+
}
165+
166+
void gpio_irq_disable(gpio_irq_t *obj) {
167+
if (obj->port == PortA) {
168+
NVIC_DisableIRQ(PORTA_IRQn);
169+
} else if (obj->port == PortB) {
170+
NVIC_DisableIRQ(PORTB_IRQn);
171+
}
172+
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
143143
// Interrupt configuration and clear interrupt
144144
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
145145
}
146+
147+
void gpio_irq_enable(gpio_irq_t *obj) {
148+
if (obj->port == PortA) {
149+
NVIC_EnableIRQ(PORTA_IRQn);
150+
} else if (obj->port == PortD) {
151+
NVIC_EnableIRQ(PORTD_IRQn);
152+
}
153+
}
154+
155+
void gpio_irq_disable(gpio_irq_t *obj) {
156+
if (obj->port == PortA) {
157+
NVIC_DisableIRQ(PORTA_IRQn);
158+
} else if (obj->port == PortD) {
159+
NVIC_DisableIRQ(PORTD_IRQn);
160+
}
161+
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
143143
// Interrupt configuration and clear interrupt
144144
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
145145
}
146+
147+
void gpio_irq_enable(gpio_irq_t *obj) {
148+
if (obj->port == PortA) {
149+
NVIC_EnableIRQ(PORTA_IRQn);
150+
} else if (obj->port == PortD) {
151+
NVIC_EnableIRQ(PORTD_IRQn);
152+
}
153+
}
154+
155+
void gpio_irq_disable(gpio_irq_t *obj) {
156+
if (obj->port == PortA) {
157+
NVIC_DisableIRQ(PORTA_IRQn);
158+
} else if (obj->port == PortD) {
159+
NVIC_DisableIRQ(PORTD_IRQn);
160+
}
161+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,11 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
131131
}
132132
}
133133
}
134+
135+
void gpio_irq_enable(gpio_irq_t *obj) {
136+
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
137+
}
138+
139+
void gpio_irq_disable(gpio_irq_t *obj) {
140+
NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
141+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_irq_api.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,43 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
174174
}
175175

176176
}
177+
178+
void gpio_irq_enable(gpio_irq_t *obj) {
179+
uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
180+
switch (port_num) {
181+
case 0:
182+
NVIC_EnableIRQ(EINT0_IRQn);
183+
break;
184+
case 1:
185+
NVIC_EnableIRQ(EINT1_IRQn);
186+
break;
187+
case 2:
188+
NVIC_EnableIRQ(EINT2_IRQn);
189+
break;
190+
case 3:
191+
NVIC_EnableIRQ(EINT3_IRQn);
192+
break;
193+
default:
194+
break;
195+
}
196+
}
197+
198+
void gpio_irq_disable(gpio_irq_t *obj) {
199+
uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
200+
switch (port_num) {
201+
case 0:
202+
NVIC_DisableIRQ(EINT0_IRQn);
203+
break;
204+
case 1:
205+
NVIC_DisableIRQ(EINT1_IRQn);
206+
break;
207+
case 2:
208+
NVIC_DisableIRQ(EINT2_IRQn);
209+
break;
210+
case 3:
211+
NVIC_DisableIRQ(EINT3_IRQn);
212+
break;
213+
default:
214+
break;
215+
}
216+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_irq_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
131131
}
132132
}
133133
}
134+
135+
void gpio_irq_enable(gpio_irq_t *obj) {
136+
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
137+
}
138+
139+
void gpio_irq_disable(gpio_irq_t *obj) {
140+
NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
141+
}
142+

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_irq_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
150150
}
151151
}
152152
}
153+
154+
void gpio_irq_enable(gpio_irq_t *obj) {
155+
NVIC_EnableIRQ(EINT3_IRQn);
156+
}
157+
158+
void gpio_irq_disable(gpio_irq_t *obj) {
159+
NVIC_DisableIRQ(EINT3_IRQn);
160+
}
161+

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_irq_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
143143
}
144144
}
145145
}
146+
147+
void gpio_irq_enable(gpio_irq_t *obj) {
148+
NVIC_EnableIRQ(EINT3_IRQn);
149+
}
150+
151+
void gpio_irq_disable(gpio_irq_t *obj) {
152+
NVIC_DisableIRQ(EINT3_IRQn);
153+
}
154+

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_irq_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,11 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
164164
}
165165
}
166166
}
167+
168+
void gpio_irq_enable(gpio_irq_t *obj) {
169+
NVIC_EnableIRQ(GPIO_IRQn);
170+
}
171+
172+
void gpio_irq_disable(gpio_irq_t *obj) {
173+
NVIC_DisableIRQ(GPIO_IRQn);
174+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
134134
}
135135
}
136136
}
137+
138+
void gpio_irq_enable(gpio_irq_t *obj) {
139+
#if !defined(CORE_M0)
140+
NVIC_EnableIRQ((IRQn_Type)(PIN_INT0_IRQn + obj->ch));
141+
#else
142+
NVIC_EnableIRQ((IRQn_Type)(PIN_INT4_IRQn + obj->ch));
143+
#endif
144+
}
145+
146+
void gpio_irq_disable(gpio_irq_t *obj) {
147+
#if !defined(CORE_M0)
148+
NVIC_DisableIRQ((IRQn_Type)(PIN_INT0_IRQn + obj->ch));
149+
#else
150+
NVIC_DisableIRQ((IRQn_Type)(PIN_INT4_IRQn + obj->ch));
151+
#endif
152+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_irq_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,11 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
125125
}
126126
}
127127
}
128+
129+
void gpio_irq_enable(gpio_irq_t *obj) {
130+
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
131+
}
132+
133+
void gpio_irq_disable(gpio_irq_t *obj) {
134+
NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
135+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/* CellularModem.h */
2+
/* Copyright (C) 2013 mbed.org, MIT License
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
6+
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
7+
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8+
* furnished to do so, subject to the following conditions:
9+
*
10+
* The above copyright notice and this permission notice shall be included in all copies or
11+
* substantial portions of the Software.
12+
*
13+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
14+
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16+
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18+
*/
19+
20+
#ifndef CELLULARMODEM_H_
21+
#define CELLULARMODEM_H_
22+
23+
#include "core/fwk.h"
24+
#include "at/ATCommandsInterface.h"
25+
26+
class CellularModem
27+
{
28+
public:
29+
//Internet-related functions
30+
31+
/** Open a 3G internet connection
32+
@return 0 on success, error code on failure
33+
*/
34+
virtual int connect(const char* apn = NULL, const char* user = NULL, const char* password = NULL) = 0;
35+
36+
/** Close the internet connection
37+
@return 0 on success, error code on failure
38+
*/
39+
virtual int disconnect() = 0;
40+
41+
42+
/** Send a SM
43+
@param number The receiver's phone number
44+
@param message The message to send
45+
@return 0 on success, error code on failure
46+
*/
47+
virtual int sendSM(const char* number, const char* message) = 0;
48+
49+
50+
/** Receive a SM
51+
@param number Pointer to a buffer to store the sender's phone number (must be at least 17 characters-long, including the sapce for the null-terminating char)
52+
@param message Pointer to a buffer to store the the incoming message
53+
@param maxLength Maximum message length that can be stored in buffer (including null-terminating character)
54+
@return 0 on success, error code on failure
55+
*/
56+
virtual int getSM(char* number, char* message, size_t maxLength) = 0;
57+
58+
/** Get the number of SMs in the incoming box
59+
@param pCount pointer to store the number of unprocessed SMs on
60+
@return 0 on success, error code on failure
61+
*/
62+
virtual int getSMCount(size_t* pCount) = 0;
63+
64+
/** Get the ATCommandsInterface instance
65+
@return Pointer to the ATCommandsInterface instance
66+
*/
67+
virtual ATCommandsInterface* getATCommandsInterface() = 0;
68+
69+
/** Switch power on or off
70+
In order to use this function, a pin name must have been entered in the constructor
71+
@param enable true to switch the dongle on, false to switch it off
72+
@return 0 on success, error code on failure
73+
*/
74+
virtual int power(bool enable) = 0;
75+
};
76+
77+
78+
#endif /* CELLULARMODEM_H_ */

libraries/net/cellular/UbloxUSBModem/UbloxCDMAModemInitializer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#include "UbloxCDMAModemInitializer.h"
2929

30+
UbloxCDMAModemInitializer::UbloxCDMAModemInitializer(USBHost* pHost) : WANDongleInitializer(pHost)
31+
{
32+
}
33+
3034
uint16_t UbloxCDMAModemInitializer::getMSDVid()
3135
{
3236
return 0x05C6;

0 commit comments

Comments
 (0)