Merge pull request #11073 from ARMmbed/feature-public-headers

Feature public headers
pull/11186/head
Seppo Takalo 2019-08-07 16:04:45 +03:00 committed by GitHub
commit 7d7416558a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
277 changed files with 2081 additions and 1098 deletions

View File

@ -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 # SPDX-License-Identifier: Apache-2.0
# #
@ -222,14 +222,14 @@ matrix:
# Check that example compiles without rtos # Check that example compiles without rtos
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp - 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/lwipstack features/frameworks/greentea-client \
features/frameworks/utest features/frameworks/unity components BUILD 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 - python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
# Run local equeue tests # Run local equeue tests
- make -C ${EVENTS}/equeue test - make -C ${EVENTS}/source test
# Run profiling tests # Run profiling tests
- make -C ${EVENTS}/equeue prof | tee prof - make -C ${EVENTS}/source prof | tee prof
after_success: after_success:
# Update status, comparing with master if possible. # Update status, comparing with master if possible.
- | - |

View File

@ -21,6 +21,7 @@
#include "lp_ticker_api_tests.h" #include "lp_ticker_api_tests.h"
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
#include "hal/mbed_lp_ticker_wrapper.h" #include "hal/mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"
#if !DEVICE_LPTICKER #if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power timer not supported for this target #error [NOT_SUPPORTED] Low power timer not supported for this target

View File

@ -26,6 +26,7 @@
#include "mbed.h" #include "mbed.h"
#include "qspi_api.h" #include "qspi_api.h"
#include "hal/us_ticker_api.h"
#if !defined(QSPI_FLASH_CHIP_STRING) #if !defined(QSPI_FLASH_CHIP_STRING)

View File

@ -17,6 +17,7 @@
#include "utest/utest.h" #include "utest/utest.h"
#include "hal/qspi_api.h" #include "hal/qspi_api.h"
#include "hal/us_ticker_api.h"
#include "qspi_test_utils.h" #include "qspi_test_utils.h"
#include "unity/unity.h" #include "unity/unity.h"

View File

@ -24,6 +24,7 @@
#include "unity/unity.h" #include "unity/unity.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "mbed_lp_ticker_wrapper.h" #include "mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"
#include "sleep_test_utils.h" #include "sleep_test_utils.h"
#include "sleep_api_tests.h" #include "sleep_api_tests.h"

View File

@ -19,6 +19,7 @@
#include <limits.h> #include <limits.h>
#include "mbed.h" #include "mbed.h"
#include "mbed_lp_ticker_wrapper.h" #include "mbed_lp_ticker_wrapper.h"
#include "hal/us_ticker_api.h"
#include "../sleep/sleep_test_utils.h" #include "../sleep/sleep_test_utils.h"
#include "sleep_manager_api_tests.h" #include "sleep_manager_api_tests.h"

View File

@ -27,6 +27,8 @@
#include "unity/unity.h" #include "unity/unity.h"
#include "greentea-client/test_env.h" #include "greentea-client/test_env.h"
#include "platform/mbed_critical.h"
using namespace utest::v1; using namespace utest::v1;
#include <stdlib.h> #include <stdlib.h>

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -27,6 +27,7 @@
#include "USBHID.h" #include "USBHID.h"
#include "USBMouse.h" #include "USBMouse.h"
#include "USBKeyboard.h" #include "USBKeyboard.h"
#include "hal/us_ticker_api.h"
// Reuse the VID & PID from basic USB test. // Reuse the VID & PID from basic USB test.
#define USB_HID_VID 0x0d28 #define USB_HID_VID 0x0d28

View File

@ -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 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -26,6 +26,7 @@
#include "usb_phy_api.h" #include "usb_phy_api.h"
#include "USBCDC.h" #include "USBCDC.h"
#include "USBSerial.h" #include "USBSerial.h"
#include "hal/us_ticker_api.h"
#define USB_CDC_VID 0x1f00 #define USB_CDC_VID 0x1f00
#define USB_CDC_PID 0x2013 #define USB_CDC_PID 0x2013

View File

