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

Feature public headers #11073

Merged
merged 10 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2013-2018 Arm Limited. All rights reserved.
# Copyright (c) 2013-2019 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
Expand Down Expand Up @@ -222,14 +222,14 @@ matrix:
# Check that example compiles without rtos
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp
- |
rm -r rtos usb features/cellular features/netsocket features/nanostack \
rm -r rtos drivers/source/usb features/cellular features/netsocket features/nanostack \
features/lwipstack features/frameworks/greentea-client \
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
1 change: 1 addition & 0 deletions TESTS/mbed_hal/lp_ticker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "lp_ticker_api_tests.h"
#include "hal/lp_ticker_api.h"
#include "hal/mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"

#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power timer not supported for this target
Expand Down
1 change: 1 addition & 0 deletions TESTS/mbed_hal/qspi/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "mbed.h"
#include "qspi_api.h"
#include "hal/us_ticker_api.h"


#if !defined(QSPI_FLASH_CHIP_STRING)
Expand Down
1 change: 1 addition & 0 deletions TESTS/mbed_hal/qspi/qspi_test_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "utest/utest.h"

#include "hal/qspi_api.h"
#include "hal/us_ticker_api.h"
#include "qspi_test_utils.h"

#include "unity/unity.h"
Expand Down
1 change: 1 addition & 0 deletions TESTS/mbed_hal/sleep/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "unity/unity.h"
#include "greentea-client/test_env.h"
#include "mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"

#include "sleep_test_utils.h"
#include "sleep_api_tests.h"
Expand Down
1 change: 1 addition & 0 deletions TESTS/mbed_hal/sleep_manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <limits.h>
#include "mbed.h"
#include "mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"
#include "../sleep/sleep_test_utils.h"
#include "sleep_manager_api_tests.h"

Expand Down
2 changes: 2 additions & 0 deletions TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "unity/unity.h"
#include "greentea-client/test_env.h"

#include "platform/mbed_critical.h"

using namespace utest::v1;

#include <stdlib.h>
Expand Down
3 changes: 2 additions & 1 deletion TESTS/usb_device/hid/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, ARM Limited, All Rights Reserved
* Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand Down Expand Up @@ -27,6 +27,7 @@
#include "USBHID.h"
#include "USBMouse.h"
#include "USBKeyboard.h"
#include "hal/us_ticker_api.h"

// Reuse the VID & PID from basic USB test.
#define USB_HID_VID 0x0d28
Expand Down
3 changes: 2 additions & 1 deletion TESTS/usb_device/serial/main.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, ARM Limited, All Rights Reserved
* Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
Expand All @@ -26,6 +26,7 @@
#include "usb_phy_api.h"
#include "USBCDC.h"
#include "USBSerial.h"
#include "hal/us_ticker_api.h"

#define USB_CDC_VID 0x1f00
#define USB_CDC_PID 0x2013
Expand Down
3 changes: 2 additions & 1 deletion UNITTESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,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/drivers/Watchdog/unittest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(unittest-includes ${unittest-includes}

# Source files
set(unittest-sources
../drivers/Watchdog.cpp
../drivers/source/Watchdog.cpp
)

# Test files
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
1 change: 0 additions & 1 deletion UNITTESTS/target_h/drivers/LowPowerTicker.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "Callback.h"

namespace mbed {
/** \addtogroup drivers */

/** mock Low Power Ticker
*
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
45 changes: 22 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,21 @@
#include "platform/PlatformMutex.h"

namespace mbed {
/** \addtogroup drivers */
/** \defgroup mbed-os-public Public API */

/** \addtogroup drivers-public-api Drivers
* \ingroup mbed-os-public
*/

/** \defgroup drivers-public-api-gpio GPIO
* \ingroup drivers-public-api
*/

/**
* \defgroup drivers_AnalogIn AnalogIn class
* \ingroup drivers-public-api-gpio
* @{
*/

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

Expand All @@ -58,37 +71,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 +125,11 @@ class AnalogIn {
analogin_t _adc;
static SingletonPtr<PlatformMutex> _mutex;
#endif //!defined(DOXYGEN_ONLY)

};

/** @}*/

} // namespace mbed

#endif
Expand Down
35 changes: 13 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 */
/** \addtogroup drivers-public-api */

/**
* \defgroup drivers_AnalogOut AnalogOut class
* \ingroup drivers-public-api-gpio
* @{
*/

/** 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,8 @@ class AnalogOut {
#endif //!defined(DOXYGEN_ONLY)
};

/** @}*/

} // namespace mbed

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

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

/** 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 +128,8 @@ class BusIn : private NonCopyable<BusIn> {
#endif
};

/** @}*/

} // namespace mbed

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

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

/** 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 +150,8 @@ class BusInOut : private NonCopyable<BusInOut> {
#endif //!defined(DOXYGEN_ONLY)
};

/** @}*/

} // namespace mbed

#endif
Loading