Skip to content

Commit 9c973be

Browse files
hugueskambaevedon
authored andcommitted
Drivers/Events/RTOS Public and internal APIs cleanup (#10955)
Separate drivers, events, and rtos internal APIs from public APIs. * Move source files to source subdirs * Move internal headers to internal subdirs * Add Doxygen comments for documenting internal and public APIs * Remove source code from header files in order to remove include pre-processor directives that included header files not directly used by said header files * Explicitly include header files instead of implicit inclusions via third-party header files. Release Notes This will break user code that was using an internal API as the internal header files have been moved. This will only break if the user was including the header file using a namespace (i.e #include "foo/bar.h" instead of #include "bar.h"
1 parent 54d7d7e commit 9c973be

File tree

129 files changed

+1201
-521
lines changed

Some content is hidden

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

129 files changed

+1201
-521
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ matrix:
227227
features/frameworks/utest features/frameworks/unity components BUILD
228228
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
229229
# Run local equeue tests
230-
- make -C ${EVENTS}/equeue test
230+
- make -C ${EVENTS}/source test
231231
# Run profiling tests
232-
- make -C ${EVENTS}/equeue prof | tee prof
232+
- make -C ${EVENTS}/source prof | tee prof
233233
after_success:
234234
# Update status, comparing with master if possible.
235235
- |

UNITTESTS/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ set(unittest-includes-base
105105
"${PROJECT_SOURCE_DIR}/../drivers"
106106
"${PROJECT_SOURCE_DIR}/../hal"
107107
"${PROJECT_SOURCE_DIR}/../events"
108-
"${PROJECT_SOURCE_DIR}/../events/equeue"
108+
"${PROJECT_SOURCE_DIR}/../events/source"
109+
"${PROJECT_SOURCE_DIR}/../events/internal"
109110
"${PROJECT_SOURCE_DIR}/../rtos"
110111
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX"
111112
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include"

UNITTESTS/stubs/SerialBase_stub.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
#include "SerialBase.h"
18+
#include "drivers/SerialBase.h"
1919

2020
namespace mbed {
2121

components/802.15.4_RF/atmel-rf-driver/source/NanostackRfPhyAtmel.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "SPI.h"
3333
#include "inttypes.h"
3434
#include "Timeout.h"
35+
#include "platform/mbed_error.h"
3536

3637
#define TRACE_GROUP "AtRF"
3738

components/802.15.4_RF/mcr20a-rf-driver/source/NanostackRfPhyMcr20a.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <string.h>
2424
#include "rtos.h"
2525
#include "mbed_interface.h"
26+
#include "platform/mbed_error.h"
2627

2728
using namespace mbed;
2829
using namespace rtos;

components/802.15.4_RF/stm-s2lp-rf-driver/source/NanostackRfPhys2lp.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "Timeout.h"
3030
#include "Thread.h"
3131
#include "mbed_wait_api.h"
32+
#include "platform/mbed_error.h"
3233

3334
using namespace mbed;
3435
using namespace rtos;

drivers/AnalogIn.h

+15-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,7 +26,13 @@
2626
#include "platform/PlatformMutex.h"
2727

2828
namespace mbed {
29-
/** \addtogroup drivers */
29+
/** \ingroup drivers */
30+
/** \addtogroup drivers-public-api Public API */
31+
/** @{*/
32+
/**
33+
* \defgroup drivers_AnalogIn AnalogIn class
34+
* @{
35+
*/
3036

3137
/** An analog input, used for reading the voltage on a pin
3238
*
@@ -48,7 +54,6 @@ namespace mbed {
4854
* }
4955
* }
5056
* @endcode
51-
* @ingroup drivers
5257
*/
5358
class AnalogIn {
5459

@@ -58,37 +63,20 @@ class AnalogIn {
5863
*
5964
* @param pin AnalogIn pin to connect to
6065
*/
61-
AnalogIn(PinName pin)
62-
{
63-
lock();
64-
analogin_init(&_adc, pin);
65-
unlock();
66-
}
66+
AnalogIn(PinName pin);
6767

6868
/** Read the input voltage, represented as a float in the range [0.0, 1.0]
6969
*
7070
* @returns A floating-point value representing the current input voltage, measured as a percentage
7171
*/
72-
float read()
73-
{
74-
lock();
75-
float ret = analogin_read(&_adc);
76-
unlock();
77-
return ret;
78-
}
72+
float read();
7973

8074
/** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
8175
*
8276
* @returns
8377
* 16-bit unsigned short representing the current input voltage, normalized to a 16-bit value
8478
*/
85-
unsigned short read_u16()
86-
{
87-
lock();
88-
unsigned short ret = analogin_read_u16(&_adc);
89-
unlock();
90-
return ret;
91-
}
79+
unsigned short read_u16();
9280

9381
/** An operator shorthand for read()
9482
*
@@ -129,8 +117,12 @@ class AnalogIn {
129117
analogin_t _adc;
130118
static SingletonPtr<PlatformMutex> _mutex;
131119
#endif //!defined(DOXYGEN_ONLY)
120+
132121
};
133122

123+
/** @}*/
124+
/** @}*/
125+
134126
} // namespace mbed
135127

136128
#endif

drivers/AnalogOut.h

+14-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,7 +25,13 @@
2525
#include "platform/PlatformMutex.h"
2626

2727
namespace mbed {
28-
/** \addtogroup drivers */
28+
/** \ingroup drivers */
29+
/** \addtogroup drivers-public-api */
30+
/** @{*/
31+
/**
32+
* \defgroup drivers_AnalogOut AnalogOut class
33+
* @{
34+
*/
2935

3036
/** An analog output, used for setting the voltage on a pin
3137
*
@@ -48,7 +54,6 @@ namespace mbed {
4854
* }
4955
* }
5056
* @endcode
51-
* @ingroup drivers
5257
*/
5358
class AnalogOut {
5459

@@ -70,24 +75,14 @@ class AnalogOut {
7075
* 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
7176
* Values outside this range will be saturated to 0.0f or 1.0f.
7277
*/
73-
void write(float value)
74-
{
75-
lock();
76-
analogout_write(&_dac, value);
77-
unlock();
78-
}
78+
void write(float value);
7979

8080
/** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
8181
*
8282
* @param value 16-bit unsigned short representing the output voltage,
8383
* normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v)
8484
*/
85-
void write_u16(unsigned short value)
86-
{
87-
lock();
88-
analogout_write_u16(&_dac, value);
89-
unlock();
90-
}
85+
void write_u16(unsigned short value);
9186

9287
/** Return the current output voltage setting, measured as a percentage (float)
9388
*
@@ -99,13 +94,7 @@ class AnalogOut {
9994
* @note
10095
* This value may not match exactly the value set by a previous write().
10196
*/
102-
float read()
103-
{
104-
lock();
105-
float ret = analogout_read(&_dac);
106-
unlock();
107-
return ret;
108-
}
97+
float read();
10998

11099
/** An operator shorthand for write()
111100
* \sa AnalogOut::write()
@@ -158,6 +147,9 @@ class AnalogOut {
158147
#endif //!defined(DOXYGEN_ONLY)
159148
};
160149

150+
/** @}*/
151+
/** @}*/
152+
161153
} // namespace mbed
162154

163155
#endif

drivers/BusIn.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@
2323
#include "platform/NonCopyable.h"
2424

2525
namespace mbed {
26-
/** \addtogroup drivers */
26+
/** \ingroup drivers */
27+
/** \addtogroup drivers-public-api */
28+
/** @{*/
29+
/**
30+
* \defgroup drivers_BusIn BusIn class
31+
* @{
32+
*/
2733

2834
/** A digital input bus, used for reading the state of a collection of pins
2935
*
3036
* @note Synchronization level: Thread safe
31-
* @ingroup drivers
3237
*/
3338
class BusIn : private NonCopyable<BusIn> {
3439

@@ -125,6 +130,9 @@ class BusIn : private NonCopyable<BusIn> {
125130
#endif
126131
};
127132

133+
/** @}*/
134+
/** @}*/
135+
128136
} // namespace mbed
129137

130138
#endif

drivers/BusInOut.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@
2222
#include "platform/NonCopyable.h"
2323

2424
namespace mbed {
25-
/** \addtogroup drivers */
25+
/** \ingroup drivers */
26+
/** \addtogroup drivers-public-api */
27+
/** @{*/
28+
/**
29+
* \defgroup drivers_BusInOut BusInOut class
30+
* @{
31+
*/
2632

2733
/** A digital input output bus, used for setting the state of a collection of pins.
2834
* Implemented as an array of DigitalInOut pins, the bus can be constructed by any
2935
* pins without restriction other than being capable of digital input or output
3036
* capabilities
3137
*
3238
* @note Synchronization level: Thread safe
33-
* @ingroup drivers
3439
*/
3540
class BusInOut : private NonCopyable<BusInOut> {
3641

@@ -147,6 +152,9 @@ class BusInOut : private NonCopyable<BusInOut> {
147152
#endif //!defined(DOXYGEN_ONLY)
148153
};
149154

155+
/** @}*/
156+
/** @}*/
157+
150158
} // namespace mbed
151159

152160
#endif

drivers/BusOut.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222
#include "platform/NonCopyable.h"
2323

2424
namespace mbed {
25-
/** \addtogroup drivers */
25+
/** \ingroup drivers */
26+
/** \addtogroup drivers-public-api */
27+
/** @{*/
28+
/**
29+
* \defgroup drivers_BusOut BusOut class
30+
* @{
31+
*/
2632

2733
/** A digital output bus, used for setting the state of a collection of pins
28-
* @ingroup drivers
2934
*/
3035
class BusOut : private NonCopyable<BusOut> {
3136

@@ -125,6 +130,9 @@ class BusOut : private NonCopyable<BusOut> {
125130
#endif
126131
};
127132

133+
/** @}*/
134+
/** @}*/
135+
128136
} // namespace mbed
129137

130138
#endif

drivers/CAN.h

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2019 ARM Limited
33
* SPDX-License-Identifier: Apache-2.0
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,12 +27,17 @@
2727
#include "platform/NonCopyable.h"
2828

2929
namespace mbed {
30-
/** \addtogroup drivers */
30+
/** \ingroup drivers */
31+
/** \addtogroup drivers-public-api */
32+
/** @{*/
33+
/**
34+
* \defgroup drivers_CANMessage CANMessage class
35+
* @{
36+
*/
3137

3238
/** CANMessage class
3339
*
3440
* @note Synchronization level: Thread safe
35-
* @ingroup drivers
3641
*/
3742
class CANMessage : public CAN_Message {
3843

@@ -98,8 +103,14 @@ class CANMessage : public CAN_Message {
98103
}
99104
};
100105

106+
/** @}*/
107+
108+
/**
109+
* \defgroup drivers_CAN CAN class
110+
* @{
111+
*/
112+
101113
/** A can bus client, used for communicating with can devices
102-
* @ingroup drivers
103114
*/
104115
class CAN : private NonCopyable<CAN> {
105116

@@ -315,12 +326,16 @@ class CAN : private NonCopyable<CAN> {
315326
protected:
316327
virtual void lock();
317328
virtual void unlock();
329+
318330
can_t _can;
319331
Callback<void()> _irq[IrqCnt];
320332
PlatformMutex _mutex;
321333
#endif
322334
};
323335

336+
/** @}*/
337+
/** @}*/
338+
324339
} // namespace mbed
325340

326341
#endif

0 commit comments

Comments
 (0)