Skip to content

Commit e0e915f

Browse files
author
Cruz Monrreal
authored
Merge pull request #8423 from cmonr/rollup2
Rollup PR: Additional doc PRs + lingering need:CI PRs
2 parents 8bf51be + 73eb463 commit e0e915f

File tree

22 files changed

+279
-131
lines changed

22 files changed

+279
-131
lines changed

drivers/AnalogIn.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class AnalogIn {
114114
}
115115

116116
protected:
117-
117+
#if !defined(DOXYGEN_ONLY)
118118
virtual void lock()
119119
{
120120
_mutex->lock();
@@ -127,6 +127,7 @@ class AnalogIn {
127127

128128
analogin_t _adc;
129129
static SingletonPtr<PlatformMutex> _mutex;
130+
#endif //!defined(DOXYGEN_ONLY)
130131
};
131132

132133
} // namespace mbed

drivers/AnalogOut.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class AnalogOut {
141141
}
142142

143143
protected:
144-
144+
#if !defined(DOXYGEN_ONLY)
145145
virtual void lock()
146146
{
147147
_mutex.lock();
@@ -154,6 +154,7 @@ class AnalogOut {
154154

155155
dac_t _dac;
156156
PlatformMutex _mutex;
157+
#endif //!defined(DOXYGEN_ONLY)
157158
};
158159

159160
} // namespace mbed

drivers/DigitalIn.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ class DigitalIn {
108108

109109
/** An operator shorthand for read()
110110
* \sa DigitalIn::read()
111+
* @code
112+
* DigitalIn button(BUTTON1);
113+
* DigitalOut led(LED1);
114+
* led = button; // Equivalent to led.write(button.read())
115+
* @endcode
111116
*/
112117
operator int()
113118
{
@@ -116,7 +121,9 @@ class DigitalIn {
116121
}
117122

118123
protected:
124+
#if !defined(DOXYGEN_ONLY)
119125
gpio_t gpio;
126+
#endif //!defined(DOXYGEN_ONLY)
120127
};
121128

122129
} // namespace mbed