@ -105,7 +105,8 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../drivers" "${PROJECT_SOURCE_DIR}/../drivers"
"${PROJECT_SOURCE_DIR}/../hal" "${PROJECT_SOURCE_DIR}/../hal"
"${PROJECT_SOURCE_DIR}/../events" "${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"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX" "${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include" "${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include"

View File

@ -12,7 +12,7 @@ set(unittest-includes ${unittest-includes}
# Source files # Source files
set(unittest-sources set(unittest-sources
../drivers/Watchdog.cpp ../drivers/source/Watchdog.cpp
) )
# Test files # Test files

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "SerialBase.h" #include "drivers/SerialBase.h"
namespace mbed { namespace mbed {

View File

@ -21,7 +21,6 @@
#include "Callback.h" #include "Callback.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */
/** mock Low Power Ticker /** mock Low Power Ticker
* *

View File

@ -32,6 +32,7 @@
#include "SPI.h" #include "SPI.h"
#include "inttypes.h" #include "inttypes.h"
#include "Timeout.h" #include "Timeout.h"
#include "platform/mbed_error.h"
#define TRACE_GROUP "AtRF" #define TRACE_GROUP "AtRF"

View File

@ -23,6 +23,7 @@
#include <string.h> #include <string.h>
#include "rtos.h" #include "rtos.h"
#include "mbed_interface.h" #include "mbed_interface.h"
#include "platform/mbed_error.h"
using namespace mbed; using namespace mbed;
using namespace rtos; using namespace rtos;

View File

@ -29,6 +29,7 @@
#include "Timeout.h" #include "Timeout.h"
#include "Thread.h" #include "Thread.h"
#include "mbed_wait_api.h" #include "mbed_wait_api.h"
#include "platform/mbed_error.h"
using namespace mbed; using namespace mbed;
using namespace rtos; using namespace rtos;

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -26,7 +26,21 @@
#include "platform/PlatformMutex.h" #include "platform/PlatformMutex.h"
namespace mbed { 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 /** An analog input, used for reading the voltage on a pin
* *
@ -48,7 +62,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class AnalogIn { class AnalogIn {
@ -58,37 +71,20 @@ public:
* *
* @param pin AnalogIn pin to connect to * @param pin AnalogIn pin to connect to
*/ */
AnalogIn(PinName pin) AnalogIn(PinName pin);
{
lock();
analogin_init(&_adc, pin);
unlock();
}
/** Read the input voltage, represented as a float in the range [0.0, 1.0] /** 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 * @returns A floating-point value representing the current input voltage, measured as a percentage
*/ */
float read() float read();
{
lock();
float ret = analogin_read(&_adc);
unlock();
return ret;
}
/** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF] /** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
* *
* @returns * @returns
* 16-bit unsigned short representing the current input voltage, normalized to a 16-bit value * 16-bit unsigned short representing the current input voltage, normalized to a 16-bit value
*/ */
unsigned short read_u16() unsigned short read_u16();
{
lock();
unsigned short ret = analogin_read_u16(&_adc);
unlock();
return ret;
}
/** An operator shorthand for read() /** An operator shorthand for read()
* *
@ -129,8 +125,11 @@ protected:
analogin_t _adc; analogin_t _adc;
static SingletonPtr<PlatformMutex> _mutex; static SingletonPtr<PlatformMutex> _mutex;
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,7 +25,13 @@
#include "platform/PlatformMutex.h" #include "platform/PlatformMutex.h"
namespace mbed { 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 /** An analog output, used for setting the voltage on a pin
* *
@ -48,7 +54,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class AnalogOut { class AnalogOut {
@ -70,24 +75,14 @@ public:
* 0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%). * 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. * Values outside this range will be saturated to 0.0f or 1.0f.
*/ */
void write(float value) void write(float value);
{
lock();
analogout_write(&_dac, value);
unlock();
}
/** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF] /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
* *
* @param value 16-bit unsigned short representing the output voltage, * @param value 16-bit unsigned short representing the output voltage,
* normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v) * normalized to a 16-bit value (0x0000 = 0v, 0xFFFF = 3.3v)
*/ */
void write_u16(unsigned short value) void write_u16(unsigned short value);
{
lock();
analogout_write_u16(&_dac, value);
unlock();
}
/** Return the current output voltage setting, measured as a percentage (float) /** Return the current output voltage setting, measured as a percentage (float)
* *
@ -99,13 +94,7 @@ public:
* @note * @note
* This value may not match exactly the value set by a previous write(). * This value may not match exactly the value set by a previous write().
*/ */
float read() float read();
{
lock();
float ret = analogout_read(&_dac);
unlock();
return ret;
}
/** An operator shorthand for write() /** An operator shorthand for write()
* \sa AnalogOut::write() * \sa AnalogOut::write()
@ -158,6 +147,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -23,12 +23,15 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { 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 /** A digital input bus, used for reading the state of a collection of pins
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
* @ingroup drivers
*/ */
class BusIn : private NonCopyable<BusIn> { class BusIn : private NonCopyable<BusIn> {
@ -125,6 +128,8 @@ private:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -22,7 +22,11 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { 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. /** 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 * Implemented as an array of DigitalInOut pins, the bus can be constructed by any
@ -30,7 +34,6 @@ namespace mbed {
* capabilities * capabilities
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
* @ingroup drivers
*/ */
class BusInOut : private NonCopyable<BusInOut> { class BusInOut : private NonCopyable<BusInOut> {
@ -147,6 +150,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -22,10 +22,13 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_BusOut BusOut class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A digital output bus, used for setting the state of a collection of pins /** A digital output bus, used for setting the state of a collection of pins
* @ingroup drivers
*/ */
class BusOut : private NonCopyable<BusOut> { class BusOut : private NonCopyable<BusOut> {
@ -125,6 +128,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -27,12 +27,19 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \defgroup drivers-public-api-can CAN
* \ingroup drivers-public-api
*/
/**
* \defgroup drivers_CANMessage CANMessage class
* \ingroup drivers-public-api-can
* @{
*/
/** CANMessage class /** CANMessage class
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
* @ingroup drivers
*/ */
class CANMessage : public CAN_Message { class CANMessage : public CAN_Message {
@ -98,8 +105,15 @@ public:
} }
}; };
/** @}*/
/**
* \defgroup drivers_CAN CAN class
* \ingroup drivers-public-api-can
* @{
*/
/** A can bus client, used for communicating with can devices /** A can bus client, used for communicating with can devices
* @ingroup drivers
*/ */
class CAN : private NonCopyable<CAN> { class CAN : private NonCopyable<CAN> {
@ -315,12 +329,15 @@ public:
protected: protected:
virtual void lock(); virtual void lock();
virtual void unlock(); virtual void unlock();
can_t _can; can_t _can;
Callback<void()> _irq[IrqCnt]; Callback<void()> _irq[IrqCnt];
PlatformMutex _mutex; PlatformMutex _mutex;
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +20,13 @@
#include "platform/platform.h" #include "platform/platform.h"
#include "hal/gpio_api.h" #include "hal/gpio_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_DigitalIn DigitalIn class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A digital input, used for reading the state of a pin /** A digital input, used for reading the state of a pin
* *
@ -47,7 +50,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class DigitalIn { class DigitalIn {
@ -72,6 +74,7 @@ public:
// No lock needed in the constructor // No lock needed in the constructor
gpio_init_in_ex(&gpio, pin, mode); gpio_init_in_ex(&gpio, pin, mode);
} }
/** Read the input, represented as 0 or 1 (int) /** Read the input, represented as 0 or 1 (int)
* *
* @returns * @returns
@ -88,12 +91,7 @@ public:
* *
* @param pull PullUp, PullDown, PullNone, OpenDrain * @param pull PullUp, PullDown, PullNone, OpenDrain
*/ */
void mode(PinMode pull) void mode(PinMode pull);
{
core_util_critical_section_enter();
gpio_mode(&gpio, pull);
core_util_critical_section_exit();
}
/** Return the output setting, represented as 0 or 1 (int) /** Return the output setting, represented as 0 or 1 (int)
* *
@ -127,6 +125,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,15 +20,17 @@
#include "platform/platform.h" #include "platform/platform.h"
#include "hal/gpio_api.h" #include "hal/gpio_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_DigitalInOut DigitalInOut class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A digital input/output, used for setting or reading a bi-directional pin /** A digital input/output, used for setting or reading a bi-directional pin
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class DigitalInOut { class DigitalInOut {
@ -81,32 +83,17 @@ public:
/** Set as an output /** Set as an output
*/ */
void output() void output();
{
core_util_critical_section_enter();
gpio_dir(&gpio, PIN_OUTPUT);
core_util_critical_section_exit();
}
/** Set as an input /** Set as an input
*/ */
void input() void input();
{
core_util_critical_section_enter();
gpio_dir(&gpio, PIN_INPUT);
core_util_critical_section_exit();
}
/** Set the input pin mode /** Set the input pin mode
* *
* @param pull PullUp, PullDown, PullNone, OpenDrain * @param pull PullUp, PullDown, PullNone, OpenDrain
*/ */
void mode(PinMode pull) void mode(PinMode pull);
{
core_util_critical_section_enter();
gpio_mode(&gpio, pull);
core_util_critical_section_exit();
}
/** Return the output setting, represented as 0 or 1 (int) /** Return the output setting, represented as 0 or 1 (int)
* *
@ -141,13 +128,7 @@ public:
* state from the DigitalInOut argument. * state from the DigitalInOut argument.
* \sa DigitalInOut::write() * \sa DigitalInOut::write()
*/ */
DigitalInOut &operator= (DigitalInOut &rhs) DigitalInOut &operator= (DigitalInOut &rhs);
{
core_util_critical_section_enter();
write(rhs.read());
core_util_critical_section_exit();
return *this;
}
/** A shorthand for read() /** A shorthand for read()
* \sa DigitalInOut::read() * \sa DigitalInOut::read()
@ -171,6 +152,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,10 +19,13 @@
#include "platform/platform.h" #include "platform/platform.h"
#include "hal/gpio_api.h" #include "hal/gpio_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_DigitalOut DigitalOut class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A digital output, used for setting the state of a pin /** A digital output, used for setting the state of a pin
* *
@ -42,7 +45,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class DigitalOut { class DigitalOut {
@ -122,13 +124,7 @@ public:
* state from the DigitalOut argument. * state from the DigitalOut argument.
* \sa DigitalOut::write() * \sa DigitalOut::write()
*/ */
DigitalOut &operator= (DigitalOut &rhs) DigitalOut &operator= (DigitalOut &rhs);
{
core_util_critical_section_enter();
write(rhs.read());
core_util_critical_section_exit();
return *this;
}
/** A shorthand for read() /** A shorthand for read()
* \sa DigitalOut::read() * \sa DigitalOut::read()
@ -150,6 +146,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -23,9 +23,20 @@
#if DEVICE_ETHERNET || defined(DOXYGEN_ONLY) #if DEVICE_ETHERNET || defined(DOXYGEN_ONLY)
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup mbed-os-public */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Ethernet Ethernet class
* @{
*/
/** An ethernet interface, to use with the ethernet pins. /** An ethernet interface, to use with the ethernet pins.
*
* @deprecated
* EthInterface is now the preferred way to get an Ethernet object.
* Alternatively, use NetworkInterface to get an instance of an appropriate network
* interface (WiFi or Ethernet).
* *
* @note Synchronization level: Not protected * @note Synchronization level: Not protected
* *
@ -54,18 +65,28 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class Ethernet : private NonCopyable<Ethernet> { class
MBED_DEPRECATED(
"EthInterface is now the preferred way to get an Ethernet object. "
"Alternatively, use NetworkInterface to get an instance of an appropriate network "
"interface (WiFi or Ethernet)."
) Ethernet : private NonCopyable<Ethernet> {
public: public:
/** Initialize the ethernet interface. /**
* @deprecated
* Initialize the ethernet interface.
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
Ethernet(); Ethernet();
/** Powers the hardware down. /**
* @deprecated
* Powers the hardware down.
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
virtual ~Ethernet(); virtual ~Ethernet();
enum Mode { enum Mode {
@ -76,7 +97,9 @@ public:
FullDuplex100 FullDuplex100
}; };
/** Writes into an outgoing ethernet packet. /**
* @deprecated
* Writes into an outgoing ethernet packet.
* *
* It will append size bytes of data to the previously written bytes. * It will append size bytes of data to the previously written bytes.
* *
@ -86,9 +109,12 @@ public:
* @returns * @returns
* The number of written bytes. * The number of written bytes.
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
int write(const char *data, int size); int write(const char *data, int size);
/** Send an outgoing ethernet packet. /**
* @deprecated
* Send an outgoing ethernet packet.
* *
* After filling in the data in an ethernet packet it must be send. * After filling in the data in an ethernet packet it must be send.
* Send will provide a new packet to write to. * Send will provide a new packet to write to.
@ -97,9 +123,12 @@ public:
* 0 if the sending was failed, * 0 if the sending was failed,
* or the size of the packet successfully sent. * or the size of the packet successfully sent.
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
int send(); int send();
/** Receives an arrived ethernet packet. /**
* @deprecated
* Receives an arrived ethernet packet.
* *
* Receiving an ethernet packet will drop the last received ethernet packet * Receiving an ethernet packet will drop the last received ethernet packet
* and make a new ethernet packet ready to read. * and make a new ethernet packet ready to read.
@ -109,9 +138,12 @@ public:
* 0 if no ethernet packet is arrived, * 0 if no ethernet packet is arrived,
* or the size of the arrived packet. * or the size of the arrived packet.
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
int receive(); int receive();
/** Read from an received ethernet packet. /**
* @deprecated
* Read from an received ethernet packet.
* *
* After receive returned a number bigger than 0 it is * After receive returned a number bigger than 0 it is
* possible to read bytes from this packet. * possible to read bytes from this packet.
@ -124,15 +156,21 @@ public:
* Each time read will start reading after the last read byte before. * Each time read will start reading after the last read byte before.
* *
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
int read(char *data, int size); int read(char *data, int size);
/** Gives the ethernet address of the mbed. /**
* @deprecated
* Gives the ethernet address of the mbed.
* *
* @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in. * @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in.
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
void address(char *mac); void address(char *mac);
/** Returns if an ethernet link is present or not. It takes a while after Ethernet initialization to show up. /**
* @deprecated
* Returns if an ethernet link is present or not. It takes a while after Ethernet initialization to show up.
* *
* @returns * @returns
* 0 if no ethernet link is present, * 0 if no ethernet link is present,
@ -155,9 +193,12 @@ public:
* } * }
* @endcode * @endcode
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
int link(); int link();
/** Sets the speed and duplex parameters of an ethernet link /**
* @deprecated
* Sets the speed and duplex parameters of an ethernet link
* *
* - AutoNegotiate Auto negotiate speed and duplex * - AutoNegotiate Auto negotiate speed and duplex
* - HalfDuplex10 10 Mbit, half duplex * - HalfDuplex10 10 Mbit, half duplex
@ -167,9 +208,13 @@ public:
* *
* @param mode the speed and duplex mode to set the link to: * @param mode the speed and duplex mode to set the link to:
*/ */
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
void set_link(Mode mode); void set_link(Mode mode);
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -49,12 +49,17 @@ extern uint32_t Load$$LR$$LR_IROM1$$Limit[];
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup mbed-os-public */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_FlashIAP FlashIAP class
* @{
*/
/** Flash IAP driver. It invokes flash HAL functions. /** Flash IAP driver. It invokes flash HAL functions.
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
* @ingroup drivers
*/ */
class FlashIAP : private NonCopyable<FlashIAP> { class FlashIAP : private NonCopyable<FlashIAP> {
public: public:
@ -159,6 +164,9 @@ private:
#endif #endif
}; };
/** @}*/
/** @}*/
} /* namespace mbed */ } /* namespace mbed */
#endif /* DEVICE_FLASH */ #endif /* DEVICE_FLASH */

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2015 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -30,11 +30,19 @@
#if DEVICE_I2C_ASYNCH #if DEVICE_I2C_ASYNCH
#include "platform/CThunk.h" #include "platform/CThunk.h"
#include "hal/dma_api.h" #include "hal/dma_api.h"
#include "platform/FunctionPointer.h" #include "platform/Callback.h"
#endif #endif
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \defgroup drivers-public-api-i2c I2C
* \ingroup drivers-public-api
*/
/**
* \defgroup drivers_I2C I2C class
* \ingroup drivers-public-api-i2c
* @{
*/
/** An I2C Master, used for communicating with I2C slave devices /** An I2C Master, used for communicating with I2C slave devices
* *
@ -70,7 +78,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class I2C : private NonCopyable<I2C> { class I2C : private NonCopyable<I2C> {
@ -242,6 +249,8 @@ private:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -24,7 +24,11 @@
#include "hal/i2c_api.h" #include "hal/i2c_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_I2CSlave I2CSlave class
* \ingroup drivers-public-api-i2c
* @{
*/
/** An I2C Slave, used for communicating with an I2C Master device. /** An I2C Slave, used for communicating with an I2C Master device.
* *
@ -64,7 +68,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class I2CSlave { class I2CSlave {
@ -160,6 +163,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -29,7 +29,11 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_InterruptIn InterruptIn class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A digital interrupt input, used to call a function on a rising or falling edge /** A digital interrupt input, used to call a function on a rising or falling edge
* *
@ -57,7 +61,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class InterruptIn : private NonCopyable<InterruptIn> { class InterruptIn : private NonCopyable<InterruptIn> {
@ -175,6 +178,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -24,7 +24,11 @@
#include <string.h> #include <string.h>
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_InterruptManager InterruptManager class
* \ingroup drivers-public-api-gpio
* @{
*/
/** Use this singleton if you need to chain interrupt handlers. /** Use this singleton if you need to chain interrupt handlers.
* @deprecated Do not use this class. This class is not part of the public API of mbed-os and is being removed in the future. * @deprecated Do not use this class. This class is not part of the public API of mbed-os and is being removed in the future.
@ -54,7 +58,6 @@ namespace mbed {
* InterruptManager::get()->add_handler(handler, TIMER3_IRQn); * InterruptManager::get()->add_handler(handler, TIMER3_IRQn);
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class InterruptManager : private NonCopyable<InterruptManager> { class InterruptManager : private NonCopyable<InterruptManager> {
public: public:
@ -170,6 +173,7 @@ public:
#if !defined(DOXYGEN_ONLY) #if !defined(DOXYGEN_ONLY)
private: private:
InterruptManager(); InterruptManager();
~InterruptManager(); ~InterruptManager();
void lock(); void lock();
@ -203,6 +207,8 @@ private:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -26,12 +26,19 @@
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \defgroup drivers-public-api-ticker Ticker
* \ingroup drivers-public-api
*/
/**
* \defgroup drivers_LowPowerTicker LowPowerTicker class
* \ingroup drivers-public-api-ticker
* @{
*/
/** Low Power Ticker /** Low Power Ticker
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class LowPowerTicker : public Ticker, private NonCopyable<LowPowerTicker> { class LowPowerTicker : public Ticker, private NonCopyable<LowPowerTicker> {
@ -45,6 +52,8 @@ public:
} }
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -26,12 +26,15 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_LowPowerTimeout LowPowerTimeout class
* \ingroup drivers-public-api-ticker
* @{
*/
/** Low Power Timout /** Low Power Timout
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> { class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> {
#if !defined(DOXYGEN_ONLY) #if !defined(DOXYGEN_ONLY)
@ -43,7 +46,9 @@ private:
#endif #endif
}; };
} /** @}*/
} // namespace mbed
#endif #endif

View File

@ -26,12 +26,15 @@
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_LowPowerTimer LowPowerTimer class
* \ingroup drivers-public-api-ticker
* @{
*/
/** Low power timer /** Low power timer
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class LowPowerTimer : public Timer, private NonCopyable<LowPowerTimer> { class LowPowerTimer : public Timer, private NonCopyable<LowPowerTimer> {
@ -42,6 +45,8 @@ public:
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -17,7 +17,7 @@
#ifndef MBED_CRC_API_H #ifndef MBED_CRC_API_H
#define MBED_CRC_API_H #define MBED_CRC_API_H
#include "drivers/TableCRC.h" #include "drivers/internal/TableCRC.h"
#include "hal/crc_api.h" #include "hal/crc_api.h"
#include "platform/mbed_assert.h" #include "platform/mbed_assert.h"
#include "platform/SingletonPtr.h" #include "platform/SingletonPtr.h"
@ -40,8 +40,13 @@ but we check for ( width < 8) before performing shift, so it should not be an is
#endif #endif
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup mbed-os-public */
/** \addtogroup drivers-public-api */
/** @{*/ /** @{*/
/**
* \defgroup drivers_MbedCRC MbedCRC class
* @{
*/
extern SingletonPtr<PlatformMutex> mbed_crc_mutex; extern SingletonPtr<PlatformMutex> mbed_crc_mutex;
@ -101,7 +106,6 @@ extern SingletonPtr<PlatformMutex> mbed_crc_mutex;
* return 0; * return 0;
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
template <uint32_t polynomial = POLY_32BIT_ANSI, uint8_t width = 32> template <uint32_t polynomial = POLY_32BIT_ANSI, uint8_t width = 32>
class MbedCRC { class MbedCRC {
@ -565,6 +569,8 @@ private:
#endif #endif
/** @}*/ /** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,10 +22,13 @@
#if DEVICE_PORTIN || defined(DOXYGEN_ONLY) #if DEVICE_PORTIN || defined(DOXYGEN_ONLY)
#include "hal/port_api.h" #include "hal/port_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_PortIn PortIn class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A multiple pin digital input /** A multiple pin digital input
* *
@ -51,7 +54,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class PortIn { class PortIn {
public: public:
@ -61,12 +63,7 @@ public:
* @param port Port to connect to (as defined in target's PortNames.h) * @param port Port to connect to (as defined in target's PortNames.h)
* @param mask Bitmask defines which port pins should be an input (0 - ignore, 1 - include) * @param mask Bitmask defines which port pins should be an input (0 - ignore, 1 - include)
*/ */
PortIn(PortName port, int mask = 0xFFFFFFFF) PortIn(PortName port, int mask = 0xFFFFFFFF);
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_INPUT);
core_util_critical_section_exit();
}
/** Read the value input to the port /** Read the value input to the port
* *
@ -82,12 +79,7 @@ public:
* *
* @param mode PullUp, PullDown, PullNone, OpenDrain * @param mode PullUp, PullDown, PullNone, OpenDrain
*/ */
void mode(PinMode mode) void mode(PinMode mode);
{
core_util_critical_section_enter();
port_mode(&_port, mode);
core_util_critical_section_exit();
}
/** A shorthand for read() /** A shorthand for read()
*/ */
@ -100,6 +92,8 @@ private:
port_t _port; port_t _port;
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,15 +22,17 @@
#if DEVICE_PORTINOUT || defined(DOXYGEN_ONLY) #if DEVICE_PORTINOUT || defined(DOXYGEN_ONLY)
#include "hal/port_api.h" #include "hal/port_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_PortInOut PortInOut class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A multiple pin digital in/out used to set/read multiple bi-directional pins /** A multiple pin digital in/out used to set/read multiple bi-directional pins
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class PortInOut { class PortInOut {
public: public:
@ -40,12 +42,7 @@ public:
* @param port Port to connect to (Port0-Port5) * @param port Port to connect to (Port0-Port5)
* @param mask A bitmask to identify which bits in the port should be included (0 - ignore) * @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
*/ */
PortInOut(PortName port, int mask = 0xFFFFFFFF) PortInOut(PortName port, int mask = 0xFFFFFFFF);
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_INPUT);
core_util_critical_section_exit();
}
/** Write the value to the output port /** Write the value to the output port
* *
@ -68,32 +65,17 @@ public:
/** Set as an output /** Set as an output
*/ */
void output() void output();
{
core_util_critical_section_enter();
port_dir(&_port, PIN_OUTPUT);
core_util_critical_section_exit();
}
/** Set as an input /** Set as an input
*/ */
void input() void input();
{
core_util_critical_section_enter();
port_dir(&_port, PIN_INPUT);
core_util_critical_section_exit();
}
/** Set the input pin mode /** Set the input pin mode
* *
* @param mode PullUp, PullDown, PullNone, OpenDrain * @param mode PullUp, PullDown, PullNone, OpenDrain
*/ */
void mode(PinMode mode) void mode(PinMode mode);
{
core_util_critical_section_enter();
port_mode(&_port, mode);
core_util_critical_section_exit();
}
/** A shorthand for write() /** A shorthand for write()
* \sa PortInOut::write() * \sa PortInOut::write()
@ -125,6 +107,8 @@ private:
port_t _port; port_t _port;
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,10 +22,14 @@
#if DEVICE_PORTOUT || defined(DOXYGEN_ONLY) #if DEVICE_PORTOUT || defined(DOXYGEN_ONLY)
#include "hal/port_api.h" #include "hal/port_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_PortOut PortOut class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A multiple pin digital output /** A multiple pin digital output
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
@ -50,7 +54,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class PortOut { class PortOut {
public: public:
@ -60,12 +63,7 @@ public:
* @param port Port to connect to (as defined in target's PortNames.h) * @param port Port to connect to (as defined in target's PortNames.h)
* @param mask Bitmask defines which port pins are an output (0 - ignore, 1 - include) * @param mask Bitmask defines which port pins are an output (0 - ignore, 1 - include)
*/ */
PortOut(PortName port, int mask = 0xFFFFFFFF) PortOut(PortName port, int mask = 0xFFFFFFFF);
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_OUTPUT);
core_util_critical_section_exit();
}
/** Write the value to the output port /** Write the value to the output port
* *
@ -116,6 +114,8 @@ private:
port_t _port; port_t _port;
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,11 +21,13 @@
#if DEVICE_PWMOUT || defined(DOXYGEN_ONLY) #if DEVICE_PWMOUT || defined(DOXYGEN_ONLY)
#include "hal/pwmout_api.h" #include "hal/pwmout_api.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_PwmOut PwmOut class
* \ingroup drivers-public-api-gpio
* @{
*/
/** A pulse-width modulation digital output /** A pulse-width modulation digital output
* *
@ -48,7 +50,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class PwmOut { class PwmOut {
@ -58,20 +59,9 @@ public:
* *
* @param pin PwmOut pin to connect to * @param pin PwmOut pin to connect to
*/ */
PwmOut(PinName pin) : _deep_sleep_locked(false) PwmOut(PinName pin);
{
core_util_critical_section_enter();
pwmout_init(&_pwm, pin);
core_util_critical_section_exit();
}
~PwmOut() ~PwmOut();
{
core_util_critical_section_enter();
pwmout_free(&_pwm);
unlock_deep_sleep();
core_util_critical_section_exit();
}
/** Set the output duty-cycle, specified as a percentage (float) /** Set the output duty-cycle, specified as a percentage (float)
* *
@ -80,13 +70,7 @@ public:
* 0.0f (representing on 0%) and 1.0f (representing on 100%). * 0.0f (representing on 0%) and 1.0f (representing on 100%).
* Values outside this range will be saturated to 0.0f or 1.0f. * Values outside this range will be saturated to 0.0f or 1.0f.
*/ */
void write(float value) void write(float value);
{
core_util_critical_section_enter();
lock_deep_sleep();
pwmout_write(&_pwm, value);
core_util_critical_section_exit();
}
/** Return the current output duty-cycle setting, measured as a percentage (float) /** Return the current output duty-cycle setting, measured as a percentage (float)
* *
@ -98,13 +82,7 @@ public:
* @note * @note
* This value may not match exactly the value set by a previous write(). * This value may not match exactly the value set by a previous write().
*/ */
float read() float read();
{
core_util_critical_section_enter();
float val = pwmout_read(&_pwm);
core_util_critical_section_exit();
return val;
}
/** Set the PWM period, specified in seconds (float), keeping the duty cycle the same. /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
* *
@ -113,62 +91,32 @@ public:
* The resolution is currently in microseconds; periods smaller than this * The resolution is currently in microseconds; periods smaller than this
* will be set to zero. * will be set to zero.
*/ */
void period(float seconds) void period(float seconds);
{
core_util_critical_section_enter();
pwmout_period(&_pwm, seconds);
core_util_critical_section_exit();
}
/** Set the PWM period, specified in milliseconds (int), keeping the duty cycle the same. /** Set the PWM period, specified in milliseconds (int), keeping the duty cycle the same.
* @param ms Change the period of a PWM signal in milliseconds without modifying the duty cycle * @param ms Change the period of a PWM signal in milliseconds without modifying the duty cycle
*/ */
void period_ms(int ms) void period_ms(int ms);
{
core_util_critical_section_enter();
pwmout_period_ms(&_pwm, ms);
core_util_critical_section_exit();
}
/** Set the PWM period, specified in microseconds (int), keeping the duty cycle the same. /** Set the PWM period, specified in microseconds (int), keeping the duty cycle the same.
* @param us Change the period of a PWM signal in microseconds without modifying the duty cycle * @param us Change the period of a PWM signal in microseconds without modifying the duty cycle
*/ */
void period_us(int us) void period_us(int us);
{
core_util_critical_section_enter();
pwmout_period_us(&_pwm, us);
core_util_critical_section_exit();
}
/** Set the PWM pulsewidth, specified in seconds (float), keeping the period the same. /** Set the PWM pulsewidth, specified in seconds (float), keeping the period the same.
* @param seconds Change the pulse width of a PWM signal specified in seconds (float) * @param seconds Change the pulse width of a PWM signal specified in seconds (float)
*/ */
void pulsewidth(float seconds) void pulsewidth(float seconds);
{
core_util_critical_section_enter();
pwmout_pulsewidth(&_pwm, seconds);
core_util_critical_section_exit();
}
/** Set the PWM pulsewidth, specified in milliseconds (int), keeping the period the same. /** Set the PWM pulsewidth, specified in milliseconds (int), keeping the period the same.
* @param ms Change the pulse width of a PWM signal specified in milliseconds * @param ms Change the pulse width of a PWM signal specified in milliseconds
*/ */
void pulsewidth_ms(int ms) void pulsewidth_ms(int ms);
{
core_util_critical_section_enter();
pwmout_pulsewidth_ms(&_pwm, ms);
core_util_critical_section_exit();
}
/** Set the PWM pulsewidth, specified in microseconds (int), keeping the period the same. /** Set the PWM pulsewidth, specified in microseconds (int), keeping the period the same.
* @param us Change the pulse width of a PWM signal specified in microseconds * @param us Change the pulse width of a PWM signal specified in microseconds
*/ */
void pulsewidth_us(int us) void pulsewidth_us(int us);
{
core_util_critical_section_enter();
pwmout_pulsewidth_us(&_pwm, us);
core_util_critical_section_exit();
}
/** A operator shorthand for write() /** A operator shorthand for write()
* \sa PwmOut::write() * \sa PwmOut::write()
@ -202,28 +150,18 @@ public:
#if !(DOXYGEN_ONLY) #if !(DOXYGEN_ONLY)
protected: protected:
/** Lock deep sleep only if it is not yet locked */ /** Lock deep sleep only if it is not yet locked */
void lock_deep_sleep() void lock_deep_sleep();
{
if (_deep_sleep_locked == false) {
sleep_manager_lock_deep_sleep();
_deep_sleep_locked = true;
}
}
/** Unlock deep sleep in case it is locked */ /** Unlock deep sleep in case it is locked */
void unlock_deep_sleep() void unlock_deep_sleep();
{
if (_deep_sleep_locked == true) {
sleep_manager_unlock_deep_sleep();
_deep_sleep_locked = false;
}
}
pwmout_t _pwm; pwmout_t _pwm;
bool _deep_sleep_locked; bool _deep_sleep_locked;
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -29,8 +29,15 @@
#define ONE_MHZ 1000000 #define ONE_MHZ 1000000
namespace mbed { namespace mbed {
/** \defgroup drivers-public-api-spi SPI
* \ingroup drivers-public-api
*/
/** \addtogroup drivers */ /**
* \defgroup drivers_QSPI QSPI class
* \ingroup drivers-public-api-spi
* @{
*/
/** A QSPI Driver, used for communicating with QSPI slave devices /** A QSPI Driver, used for communicating with QSPI slave devices
* *
@ -69,7 +76,6 @@ namespace mbed {
* *
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class QSPI : private NonCopyable<QSPI> { class QSPI : private NonCopyable<QSPI> {
@ -225,6 +231,8 @@ private:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,14 +21,21 @@
#if DEVICE_SERIAL || defined(DOXYGEN_ONLY) #if DEVICE_SERIAL || defined(DOXYGEN_ONLY)
#include "mbed_toolchain.h" #include "platform/mbed_toolchain.h"
#include "drivers/SerialBase.h" #include "drivers/SerialBase.h"
#include "hal/serial_api.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
#include <cstdarg> #include <cstdarg>
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \defgroup drivers-public-api-uart UART
* \ingroup drivers-public-api
*/
/**
* \defgroup drivers_RawSerial RawSerial class
* \ingroup drivers-public-api-uart
* @{
*/
/** A serial port (UART) for communication with other serial devices /** A serial port (UART) for communication with other serial devices
* This is a variation of the Serial class that doesn't use streams, * This is a variation of the Serial class that doesn't use streams,
@ -51,7 +58,6 @@ namespace mbed {
* pc.putc('A'); * pc.putc('A');
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class RawSerial: public SerialBase, private NonCopyable<RawSerial> { class RawSerial: public SerialBase, private NonCopyable<RawSerial> {
@ -105,6 +111,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -22,14 +22,19 @@
#include "reset_reason_api.h" #include "reset_reason_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup mbed-os-public */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_ResetReason ResetReason class
* @{
*/
/** A platform-independent method of checking the cause of the last system reset. /** A platform-independent method of checking the cause of the last system reset.
* *
* When the system restarts, the reason for the restart is contained in * When the system restarts, the reason for the restart is contained in
* the system registers at boot time in a platform specific manner. * the system registers at boot time in a platform specific manner.
* This API provides a generic method of fetching the reason for the restart. * This API provides a generic method of fetching the reason for the restart.
* *
* @ingroup drivers
*/ */
class ResetReason { class ResetReason {
public: public:
@ -71,6 +76,9 @@ public:
static uint32_t get_raw(); static uint32_t get_raw();
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif // DEVICE_RESET_REASON #endif // DEVICE_RESET_REASON

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2015 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -40,12 +40,16 @@
#include "platform/CThunk.h" #include "platform/CThunk.h"
#include "hal/dma_api.h" #include "hal/dma_api.h"
#include "platform/CircularBuffer.h" #include "platform/CircularBuffer.h"
#include "platform/FunctionPointer.h" #include "platform/Callback.h"
#include "platform/Transaction.h" #include "platform/Transaction.h"
#endif #endif
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_SPI SPI class
* \ingroup drivers-public-api-spi
* @{
*/
struct use_gpio_ssel_t { }; struct use_gpio_ssel_t { };
const use_gpio_ssel_t use_gpio_ssel; const use_gpio_ssel_t use_gpio_ssel;
@ -90,7 +94,6 @@ const use_gpio_ssel_t use_gpio_ssel;
* device.unlock(); * device.unlock();
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class SPI : private NonCopyable<SPI> { class SPI : private NonCopyable<SPI> {
@ -425,6 +428,8 @@ private:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif // DEVICE_SPI || DOXYGEN_ONLY #endif // DEVICE_SPI || DOXYGEN_ONLY

View File

@ -25,7 +25,11 @@
#include "hal/spi_api.h" #include "hal/spi_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_SPISlave SPISlave class
* \ingroup drivers-public-api-spi
* @{
*/
/** A SPI slave, used for communicating with a SPI master device. /** A SPI slave, used for communicating with a SPI master device.
* *
@ -51,7 +55,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class SPISlave : private NonCopyable<SPISlave> { class SPISlave : private NonCopyable<SPISlave> {
@ -127,6 +130,8 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -22,13 +22,16 @@
#if DEVICE_SERIAL || defined(DOXYGEN_ONLY) #if DEVICE_SERIAL || defined(DOXYGEN_ONLY)
#include "platform/Stream.h" #include "platform/Stream.h"
#include "SerialBase.h" #include "drivers/SerialBase.h"
#include "platform/PlatformMutex.h" #include "platform/PlatformMutex.h"
#include "hal/serial_api.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_Serial Serial class
* \ingroup drivers-public-api-uart
* @{
*/
/** A serial port (UART) for communication with other serial devices /** A serial port (UART) for communication with other serial devices
* *
@ -49,7 +52,6 @@ namespace mbed {
* pc.printf("Hello World\n"); * pc.printf("Hello World\n");
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class Serial : public SerialBase, public Stream, private NonCopyable<Serial> { class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
@ -111,6 +113,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -32,13 +32,16 @@
#endif #endif
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \defgroup drivers_SerialBase SerialBase class
* \ingroup drivers-public-api-uart
* @{
*/
/** A base class for serial port implementations /** A base class for serial port implementations
* Can't be instantiated directly (use Serial or RawSerial) * Can't be instantiated directly (use Serial or RawSerial)
* *
* @note Synchronization level: Set by subclass * @note Synchronization level: Set by subclass
* @ingroup drivers
*/ */
class SerialBase : private NonCopyable<SerialBase> { class SerialBase : private NonCopyable<SerialBase> {
@ -289,6 +292,7 @@ protected:
virtual ~SerialBase(); virtual ~SerialBase();
int _base_getc(); int _base_getc();
int _base_putc(int c); int _base_putc(int c);
#if DEVICE_SERIAL_ASYNCH #if DEVICE_SERIAL_ASYNCH
@ -307,6 +311,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited * Copyright (c) 2017-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,29 +18,26 @@
#ifndef MBED_SERIALWIREOUTPUT_H #ifndef MBED_SERIALWIREOUTPUT_H
#define MBED_SERIALWIREOUTPUT_H #define MBED_SERIALWIREOUTPUT_H
#include "platform/platform.h"
#if defined(DEVICE_ITM) #if defined(DEVICE_ITM)
#include "hal/itm_api.h"
#include "platform/FileHandle.h" #include "platform/FileHandle.h"
namespace mbed { namespace mbed {
/**
* \defgroup drivers_SerialWireOutput SerialWireOutput class
* \ingroup drivers-public-api
* @{
*/
class SerialWireOutput : public FileHandle { class SerialWireOutput : public FileHandle {
public: public:
SerialWireOutput(void) SerialWireOutput(void);
{
/* Initialize ITM using internal init function. */
mbed_itm_init();
}
virtual ssize_t write(const void *buffer, size_t size) virtual ssize_t write(const void *buffer, size_t size);
{
mbed_itm_send_block(ITM_PORT_SWO, buffer, size);
return size;
}
virtual ssize_t read(void *buffer, size_t size) virtual ssize_t read(void *buffer, size_t size)
{ {
@ -72,6 +69,8 @@ public:
} }
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif // DEVICE_ITM #endif // DEVICE_ITM

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -21,12 +21,14 @@
#include "platform/Callback.h" #include "platform/Callback.h"
#include "platform/mbed_toolchain.h" #include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
#include "platform/mbed_power_mgmt.h"
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
#include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_Ticker Ticker class
* \ingroup drivers-public-api-ticker
* @{
*/
/** A Ticker is used to call a function at a recurring interval /** A Ticker is used to call a function at a recurring interval
* *
@ -62,19 +64,14 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class Ticker : public TimerEvent, private NonCopyable<Ticker> { class Ticker : public TimerEvent, private NonCopyable<Ticker> {
public: public:
Ticker() : TimerEvent(), _function(0), _lock_deepsleep(true) Ticker();
{
}
// When low power ticker is in use, then do not disable deep sleep. // When low power ticker is in use, then do not disable deep sleep.
Ticker(const ticker_data_t *data) : TimerEvent(data), _function(0), _lock_deepsleep(!data->interface->runs_in_deep_sleep) Ticker(const ticker_data_t *data);
{
}
/** Attach a function to be called by the Ticker, specifying the interval in seconds /** Attach a function to be called by the Ticker, specifying the interval in seconds
* *
@ -155,6 +152,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -19,10 +19,13 @@
#include "drivers/Ticker.h" #include "drivers/Ticker.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_Timeout Timeout class
* \ingroup drivers-public-api-ticker
* @{
*/
/** A Timeout is used to call a function at a point in the future /** A Timeout is used to call a function at a point in the future
* *
@ -53,7 +56,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class Timeout : public Ticker, private NonCopyable<Timeout> { class Timeout : public Ticker, private NonCopyable<Timeout> {
@ -63,6 +65,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +20,13 @@
#include "platform/platform.h" #include "platform/platform.h"
#include "hal/ticker_api.h" #include "hal/ticker_api.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_Timer Timer class
* \ingroup drivers-public-api-ticker
* @{
*/
/** A general purpose timer /** A general purpose timer
* *
@ -47,7 +50,6 @@ namespace mbed {
* printf("Toggle the led takes %d us", end - begin); * printf("Toggle the led takes %d us", end - begin);
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class Timer : private NonCopyable<Timer> { class Timer : private NonCopyable<Timer> {
@ -108,6 +110,8 @@ protected:
}; };
#endif #endif
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -18,16 +18,18 @@
#define MBED_TIMEREVENT_H #define MBED_TIMEREVENT_H
#include "hal/ticker_api.h" #include "hal/ticker_api.h"
#include "hal/us_ticker_api.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /**
* \addtogroup drivers_TimerEvent TimerEvent class
* \ingroup drivers-public-api-ticker
* @{
*/
/** Base abstraction for timer interrupts /** Base abstraction for timer interrupts
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class TimerEvent : private NonCopyable<TimerEvent> { class TimerEvent : private NonCopyable<TimerEvent> {
public: public:
@ -82,6 +84,8 @@ protected:
#endif #endif
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -23,10 +23,9 @@
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "platform/FileHandle.h" #include "platform/FileHandle.h"
#include "SerialBase.h" #include "drivers/SerialBase.h"
#include "InterruptIn.h" #include "drivers/InterruptIn.h"
#include "platform/PlatformMutex.h" #include "platform/PlatformMutex.h"
#include "hal/serial_api.h"
#include "platform/CircularBuffer.h" #include "platform/CircularBuffer.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
@ -39,12 +38,14 @@
#endif #endif
namespace mbed { namespace mbed {
/**
/** \addtogroup drivers */ * \defgroup drivers_UARTSerial UARTSerial class
* \ingroup drivers-public-api-uart
* @{
*/
/** Class providing buffered UART communication functionality using separate circular buffer for send and receive channels /** Class providing buffered UART communication functionality using separate circular buffer for send and receive channels
* *
* @ingroup drivers
*/ */
class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> { class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> {
@ -312,6 +313,9 @@ private:
void dcd_irq(void); void dcd_irq(void);
}; };
/** @}*/
} //namespace mbed } //namespace mbed
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) #endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)

View File

@ -28,6 +28,17 @@
#include "ByteBuffer.h" #include "ByteBuffer.h"
#include "rtos/EventFlags.h" #include "rtos/EventFlags.h"
/** \defgroup drivers-public-api-usb USB
* \ingroup drivers-public-api
*/
/**
* \defgroup drivers_USBAudio USBAudio class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBAudio example * USBAudio example
* *
@ -373,4 +384,6 @@ private:
}; };
/** @}*/
#endif #endif

View File

@ -27,6 +27,12 @@
class AsyncOp; class AsyncOp;
/**
* \defgroup drivers_USBCDC USBCDC class
* \ingroup drivers-public-api-usb
* @{
*/
class USBCDC: public USBDevice { class USBCDC: public USBDevice {
public: public:
@ -224,4 +230,6 @@ protected:
uint32_t _rx_size; uint32_t _rx_size;
}; };
/** @}*/
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Arm Limited and affiliates. * Copyright (c) 2018-2019, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -38,6 +38,12 @@
#define PACKET_TYPE_BROADCAST (1<<3) #define PACKET_TYPE_BROADCAST (1<<3)
#define PACKET_TYPE_MULTICAST (1<<4) #define PACKET_TYPE_MULTICAST (1<<4)
/**
* \defgroup drivers_USBCDC_ECM USBCDC_ECM class
* \ingroup drivers-public-api-usb
* @{
*/
class USBCDC_ECM: public USBDevice { class USBCDC_ECM: public USBDevice {
public: public:
@ -267,4 +273,6 @@ private:
void _notify_connect(); void _notify_connect();
}; };
/** @}*/
#endif #endif

View File

@ -25,7 +25,11 @@
#include "USBHID_Types.h" #include "USBHID_Types.h"
#include "OperationList.h" #include "OperationList.h"
/**
* \defgroup drivers_USBHID USBHID class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBHID example * USBHID example
@ -268,4 +272,6 @@ private:
}; };
/** @}*/
#endif #endif

View File

@ -74,6 +74,12 @@ enum FUNCTION_KEY {
UP_ARROW, /* Up arrow */ UP_ARROW, /* Up arrow */
}; };
/**
* \defgroup drivers_USBKeyboard USBKeyboard class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBKeyboard example * USBKeyboard example
* @code * @code
@ -181,7 +187,7 @@ public:
virtual void report_rx(); virtual void report_rx();
/** /**
* Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important: * Read status of lock keys. Useful to switch-on/off LEDs according to key pressed. Only the first three bits of the result is important:
* - First bit: NUM_LOCK * - First bit: NUM_LOCK
* - Second bit: CAPS_LOCK * - Second bit: CAPS_LOCK
* - Third bit: SCROLL_LOCK * - Third bit: SCROLL_LOCK
@ -209,4 +215,6 @@ private:
}; };
/** @}*/
#endif #endif

View File

@ -30,6 +30,12 @@
#define DEFAULT_CONFIGURATION (1) #define DEFAULT_CONFIGURATION (1)
/**
* \defgroup drivers_USBMIDI USBMIDI class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBMIDI example * USBMIDI example
* *
@ -182,4 +188,6 @@ private:
bool _next_message(); bool _next_message();
}; };
/** @}*/
#endif #endif

View File

@ -22,19 +22,25 @@
#include "USBDescriptor.h" #include "USBDescriptor.h"
#include "USBDevice_Types.h" #include "USBDevice_Types.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "events/PolledQueue.h" #include "drivers/internal/PolledQueue.h"
#include "events/Task.h" #include "drivers/internal/Task.h"
#include "BlockDevice.h" #include "BlockDevice.h"
#include "Mutex.h" #include "Mutex.h"
#include "USBDevice.h" #include "USBDevice.h"
/**
* \defgroup drivers_USBMSD USBMSD class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBMSD class: generic class in order to use all kinds of blocks storage chip * USBMSD class: generic class in order to use all kinds of blocks storage chip
* *
* Introduction * Introduction
* *
* USBMSD implements the MSD protocol. It permits to access a block device (flash, sdcard,...) * USBMSD implements the MSD protocol. It permits to access a block device (flash, SD Card,...)
* from a computer over USB. * from a computer over USB.
* *
* @code * @code
@ -304,4 +310,6 @@ private:
void fail(); void fail();
}; };
/** @}*/
#endif #endif

View File

@ -49,6 +49,12 @@ enum MOUSE_TYPE {
REL_MOUSE, REL_MOUSE,
}; };
/**
* \defgroup drivers_USBMouse USBMouse class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* *
* USBMouse example * USBMouse example
@ -232,4 +238,6 @@ private:
bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z); bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z);
}; };
/** @}*/
#endif #endif

View File

@ -28,6 +28,12 @@
#include "USBHID.h" #include "USBHID.h"
#include "PlatformMutex.h" #include "PlatformMutex.h"
/**
* \defgroup drivers_USBMouseKeyboard USBMouseKeyboard class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBMouseKeyboard example * USBMouseKeyboard example
* @code * @code
@ -207,7 +213,7 @@ public:
bool media_control(MEDIA_KEY key); bool media_control(MEDIA_KEY key);
/** /**
* Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important: * Read status of lock keys. Useful to switch-on/off LEDs according to key pressed. Only the first three bits of the result is important:
* - First bit: NUM_LOCK * - First bit: NUM_LOCK
* - Second bit: CAPS_LOCK * - Second bit: CAPS_LOCK
* - Third bit: SCROLL_LOCK * - Third bit: SCROLL_LOCK
@ -243,4 +249,6 @@ private:
virtual int _getc(); virtual int _getc();
}; };
/** @}*/
#endif #endif

View File

@ -22,6 +22,12 @@
#include "Stream.h" #include "Stream.h"
#include "Callback.h" #include "Callback.h"
/**
* \defgroup drivers_USBSerial USBSerial class
* \ingroup drivers-public-api-usb
* @{
*/
/** /**
* USBSerial example * USBSerial example
* *
@ -216,4 +222,6 @@ private:
void (*_settings_changed_callback)(int baud, int bits, int parity, int stop); void (*_settings_changed_callback)(int baud, int bits, int parity, int stop);
}; };
/** @}*/
#endif #endif

View File

@ -28,8 +28,12 @@
#include <cstdio> #include <cstdio>
namespace mbed { namespace mbed {
/**
* \defgroup drivers_Watchdog Watchdog class
* \ingroup drivers-public-api
* @{
*/
/** \addtogroup drivers */
/** A hardware watchdog timer that resets the system in the case of system /** A hardware watchdog timer that resets the system in the case of system
* failures or malfunctions. If you fail to refresh the Watchdog timer periodically, * failures or malfunctions. If you fail to refresh the Watchdog timer periodically,
* it resets the system after a set period of time. * it resets the system after a set period of time.
@ -56,7 +60,6 @@ namespace mbed {
* @endcode * @endcode
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
* @ingroup drivers
*/ */
class Watchdog : private NonCopyable<Watchdog> { class Watchdog : private NonCopyable<Watchdog> {
public: public:
@ -149,6 +152,8 @@ private:
bool _running; bool _running;
}; };
/** @}*/
} // namespace mbed } // namespace mbed
#endif // DEVICE_WATCHDOG #endif // DEVICE_WATCHDOG

View File

@ -25,6 +25,21 @@
#include "LinkEntry.h" #include "LinkEntry.h"
#include "OperationListBase.h" #include "OperationListBase.h"
/** \defgroup mbed-os-internal Internal API */
/** \addtogroup drivers-internal-api Drivers
* \ingroup mbed-os-internal
*/
/** \defgroup drivers-internal-api-usb USB
* \ingroup drivers-internal-api
*/
/**
* \defgroup drivers_AsyncOp AsyncOp class
* \ingroup drivers-internal-api-usb
* @{
*/
class AsyncOp: public LinkEntry { class AsyncOp: public LinkEntry {
public: public:
@ -109,4 +124,6 @@ private:
static void _host_unlock(rtos::Mutex *host_mutex); static void _host_unlock(rtos::Mutex *host_mutex);
}; };
/** @}*/
#endif #endif

View File

@ -20,6 +20,11 @@
#include <stdint.h> #include <stdint.h>
/**
* \defgroup drivers_ByteBuffer ByteBuffer class
* \ingroup drivers-internal-api-usb
* @{
*/
class ByteBuffer { class ByteBuffer {
public: public:
@ -116,5 +121,6 @@ private:
uint8_t *_buf; uint8_t *_buf;
}; };
/** @}*/
#endif #endif

View File

@ -20,6 +20,12 @@
#include "USBPhy.h" #include "USBPhy.h"
/**
* \defgroup drivers_EndpointResolver EndpointResolver class
* \ingroup drivers-internal-api-usb
* @{
*/
/** /**
* Utility class for resolving endpoints * Utility class for resolving endpoints
* *
@ -29,7 +35,6 @@
* to check if the device has enough resources for the * to check if the device has enough resources for the
* given configuration. * given configuration.
* *
* @ingroup usb_device_core
*/ */
class EndpointResolver { class EndpointResolver {
public: public:
@ -89,5 +94,6 @@ private:
bool _valid; bool _valid;
}; };
/** @}*/
#endif #endif

View File

@ -20,6 +20,11 @@
#include <cstddef> #include <cstddef>
/**
* \defgroup drivers_LinkEntry LinkEntry class
* \ingroup drivers-internal-api-usb
* @{
*/
class LinkEntry { class LinkEntry {
public: public:
LinkEntry(): _next(NULL) LinkEntry(): _next(NULL)
@ -32,5 +37,6 @@ private:
LinkEntry *_next; LinkEntry *_next;
}; };
/** @}*/
#endif #endif

View File

@ -21,6 +21,11 @@
#include "LinkEntry.h" #include "LinkEntry.h"
#include "LinkedListBase.h" #include "LinkedListBase.h"
/**
* \defgroup drivers_LinkedList LinkedList class
* \ingroup drivers-internal-api-usb
* @{
*/
template<class T> template<class T>
class LinkedList: public LinkedListBase { class LinkedList: public LinkedListBase {
public: public:
@ -58,4 +63,6 @@ public:
} }
}; };
/** @}*/
#endif #endif

View File

@ -20,6 +20,11 @@
#include "LinkEntry.h" #include "LinkEntry.h"
/**
* \defgroup drivers_LinkedListBase LinkedListBase class
* \ingroup drivers-internal-api-usb
* @{
*/
class LinkedListBase { class LinkedListBase {
public: public:
LinkedListBase(); LinkedListBase();
@ -58,4 +63,6 @@ private:
LinkEntry *_tail; LinkEntry *_tail;
}; };
/** @}*/
#endif #endif

View File

@ -40,6 +40,13 @@
#define CABLE_NUM (0<<4) #define CABLE_NUM (0<<4)
/**
* \defgroup drivers_MIDIMessage MIDIMessage class
* \ingroup drivers-internal-usb
* @{
*/
/** A MIDI message container */ /** A MIDI message container */
class MIDIMessage { class MIDIMessage {
public: public:
@ -472,4 +479,6 @@ public:
uint16_t length; uint16_t length;
}; };
/** @}*/
#endif #endif

View File

@ -21,6 +21,11 @@
#include "OperationListBase.h" #include "OperationListBase.h"
#include "AsyncOp.h" #include "AsyncOp.h"
/**
* \defgroup drivers_OperationList OperationList class
* \ingroup drivers-internal-api-usb
* @{
*/
template<class T> template<class T>
class OperationList: public OperationListBase { class OperationList: public OperationListBase {
public: public:
@ -75,7 +80,7 @@ public:
* Additionally process() must be called on this object * Additionally process() must be called on this object
* if there are still elements in the list. * if there are still elements in the list.
* *
* @return The async op at the head of the list * @return The asynchronous op at the head of the list
*/ */
T *dequeue_raw() T *dequeue_raw()
{ {
@ -84,4 +89,6 @@ public:
}; };
/** @}*/
#endif #endif

View File

@ -18,11 +18,15 @@
#ifndef MBED_OPERATION_LIST_BASE_H #ifndef MBED_OPERATION_LIST_BASE_H
#define MBED_OPERATION_LIST_BASE_H #define MBED_OPERATION_LIST_BASE_H
#include "LinkedListBase.h" #include "drivers/internal/LinkedListBase.h"
#include "Mutex.h"
class AsyncOp; class AsyncOp;
/**
* \defgroup drivers_OperationListBase OperationListBase class
* \ingroup drivers-internal-api-usb
* @{
*/
class OperationListBase { class OperationListBase {
public: public:
@ -72,7 +76,7 @@ public:
* Additionally process() must be called on this object * Additionally process() must be called on this object
* if there are still elements in the list. * if there are still elements in the list.
* *
* @return The async op at the head of the list * @return The asynchronous op at the head of the list
*/ */
AsyncOp *dequeue_raw(); AsyncOp *dequeue_raw();
@ -94,4 +98,6 @@ private:
LinkedListBase _list; LinkedListBase _list;
}; };
/** @}*/
#endif #endif

View File

@ -18,18 +18,20 @@
#ifndef POLLED_QUEUE_H #ifndef POLLED_QUEUE_H
#define POLLED_QUEUE_H #define POLLED_QUEUE_H
#include "events/TaskQueue.h" #include "drivers/internal/TaskQueue.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "LinkedList.h" #include "LinkedList.h"
namespace events { namespace events {
/** \addtogroup events */ /**
* \defgroup drivers_PolledQueue PolledQueue class
* \ingroup drivers-internal-api-usb
* @{
*/
/** PolledQueue /** PolledQueue
* *
* This class is an implementation of TaskQueue which is * This class is an implementation of TaskQueue which is
* processed synchronously by calls to dispatch. * processed synchronously by calls to dispatch.
* @ingroup events
*/ */
class PolledQueue: public TaskQueue { class PolledQueue: public TaskQueue {
public: public:
@ -67,6 +69,7 @@ protected:
}; };
/** @}*/
} }
#endif #endif

View File

@ -21,8 +21,10 @@
#include <stdint.h> #include <stdint.h>
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \addtogroup drivers-internal-api
/** @{*/ * \ingroup mbed-os-internal
* @{
*/
#define MBED_CRC_TABLE_SIZE 256 #define MBED_CRC_TABLE_SIZE 256
#define MBED_OPTIMIZED_CRC_TABLE_SIZE 16 #define MBED_OPTIMIZED_CRC_TABLE_SIZE 16
@ -35,6 +37,7 @@ extern const uint32_t Table_CRC_32bit_ANSI[MBED_CRC_TABLE_SIZE];
extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE]; extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE];
/** @}*/ /** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -19,12 +19,14 @@
#define MBED_TASK_H #define MBED_TASK_H
#include "events/EventQueue.h" #include "events/EventQueue.h"
#include "events/TaskBase.h" #include "drivers/internal/TaskBase.h"
#include "platform/mbed_assert.h" #include "platform/mbed_assert.h"
#include "platform/Callback.h" #include "platform/Callback.h"
namespace events { namespace events {
/** \addtogroup events */ /** \addtogroup drivers-internal-api-usb
* @{
*/
template<typename F, typename A1 = void, typename A2 = void, typename A3 = void, typename A4 = void, typename A5 = void> template<typename F, typename A1 = void, typename A2 = void, typename A3 = void, typename A4 = void, typename A5 = void>
@ -583,7 +585,6 @@ private:
/** Task /** Task
* *
* Representation of a postable task * Representation of a postable task
* @ingroup events
*/ */
template <typename R, typename A0, typename A1> template <typename R, typename A0, typename A1>
class Task<R(A0, A1)>: public TaskBase { class Task<R(A0, A1)>: public TaskBase {
@ -647,8 +648,8 @@ private:
All _args; All _args;
}; };
}
/** @}*/ /** @}*/
}
#endif #endif

View File

@ -27,15 +27,18 @@ class Semaphore;
} }
namespace events { namespace events {
/** \addtogroup events */
class TaskQueue; class TaskQueue;
/**
* \defgroup drivers_TaskBase TaskBase class
* \ingroup drivers-internal-api-usb
* @{
*/
/** TaskBase /** TaskBase
* *
* Representation of a caller allocated task * Representation of a caller allocated task
* @ingroup events
*/ */
class TaskBase : public LinkEntry { class TaskBase : public LinkEntry {
public: public:
@ -158,8 +161,8 @@ private:
void _wake_check(); void _wake_check();
}; };
/** @}*/
} }
#endif #endif
/** @}*/

View File

@ -18,21 +18,23 @@
#ifndef TASK_QUEUE_H #ifndef TASK_QUEUE_H
#define TASK_QUEUE_H #define TASK_QUEUE_H
#include "events/TaskBase.h" #include "drivers/internal/TaskBase.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "mbed_critical.h" #include "mbed_critical.h"
#define MBED_MAX_TASK_SIZE 32 #define MBED_MAX_TASK_SIZE 32
namespace events { namespace events {
/** \addtogroup events */
/**
* \defgroup drivers_TaskQueue TaskQueue class
* \ingroup drivers-internal-api-usb
* @{
*/
/** TaskQueue /** TaskQueue
* *
* Flexible task queue for dispatching tasks * Flexible task queue for dispatching tasks
* @ingroup events
*/ */
class TaskQueue { class TaskQueue {
public: public:
@ -67,7 +69,7 @@ public:
* *
* Cancels the given event so the event's memory can be reused. * Cancels the given event so the event's memory can be reused.
* *
* The cancel function is irq safe. * The cancel function is IRQ safe.
* *
* If called while the event queue's dispatch loop is active, the cancel * If called while the event queue's dispatch loop is active, the cancel
* function does not guarantee that the event will not execute after it * function does not guarantee that the event will not execute after it
@ -134,6 +136,7 @@ protected:
} }
}; };
/** @}*/
} }
#endif #endif

View File

@ -24,22 +24,15 @@
#include "mbed_critical.h" #include "mbed_critical.h"
/** /**
* \defgroup usb_device USB Device * \defgroup drivers_USBDevice USBDevice class
* * \ingroup drivers-internal-api-usb
*/ * @{
/**
* \defgroup usb_device_core Core
*
* @ingroup usb_device
*/ */
/** /**
* Core USB Device driver * Core USB Device driver
* *
* USB driver which wraps and provides synchronization for a USBPhy object. * USB driver which wraps and provides synchronization for a USBPhy object.
*
* @ingroup usb_device_core
*/ */
class USBDevice: public USBPhyEvents { class USBDevice: public USBPhyEvents {
public: public:
@ -189,13 +182,13 @@ public:
void endpoint_stall(usb_ep_t endpoint); void endpoint_stall(usb_ep_t endpoint);
/** /**
* Unstall an endpoint * Un-stall an endpoint
* *
* Unstalling an endpoint resets data toggle back to DATA0. * Un-stalling an endpoint resets data toggle back to DATA0.
* Additionally, if there is an ongoing transfer on this endpoint * Additionally, if there is an ongoing transfer on this endpoint
* it will be aborted. * it will be aborted.
* *
* @param endpoint Endpoint to unstall * @param endpoint Endpoint to un-stall
* @note This endpoint must already have been setup with endpoint_add * @note This endpoint must already have been setup with endpoint_add
*/ */
void endpoint_unstall(usb_ep_t endpoint); void endpoint_unstall(usb_ep_t endpoint);
@ -617,4 +610,6 @@ private:
uint32_t _locked; uint32_t _locked;
}; };
/** @}*/
#endif #endif

View File

@ -0,0 +1,51 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/AnalogIn.h"
#if DEVICE_ANALOGIN
namespace mbed {
SingletonPtr<PlatformMutex> AnalogIn::_mutex;
AnalogIn::AnalogIn(PinName pin)
{
lock();
analogin_init(&_adc, pin);
unlock();
}
float AnalogIn::read()
{
lock();
float ret = analogin_read(&_adc);
unlock();
return ret;
}
unsigned short AnalogIn::read_u16()
{
lock();
unsigned short ret = analogin_read_u16(&_adc);
unlock();
return ret;
}
} // namespace mbed
#endif

View File

@ -0,0 +1,48 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/AnalogOut.h"
#if DEVICE_ANALOGOUT
namespace mbed {
void AnalogOut::write(float value)
{
lock();
analogout_write(&_dac, value);
unlock();
}
void AnalogOut::write_u16(unsigned short value)
{
lock();
analogout_write_u16(&_dac, value);
unlock();
}
float AnalogOut::read()
{
lock();
float ret = analogout_read(&_dac);
unlock();
return ret;
}
} // namespace mbed
#endif // DEVICE_ANALOGOUT

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -15,14 +15,17 @@
* limitations under the License. * limitations under the License.
*/ */
#include "drivers/AnalogIn.h" #include "drivers/DigitalIn.h"
#if DEVICE_ANALOGIN #include "platform/mbed_critical.h"
namespace mbed { namespace mbed {
SingletonPtr<PlatformMutex> AnalogIn::_mutex; void DigitalIn::mode(PinMode pull)
{
core_util_critical_section_enter();
gpio_mode(&gpio, pull);
core_util_critical_section_exit();
}
}; } // namespace mbed
#endif

View File

@ -0,0 +1,53 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/DigitalInOut.h"
#include "platform/mbed_critical.h"
namespace mbed {
void DigitalInOut::output()
{
core_util_critical_section_enter();
gpio_dir(&gpio, PIN_OUTPUT);
core_util_critical_section_exit();
}
void DigitalInOut::input()
{
core_util_critical_section_enter();
gpio_dir(&gpio, PIN_INPUT);
core_util_critical_section_exit();
}
void DigitalInOut::mode(PinMode pull)
{
core_util_critical_section_enter();
gpio_mode(&gpio, pull);
core_util_critical_section_exit();
}
DigitalInOut &DigitalInOut::operator= (DigitalInOut &rhs)
{
core_util_critical_section_enter();
write(rhs.read());
core_util_critical_section_exit();
return *this;
}
} // namespace mbed

View File

@ -0,0 +1,32 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/DigitalOut.h"
#include "platform/mbed_critical.h"
namespace mbed {
DigitalOut &DigitalOut::operator= (DigitalOut &rhs)
{
core_util_critical_section_enter();
write(rhs.read());
core_util_critical_section_exit();
return *this;
}
} // namespace mbed

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2017 ARM Limited * Copyright (c) 2017-2019 ARM Limited
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2015 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited * Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -16,12 +16,9 @@
*/ */
#include <stddef.h> #include <stddef.h>
#include "drivers/TableCRC.h"
#include "drivers/MbedCRC.h" #include "drivers/MbedCRC.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */
/** @{*/
SingletonPtr<PlatformMutex> mbed_crc_mutex; SingletonPtr<PlatformMutex> mbed_crc_mutex;
@ -75,6 +72,4 @@ MbedCRC<POLY_8BIT_CCITT, 8>::MbedCRC():
mbed_crc_ctor(); mbed_crc_ctor();
} }
/** @}*/
} // namespace mbed } // namespace mbed

43
drivers/source/PortIn.cpp Normal file
View File

@ -0,0 +1,43 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/PortIn.h"
#if DEVICE_PORTIN
#include "platform/mbed_critical.h"
namespace mbed {
PortIn::PortIn(PortName port, int mask)
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_INPUT);
core_util_critical_section_exit();
}
void PortIn::mode(PinMode mode)
{
core_util_critical_section_enter();
port_mode(&_port, mode);
core_util_critical_section_exit();
}
} // namespace mbed
#endif // #if DEVICE_PORTIN

View File

@ -0,0 +1,57 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "drivers/PortInOut.h"
#if DEVICE_PORTINOUT
#include "platform/mbed_critical.h"
namespace mbed {
PortInOut::PortInOut(PortName port, int mask)
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_INPUT);
core_util_critical_section_exit();
}
void PortInOut::output()
{
core_util_critical_section_enter();
port_dir(&_port, PIN_OUTPUT);
core_util_critical_section_exit();
}
void PortInOut::input()
{
core_util_critical_section_enter();
port_dir(&_port, PIN_INPUT);
core_util_critical_section_exit();
}
void PortInOut::mode(PinMode mode)
{
core_util_critical_section_enter();
port_mode(&_port, mode);
core_util_critical_section_exit();
}
} // namespace mbed
#endif // #if DEVICE_PORTINOUT

Some files were not shown because too many files have changed in this diff Show More