Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public and internal APIs cleanup #10955

Merged
merged 36 commits into from
Jul 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
f4b986d
RTOS public apis (#1)
evedon Jun 19, 2019
6a5d04e
Drivers: Sanity cleanup for coherence and reducing size (#2)
hugueskamba Jun 25, 2019
936caa1
Deprecate `drivers/Ethernet` and `hal/ethernet_api` (#4)
hugueskamba Jun 26, 2019
b15930c
Separate drivers internal APIs from public APIs (#5)
hugueskamba Jun 27, 2019
82ae01a
Clean up events (#3)
gpsimenos Jul 1, 2019
3456f5f
FiX build when Ethernet is included (#6)
hugueskamba Jul 2, 2019
11003ea
Fix the incorrect Doxygen group alias for RTOS public API documentati…
hugueskamba Jul 3, 2019
fc48e43
Fix RTOS internal API Doxygen documentation (#7)
hugueskamba Jul 3, 2019
052c46d
Fix code style errors.
hugueskamba Jul 5, 2019
bee7ae4
Add Doxygen `ingroup` command as a recognised token in CI spellchecker
hugueskamba Jul 5, 2019
71137a4
Classify public base classes as public APIs
hugueskamba Jul 5, 2019
d04b0a3
Rename newly created `internal` subdir to `source` dir
hugueskamba Jul 5, 2019
2443b48
Fix path to TimerEvent.h header file
hugueskamba Jul 8, 2019
693f7be
Fix path to SerialBase.h header file
hugueskamba Jul 8, 2019
00c3015
Fix events dir path in UNITTESTS makefile
hugueskamba Jul 8, 2019
a79f23e
Fix path to equeue and profiling events tests in travis script
hugueskamba Jul 8, 2019
2fccd99
Fix include path to find `source` folder from relative path in travis…
hugueskamba Jul 8, 2019
ef074e7
Fix missing declaration of `sleep` symbol by including header file.
hugueskamba Jul 8, 2019
429caa6
Inline low footprint methods for code size and speed
hugueskamba Jul 8, 2019
92ded3a
Correct copyright owner in copyright notice
hugueskamba Jul 8, 2019
31e51de
Slightly improve readability and consistence
hugueskamba Jul 8, 2019
52d53d0
Fix inline usage by moving it to method declarations
hugueskamba Jul 9, 2019
35ce062
Fix remove inline specifier as the definition of an inline function
hugueskamba Jul 9, 2019
9b592cd
Fix SerialWireOutput API Doxygen classification
hugueskamba Jul 10, 2019
91ef36d
Create `internal` dir in `events` and `drivers`
hugueskamba Jul 10, 2019
7d3d944
Fix events tests paths to internal headers
hugueskamba Jul 10, 2019
893b930
Restore methods made inline in header files
hugueskamba Jul 10, 2019
2c3e4ec
Add Doxygen to Watchdog and relocate source file
hugueskamba Jul 10, 2019
7f1049b
Fix events test
hugueskamba Jul 10, 2019
69b016a
Fix astyle issues
hugueskamba Jul 10, 2019
8fa81d3
Fix Serial unlock method definition
hugueskamba Jul 10, 2019
f5cbb0d
Fix events tests by appending source location in `internal` dir
hugueskamba Jul 10, 2019
48248d7
Merge branch 'feature-public-headers' into feature-public-headers-cle…
hugueskamba Jul 11, 2019
e7dd180
Restore AnalogOut operator method implementation to header
hugueskamba Jul 11, 2019
488af02
Move source files from `internal` dirs to `source` dirs
hugueskamba Jul 11, 2019
da4baf3
Fixing events tests
hugueskamba Jul 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ matrix:
features/frameworks/utest features/frameworks/unity components BUILD
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
# Run local equeue tests
- make -C ${EVENTS}/equeue test
- make -C ${EVENTS}/source test
# Run profiling tests
- make -C ${EVENTS}/equeue prof | tee prof
- make -C ${EVENTS}/source prof | tee prof
after_success:
# Update status, comparing with master if possible.
- |
Expand Down
3 changes: 2 additions & 1 deletion UNITTESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../drivers"
"${PROJECT_SOURCE_DIR}/../hal"
"${PROJECT_SOURCE_DIR}/../events"
"${PROJECT_SOURCE_DIR}/../events/equeue"
"${PROJECT_SOURCE_DIR}/../events/source"
"${PROJECT_SOURCE_DIR}/../events/internal"
"${PROJECT_SOURCE_DIR}/../rtos"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include"
Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/stubs/SerialBase_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#include "SerialBase.h"
#include "drivers/SerialBase.h"

namespace mbed {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "SPI.h"
#include "inttypes.h"
#include "Timeout.h"
#include "platform/mbed_error.h"

#define TRACE_GROUP "AtRF"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <string.h>
#include "rtos.h"
#include "mbed_interface.h"
#include "platform/mbed_error.h"

using namespace mbed;
using namespace rtos;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Timeout.h"
#include "Thread.h"
#include "mbed_wait_api.h"
#include "platform/mbed_error.h"

using namespace mbed;
using namespace rtos;
Expand Down
38 changes: 15 additions & 23 deletions drivers/AnalogIn.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -26,7 +26,13 @@
#include "platform/PlatformMutex.h"

namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api Public API */
/** @{*/
/**
* \defgroup drivers_AnalogIn AnalogIn class
* @{
*/

/** An analog input, used for reading the voltage on a pin
*
Expand All @@ -48,7 +54,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class AnalogIn {

Expand All @@ -58,37 +63,20 @@ class AnalogIn {
*
* @param pin AnalogIn pin to connect to
*/
AnalogIn(PinName pin)
{
lock();
analogin_init(&_adc, pin);
unlock();
}
AnalogIn(PinName pin);

/** Read the input voltage, represented as a float in the range [0.0, 1.0]
*
* @returns A floating-point value representing the current input voltage, measured as a percentage
*/
float read()
{
lock();
float ret = analogin_read(&_adc);
unlock();
return ret;
}
float read();

/** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
*
* @returns
* 16-bit unsigned short representing the current input voltage, normalized to a 16-bit value
*/
unsigned short read_u16()
{
lock();
unsigned short ret = analogin_read_u16(&_adc);
unlock();
return ret;
}
unsigned short read_u16();

/** An operator shorthand for read()
*
Expand Down Expand Up @@ -129,8 +117,12 @@ class AnalogIn {
analogin_t _adc;
static SingletonPtr<PlatformMutex> _mutex;
#endif //!defined(DOXYGEN_ONLY)

};

/** @}*/
/** @}*/

} // namespace mbed

#endif
Expand Down
36 changes: 14 additions & 22 deletions drivers/AnalogOut.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -25,7 +25,13 @@
#include "platform/PlatformMutex.h"

namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_AnalogOut AnalogOut class
* @{
*/

/** An analog output, used for setting the voltage on a pin
*
Expand All @@ -48,7 +54,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class AnalogOut {

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

/** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
*
* @param value 16-bit unsigned short representing the output voltage,
* normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v)
*/
void write_u16(unsigned short value)
{
lock();
analogout_write_u16(&_dac, value);
unlock();
}
void write_u16(unsigned short value);

/** Return the current output voltage setting, measured as a percentage (float)
*
Expand All @@ -99,13 +94,7 @@ class AnalogOut {
* @note
* This value may not match exactly the value set by a previous write().
*/
float read()
{
lock();
float ret = analogout_read(&_dac);
unlock();
return ret;
}
float read();

/** An operator shorthand for write()
* \sa AnalogOut::write()
Expand Down Expand Up @@ -158,6 +147,9 @@ class AnalogOut {
#endif //!defined(DOXYGEN_ONLY)
};

/** @}*/
/** @}*/

} // namespace mbed

#endif
Expand Down
12 changes: 10 additions & 2 deletions drivers/BusIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@
#include "platform/NonCopyable.h"

namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusIn BusIn class
* @{
*/

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

Expand Down Expand Up @@ -125,6 +130,9 @@ class BusIn : private NonCopyable<BusIn> {
#endif
};

/** @}*/
/** @}*/

} // namespace mbed

#endif
Expand Down
12 changes: 10 additions & 2 deletions drivers/BusInOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@
#include "platform/NonCopyable.h"

namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusInOut BusInOut class
* @{
*/

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

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

/** @}*/
/** @}*/

} // namespace mbed

#endif
12 changes: 10 additions & 2 deletions drivers/BusOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@
#include "platform/NonCopyable.h"

namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusOut BusOut class
* @{
*/

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

Expand Down Expand Up @@ -125,6 +130,9 @@ class BusOut : private NonCopyable<BusOut> {
#endif
};

/** @}*/
/** @}*/

} // namespace mbed

#endif
23 changes: 19 additions & 4 deletions drivers/CAN.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -27,12 +27,17 @@
#include "platform/NonCopyable.h"

namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_CANMessage CANMessage class
* @{
*/

/** CANMessage class
*
* @note Synchronization level: Thread safe
* @ingroup drivers
*/
class CANMessage : public CAN_Message {

Expand Down Expand Up @@ -98,8 +103,14 @@ class CANMessage : public CAN_Message {
}
};

/** @}*/

/**
* \defgroup drivers_CAN CAN class
* @{
*/

/** A can bus client, used for communicating with can devices
* @ingroup drivers
*/
class CAN : private NonCopyable<CAN> {

Expand Down Expand Up @@ -315,12 +326,16 @@ class CAN : private NonCopyable<CAN> {
protected:
virtual void lock();
virtual void unlock();

can_t _can;
Callback<void()> _irq[IrqCnt];
PlatformMutex _mutex;
#endif
};

/** @}*/
/** @}*/

} // namespace mbed

#endif
Expand Down
Loading