drivers/DigitalInOut.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ class DigitalInOut {
121121

122122
/** A shorthand for write()
123123
* \sa DigitalInOut::write()
124+
* @code
125+
* DigitalInOut inout(PIN);
126+
* DigitalIn button(BUTTON1);
127+
* inout.output();
128+
*
129+
* inout = button; // Equivalent to inout.write(button.read())
130+
* @endcode
124131
*/
125132
DigitalInOut &operator= (int value)
126133
{
@@ -129,7 +136,8 @@ class DigitalInOut {
129136
return *this;
130137
}
131138

132-
/** A shorthand for write()
139+
/**A shorthand for write() using the assignment operator which copies the
140+
* state from the DigitalInOut argument.
133141
* \sa DigitalInOut::write()
134142
*/
135143
DigitalInOut &operator= (DigitalInOut &rhs)
@@ -142,6 +150,13 @@ class DigitalInOut {
142150

143151
/** A shorthand for read()
144152
* \sa DigitalInOut::read()
153+
* @code
154+
* DigitalInOut inout(PIN);
155+
* DigitalOut led(LED1);
156+
*
157+
* inout.input();
158+
* led = inout; // Equivalent to led.write(inout.read())
159+
* @endcode
145160
*/
146161
operator int()
147162
{
@@ -150,7 +165,9 @@ class DigitalInOut {
150165
}
151166

152167
protected:
168+
#if !defined(DOXYGEN_ONLY)
153169
gpio_t gpio;
170+
#endif //!defined(DOXYGEN_ONLY)
154171
};
155172

156173
} // namespace mbed

drivers/DigitalOut.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ class DigitalOut {
104104

105105
/** A shorthand for write()
106106
* \sa DigitalOut::write()
107+
* @code
108+
* DigitalIn button(BUTTON1);
109+
* DigitalOut led(LED1);
110+
* led = button; // Equivalent to led.write(button.read())
111+
* @endcode
107112
*/
108113
DigitalOut &operator= (int value)
109114
{
@@ -112,7 +117,8 @@ class DigitalOut {
112117
return *this;
113118
}
114119

115-
/** A shorthand for write()
120+
/** A shorthand for write() using the assignment operator which copies the
121+
* state from the DigitalOut argument.
116122
* \sa DigitalOut::write()
117123
*/
118124
DigitalOut &operator= (DigitalOut &rhs)
@@ -125,6 +131,11 @@ class DigitalOut {
125131

126132
/** A shorthand for read()
127133
* \sa DigitalOut::read()
134+
* @code
135+
* DigitalIn button(BUTTON1);
136+
* DigitalOut led(LED1);
137+
* led = button; // Equivalent to led.write(button.read())
138+
* @endcode
128139
*/
129140
operator int()
130141
{
@@ -133,7 +144,9 @@ class DigitalOut {
133144
}
134145

135146
protected:
147+
#if !defined(DOXYGEN_ONLY)
136148
gpio_t gpio;
149+
#endif //!defined(DOXYGEN_ONLY)
137150
};
138151

139152
} // namespace mbed

drivers/I2C.h

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,32 @@ namespace mbed {
4141
*
4242
* Example:
4343
* @code
44-
* // Read from I2C slave at address 0x62
45-
*
44+
* Read temperature from LM75BD
4645
* #include "mbed.h"
47-
*
48-
* I2C i2c(p28, p27);
46+
* I2C i2c(I2C_SDA , I2C_SCL);
47+
* const int addr7bit = 0x48; // 7-bit I2C address
48+
* const int addr8bit = 0x48 << 1; // 8-bit I2C address, 0x90
4949
*
5050
* int main() {
51-
* int address = 0x62;
52-
* char data[2];
53-
* i2c.read(address, data, 2);
51+
* char cmd[2];
52+
* while (1) {
53+
* cmd[0] = 0x01;
54+
* cmd[1] = 0x00;
55+
*
56+
* // read and write takes the 8-bit version of the address.
57+
* // set up configuration register (at 0x01)
58+
* i2c.write(addr8bit, cmd, 2);
59+
*
60+
* wait(0.5);
61+
*
62+
* // read temperature register
63+
* cmd[0] = 0x00;
64+
* i2c.write(addr8bit, cmd, 1);
65+
* i2c.read( addr8bit, cmd, 2);
66+
*
67+
* float tmp = (float((cmd[0]<<8)|cmd[1]) / 256.0);
68+
* printf("Temp = %.2f\n", tmp);
69+
* }
5470
* }
5571
* @endcode
5672
* @ingroup drivers
@@ -92,10 +108,11 @@ class I2C : private NonCopyable<I2C> {
92108
* @param data Pointer to the byte-array to read data in to
93109
* @param length Number of bytes to read
94110
* @param repeated Repeated start, true - don't send stop at end
111+
* default value is false.
95112
*
96113
* @returns
97114
* 0 on success (ack),
98-
* non-0 on failure (nack)
115+
* nonzero on failure (nack)
99116
*/
100117
int read(int address, char *data, int length, bool repeated = false);
101118

@@ -117,10 +134,11 @@ class I2C : private NonCopyable<I2C> {
117134
* @param data Pointer to the byte-array data to send
118135
* @param length Number of bytes to send
119136
* @param repeated Repeated start, true - do not send stop at end
137+
* default value is false.
120138
*
121139
* @returns
122140
* 0 on success (ack),
123-
* non-0 on failure (nack)
141+
* nonzero on failure (nack)
124142
*/
125143
int write(int address, const char *data, int length, bool repeated = false);
126144

@@ -137,7 +155,6 @@ class I2C : private NonCopyable<I2C> {
137155

138156
/** Creates a start condition on the I2C bus
139157
*/
140-
141158
void start(void);
142159

143160
/** Creates a stop condition on the I2C bus
@@ -159,23 +176,25 @@ class I2C : private NonCopyable<I2C> {
159176

160177
#if DEVICE_I2C_ASYNCH
161178

162-
/** Start non-blocking I2C transfer.
179+
/** Start nonblocking I2C transfer.
163180
*
164181
* This function locks the deep sleep until any event has occurred
165182
*
166183
* @param address 8/10 bit I2C slave address
167184
* @param tx_buffer The TX buffer with data to be transfered
168185
* @param tx_length The length of TX buffer in bytes
169-
* @param rx_buffer The RX buffer which is used for received data
186+
* @param rx_buffer The RX buffer, which is used for received data
170187
* @param rx_length The length of RX buffer in bytes
171188
* @param event The logical OR of events to modify
172189
* @param callback The event callback function
173190
* @param repeated Repeated start, true - do not send stop at end
174-
* @return Zero if the transfer has started, or -1 if I2C peripheral is busy
191+
* default value is false.
192+
*
193+
* @returns Zero if the transfer has started, or -1 if I2C peripheral is busy
175194
*/
176195
int transfer(int address, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length, const event_callback_t &callback, int event = I2C_EVENT_TRANSFER_COMPLETE, bool repeated = false);
177196

178-
/** Abort the on-going I2C transfer
197+
/** Abort the ongoing I2C transfer
179198
*/
180199
void abort_transfer();
181200

@@ -193,6 +212,7 @@ class I2C : private NonCopyable<I2C> {
193212
bool _deep_sleep_locked;
194213
#endif
195214

215+
#if !defined(DOXYGEN_ONLY)
196216
protected:
197217
void aquire();
198218

@@ -202,6 +222,7 @@ class I2C : private NonCopyable<I2C> {
202222
static SingletonPtr<PlatformMutex> _mutex;
203223
PinName _sda;
204224
PinName _scl;
225+
#endif
205226

206227
private:
207228
/** Recover I2C bus, when stuck with SDA low
@@ -210,7 +231,7 @@ class I2C : private NonCopyable<I2C> {
210231
* @param sda I2C data line pin
211232
* @param scl I2C clock line pin
212233
*
213-
* @returns:
234+
* @returns
214235
* '0' - Successfully recovered
215236
* 'I2C_ERROR_BUS_BUSY' - In case of failure
216237
*

events/EventQueue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,6 +2803,7 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
28032803
#endif
28042804

28052805
protected:
2806+
#if !defined(DOXYGEN_ONLY)
28062807
template <typename F>
28072808
friend class Event;
28082809
struct equeue _equeue;
@@ -3379,6 +3380,7 @@ class EventQueue : private mbed::NonCopyable<EventQueue> {
33793380
f(c0, c1, c2, c3, c4, a0, a1, a2, a3, a4);
33803381
}
33813382
};
3383+
#endif //!defined(DOXYGEN_ONLY)
33823384
};
33833385

33843386
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Permissive Binary License
2+
3+
Version 1.0, September 2015
4+
5+
Redistribution. Redistribution and use in binary form, without
6+
modification, are permitted provided that the following conditions are
7+
met:
8+
9+
1) Redistributions must reproduce the above copyright notice and the
10+
following disclaimer in the documentation and/or other materials
11+
provided with the distribution.
12+
13+
2) Unless to the extent explicitly permitted by law, no reverse
14+
engineering, decompilation, or disassembly of this software is
15+
permitted.
16+
17+
3) Redistribution as part of a software development kit must include the
18+
accompanying file named "DEPENDENCIES" and any dependencies listed in
19+
that file.
20+
21+
4) Neither the name of the copyright holder nor the names of its
22+
contributors may be used to endorse or promote products derived from
23+
this software without specific prior written permission.
24+
25+
Limited patent license. The copyright holders (and contributors) grant a
26+
worldwide, non-exclusive, no-charge, royalty-free patent license to
27+
make, have made, use, offer to sell, sell, import, and otherwise
28+
transfer this software, where such license applies only to those patent
29+
claims licensable by the copyright holders (and contributors) that are
30+
necessarily infringed by this software. This patent license shall not
31+
apply to any combinations that include this software. No hardware is
32+
licensed hereunder.
33+
34+
If you institute patent litigation against any entity (including a
35+
cross-claim or counterclaim in a lawsuit) alleging that the software
36+
itself infringes your patent(s), then your rights granted under this
37+
license shall terminate as of the date such litigation is filed.
38+
39+
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
40+
CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
41+
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
42+
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43+
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
45+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
46+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
47+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
49+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "bootloader_DISCO_L475VG_IOT01A",
3+
"target_overrides": {
4+
"*": {
5+
"target.app_offset": "0x9800",
6+
"target.header_offset": "0x9000",
7+
"target.bootloader_img": "mbed-bootloader-internal_dfb7cc.bin"
8+
}
9+
}
10+
}

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularStack.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ bool UBLOX_AT_CellularStack::is_protocol_supported(nsapi_protocol_t protocol)
119119
nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
120120
{
121121
int sock_id = 0;
122-
bool socketOpenWorking = false;
123122

124123
_at.lock();
125124
if (socket->proto == NSAPI_UDP) {
@@ -137,12 +136,12 @@ nsapi_error_t UBLOX_AT_CellularStack::create_socket_impl(CellularSocket *socket)
137136
sock_id = _at.read_int();
138137
_at.resp_stop();
139138
} // Unsupported protocol is checked in "is_protocol_supported" function
140-
_at.unlock();
141139

142-
socketOpenWorking = (_at.get_last_error() == NSAPI_ERROR_OK);
143-
if (!socketOpenWorking) {
140+
if ((_at.get_last_error() != NSAPI_ERROR_OK) || (sock_id == -1)) {
141+
_at.unlock();
144142
return NSAPI_ERROR_NO_SOCKET;
145143
}
144+
_at.unlock();
146145

147146
// Check for duplicate socket id delivered by modem
148147
for (int i = 0; i < UBLOX_MAX_SOCKET; i++) {
@@ -162,8 +161,15 @@ nsapi_error_t UBLOX_AT_CellularStack::socket_connect(nsapi_socket_t handle, cons
162161
{
163162
CellularSocket *socket = (CellularSocket *)handle;
164163

165-
if (!socket->created) {
166-
create_socket_impl(socket);
164+
if (socket) {
165+
if (!socket->created) {
166+
nsapi_error_t err = create_socket_impl(socket);
167+
if(err != NSAPI_ERROR_OK) {
168+
return err;
169+
}
170+
}
171+
} else {
172+
return NSAPI_ERROR_DEVICE_ERROR;
167173
}
168174

169175
_at.lock();

0 commit comments

Comments
 (0)