Drivers/Events/RTOS Public and internal APIs cleanup (#10955)

Separate drivers, events, and rtos internal APIs from public APIs.

* Move source files to source subdirs
* Move internal headers to internal subdirs
* Add Doxygen comments for documenting internal and public APIs
* Remove source code from header files in order to remove include pre-processor directives
that included header files not directly used by said header files
* Explicitly include header files instead of implicit inclusions via third-party header files.

Release Notes

This will break user code that was using an internal API as the internal header files have been moved.
This will only break if the user was including the header file using a namespace (i.e #include "foo/bar.h" instead of #include "bar.h"
pull/11073/head
Hugues Kamba 2019-07-11 16:23:39 +01:00 committed by Evelyne Donnaes
parent 818c1d6f0f
commit bfa1b4dd84
129 changed files with 1203 additions and 523 deletions

View File

@ -227,9 +227,9 @@ matrix:
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

@ -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

@ -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

@ -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,13 @@
#include "platform/PlatformMutex.h" #include "platform/PlatformMutex.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api Public API */
/** @{*/
/**
* \defgroup drivers_AnalogIn AnalogIn class
* @{
*/
/** An analog input, used for reading the voltage on a pin /** An analog input, used for reading the voltage on a pin
* *
@ -48,7 +54,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class AnalogIn { class AnalogIn {
@ -58,37 +63,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 +117,12 @@ 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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_AnalogOut AnalogOut class
* @{
*/
/** 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,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -23,12 +23,17 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusIn BusIn class
* @{
*/
/** A digital input bus, used for reading the state of a collection of pins /** 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 +130,9 @@ private:
#endif #endif
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -22,7 +22,13 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusInOut BusInOut class
* @{
*/
/** A digital input output bus, used for setting the state of a collection of pins. /** 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 +36,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 +152,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -22,10 +22,15 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusOut BusOut class
* @{
*/
/** A digital output bus, used for setting the state of a collection of pins /** 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 +130,9 @@ 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,17 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_CANMessage CANMessage class
* @{
*/
/** 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 +103,14 @@ public:
} }
}; };
/** @}*/
/**
* \defgroup drivers_CAN CAN class
* @{
*/
/** 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 +326,16 @@ 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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_DigitalIn DigitalIn class
* @{
*/
/** A digital input, used for reading the state of a pin /** A digital input, used for reading the state of a pin
* *
@ -47,7 +52,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class DigitalIn { class DigitalIn {
@ -72,6 +76,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 +93,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 +127,9 @@ 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,19 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_DigitalInOut DigitalInOut class
* @{
*/
/** 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 +85,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 +130,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 +154,9 @@ 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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_DigitalOut DigitalOut class
* @{
*/
/** A digital output, used for setting the state of a pin /** A digital output, used for setting the state of a pin
* *
@ -42,7 +47,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class DigitalOut { class DigitalOut {
@ -122,13 +126,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 +148,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -23,7 +23,13 @@
#if DEVICE_ETHERNET || defined(DOXYGEN_ONLY) #if DEVICE_ETHERNET || defined(DOXYGEN_ONLY)
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \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.
* *
@ -54,9 +60,13 @@ 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:
@ -170,6 +180,9 @@ public:
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 drivers */
/** \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,17 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_I2C I2C class
* @{
*/
/** An I2C Master, used for communicating with I2C slave devices /** An I2C Master, used for communicating with I2C slave devices
* *
@ -70,7 +76,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class I2C : private NonCopyable<I2C> { class I2C : private NonCopyable<I2C> {
@ -242,6 +247,9 @@ 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,13 @@
#include "hal/i2c_api.h" #include "hal/i2c_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_I2CSlave I2CSlave class
* @{
*/
/** An I2C Slave, used for communicating with an I2C Master device. /** An I2C Slave, used for communicating with an I2C Master device.
* *
@ -64,7 +70,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class I2CSlave { class I2CSlave {
@ -160,6 +165,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -29,7 +29,13 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_InterruptIn InterruptIn class
* @{
*/
/** 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 +63,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class InterruptIn : private NonCopyable<InterruptIn> { class InterruptIn : private NonCopyable<InterruptIn> {
@ -175,6 +180,9 @@ protected:
#endif #endif
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -24,7 +24,13 @@
#include <string.h> #include <string.h>
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_InterruptManager InterruptManager class
* @{
*/
/** 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 +60,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 +175,7 @@ public:
#if !defined(DOXYGEN_ONLY) #if !defined(DOXYGEN_ONLY)
private: private:
InterruptManager(); InterruptManager();
~InterruptManager(); ~InterruptManager();
void lock(); void lock();
@ -203,6 +209,9 @@ private:
#endif #endif
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -26,12 +26,17 @@
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_LowPowerTicker LowPowerTicker class
* @{
*/
/** 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 +50,9 @@ public:
} }
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -26,12 +26,17 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_LowPowerTimeout LowPowerTimeout class
* @{
*/
/** 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 +48,10 @@ private:
#endif #endif
}; };
} /** @}*/
/** @}*/
} // namespace mbed
#endif #endif

View File

@ -26,12 +26,17 @@
#include "hal/lp_ticker_api.h" #include "hal/lp_ticker_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_LowPowerTimer LowPowerTimer class
* @{
*/
/** 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 +47,9 @@ 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 drivers */
/** \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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PortIn PortIn class
* @{
*/
/** A multiple pin digital input /** A multiple pin digital input
* *
@ -51,7 +56,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class PortIn { class PortIn {
public: public:
@ -61,12 +65,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 +81,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 +94,9 @@ 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,19 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PortInOut PortInOut class
* @{
*/
/** 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 +44,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 +67,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 +109,9 @@ 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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PortOut PortOut class
* @{
*/
/** A multiple pin digital output /** A multiple pin digital output
* *
* @note Synchronization level: Interrupt safe * @note Synchronization level: Interrupt safe
@ -50,7 +55,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class PortOut { class PortOut {
public: public:
@ -60,12 +64,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 +115,9 @@ 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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PwmOut PwmOut class
* @{
*/
/** A pulse-width modulation digital output /** A pulse-width modulation digital output
* *
@ -48,7 +52,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class PwmOut { class PwmOut {
@ -58,20 +61,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 +72,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 +84,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 +93,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 +152,19 @@ 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

@ -30,7 +30,13 @@
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_QSPI QSPI class
* @{
*/
/** A QSPI Driver, used for communicating with QSPI slave devices /** A QSPI Driver, used for communicating with QSPI slave devices
* *
@ -69,7 +75,6 @@ namespace mbed {
* *
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class QSPI : private NonCopyable<QSPI> { class QSPI : private NonCopyable<QSPI> {
@ -225,6 +230,9 @@ 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");
@ -23,12 +23,17 @@
#include "mbed_toolchain.h" #include "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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_RawSerial RawSerial class
* @{
*/
/** 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 +56,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 +109,9 @@ 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 drivers */
/** \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,18 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_SPI SPI class
* @{
*/
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 +96,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 +430,9 @@ 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,13 @@
#include "hal/spi_api.h" #include "hal/spi_api.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_SPISlave SPISlave class
* @{
*/
/** A SPI slave, used for communicating with a SPI master device. /** A SPI slave, used for communicating with a SPI master device.
* *
@ -51,7 +57,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class SPISlave : private NonCopyable<SPISlave> { class SPISlave : private NonCopyable<SPISlave> {
@ -127,6 +132,9 @@ 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,18 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Serial Serial class
* @{
*/
/** A serial port (UART) for communication with other serial devices /** A serial port (UART) for communication with other serial devices
* *
@ -49,7 +54,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 +115,9 @@ protected:
#endif #endif
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif #endif

View File

@ -32,13 +32,19 @@
#endif #endif
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \defgroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_SerialBase SerialBase class
* @{
*/
/** 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 +295,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 +314,9 @@ 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,28 @@
#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 {
/** \ingroup drivers */
/** \addtogroup drivers-public-api Public API */
/** @{*/
/**
* \defgroup drivers_SerialWireOutput SerialWireOutput class
* @{
*/
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 +71,9 @@ 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,16 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Ticker Ticker class
* @{
*/
/** 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 +66,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 +154,9 @@ 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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Timeout Timeout class
* @{
*/
/** 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 +58,6 @@ namespace mbed {
* } * }
* } * }
* @endcode * @endcode
* @ingroup drivers
*/ */
class Timeout : public Ticker, private NonCopyable<Timeout> { class Timeout : public Ticker, private NonCopyable<Timeout> {
@ -63,6 +67,9 @@ 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,15 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Timer Timer class
* @{
*/
/** A general purpose timer /** A general purpose timer
* *
@ -47,7 +52,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 +112,9 @@ 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,20 @@
#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 */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_TimerEvent TimerEvent class
* @{
*/
/** 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 +86,9 @@ 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"
@ -40,11 +39,16 @@
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_UARTSerial UARTSerial class
* @{
*/
/** 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 +316,10 @@ 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,8 +28,14 @@
#include <cstdio> #include <cstdio>
namespace mbed { namespace mbed {
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Watchdog Watchdog class
* @{
*/
/** \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 +62,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 +154,9 @@ private:
bool _running; bool _running;
}; };
/** @}*/
/** @}*/
} // namespace mbed } // namespace mbed
#endif // DEVICE_WATCHDOG #endif // DEVICE_WATCHDOG

View File

@ -21,7 +21,8 @@
#include <stdint.h> #include <stdint.h>
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \ingroup drivers */
/** \addtogroup drivers-internal-api Internal API */
/** @{*/ /** @{*/
#define MBED_CRC_TABLE_SIZE 256 #define MBED_CRC_TABLE_SIZE 256
@ -35,6 +36,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

@ -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

View File

@ -0,0 +1,36 @@
/* 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/PortOut.h"
#if DEVICE_PORTOUT
#include "platform/mbed_critical.h"
namespace mbed {
PortOut::PortOut(PortName port, int mask)
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_OUTPUT);
core_util_critical_section_exit();
}
} // namespace mbed
#endif // #if DEVICE_PORTOUT

119
drivers/source/PwmOut.cpp Normal file
View File

@ -0,0 +1,119 @@
/* 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/PwmOut.h"
#if DEVICE_PWMOUT
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed {
PwmOut::PwmOut(PinName pin) : _deep_sleep_locked(false)
{
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();
}
void PwmOut::write(float value)
{
core_util_critical_section_enter();
lock_deep_sleep();
pwmout_write(&_pwm, value);
core_util_critical_section_exit();
}
float PwmOut::read()
{
core_util_critical_section_enter();
float val = pwmout_read(&_pwm);
core_util_critical_section_exit();
return val;
}
void PwmOut::period(float seconds)
{
core_util_critical_section_enter();
pwmout_period(&_pwm, seconds);
core_util_critical_section_exit();
}
void PwmOut::period_ms(int ms)
{
core_util_critical_section_enter();
pwmout_period_ms(&_pwm, ms);
core_util_critical_section_exit();
}
void PwmOut::period_us(int us)
{
core_util_critical_section_enter();
pwmout_period_us(&_pwm, us);
core_util_critical_section_exit();
}
void PwmOut::pulsewidth(float seconds)
{
core_util_critical_section_enter();
pwmout_pulsewidth(&_pwm, seconds);
core_util_critical_section_exit();
}
void PwmOut::pulsewidth_ms(int ms)
{
core_util_critical_section_enter();
pwmout_pulsewidth_ms(&_pwm, ms);
core_util_critical_section_exit();
}
void PwmOut::pulsewidth_us(int us)
{
core_util_critical_section_enter();
pwmout_pulsewidth_us(&_pwm, us);
core_util_critical_section_exit();
}
void PwmOut::lock_deep_sleep()
{
if (_deep_sleep_locked == false) {
sleep_manager_lock_deep_sleep();
_deep_sleep_locked = true;
}
}
void PwmOut::unlock_deep_sleep()
{
if (_deep_sleep_locked == true) {
sleep_manager_unlock_deep_sleep();
_deep_sleep_locked = false;
}
}
} // namespace mbed
#endif // #if DEVICE_PWMOUT

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,9 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
#include "drivers/RawSerial.h" #include "drivers/RawSerial.h"
#include "platform/mbed_wait_api.h"
#include <stdio.h> #include <stdio.h>
#include <cstdarg>
#if DEVICE_SERIAL #if DEVICE_SERIAL

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");
@ -243,7 +243,6 @@ void SPI::abort_transfer()
#endif #endif
} }
void SPI::clear_transfer_buffer() void SPI::clear_transfer_buffer()
{ {
#if TRANSACTION_QUEUE_SIZE_SPI #if TRANSACTION_QUEUE_SIZE_SPI

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,7 +15,6 @@
* limitations under the License. * limitations under the License.
*/ */
#include "drivers/Serial.h" #include "drivers/Serial.h"
#include "platform/mbed_wait_api.h"
#if DEVICE_SERIAL #if DEVICE_SERIAL

View File

@ -0,0 +1,41 @@
/* mbed Microcontroller Library
* Copyright (c) 2017-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/SerialWireOutput.h"
#if defined(DEVICE_ITM)
#include "hal/itm_api.h"
namespace mbed {
SerialWireOutput::SerialWireOutput(void)
{
/* Initialize ITM using internal init function. */
mbed_itm_init();
}
ssize_t SerialWireOutput::write(const void *buffer, size_t size)
{
mbed_itm_send_block(ITM_PORT_SWO, buffer, size);
return size;
}
} // namespace mbed
#endif // DEVICE_ITM

View File

@ -16,11 +16,9 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include "drivers/TableCRC.h" #include "drivers/internal/TableCRC.h"
namespace mbed { namespace mbed {
/** \addtogroup drivers */
/** @{*/
extern const uint8_t Table_CRC_7Bit_SD[MBED_CRC_TABLE_SIZE] = { extern const uint8_t Table_CRC_7Bit_SD[MBED_CRC_TABLE_SIZE] = {
0x0, 0x12, 0x24, 0x36, 0x48, 0x5a, 0x6c, 0x7e, 0x90, 0x82, 0xb4, 0xa6, 0xd8, 0xca, 0xfc, 0xee, 0x0, 0x12, 0x24, 0x36, 0x48, 0x5a, 0x6c, 0x7e, 0x90, 0x82, 0xb4, 0xa6, 0xd8, 0xca, 0xfc, 0xee,
@ -151,6 +149,4 @@ extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE] =
0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c 0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
}; };
/** @}*/
} // namespace mbed } // namespace mbed

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,9 +20,19 @@
#include "platform/FunctionPointer.h" #include "platform/FunctionPointer.h"
#include "hal/ticker_api.h" #include "hal/ticker_api.h"
#include "platform/mbed_critical.h" #include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed { namespace mbed {
Ticker::Ticker() : TimerEvent(), _function(0), _lock_deepsleep(true)
{
}
// When low power ticker is in use, then do not disable deep sleep.
Ticker::Ticker(const ticker_data_t *data) : TimerEvent(data), _function(0), _lock_deepsleep(!data->interface->runs_in_deep_sleep)
{
}
void Ticker::detach() void Ticker::detach()
{ {
core_util_critical_section_enter(); core_util_critical_section_enter();

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,6 +18,7 @@
#include "hal/ticker_api.h" #include "hal/ticker_api.h"
#include "hal/us_ticker_api.h" #include "hal/us_ticker_api.h"
#include "platform/mbed_critical.h" #include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed { namespace mbed {

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");
@ -17,7 +17,6 @@
#include "drivers/TimerEvent.h" #include "drivers/TimerEvent.h"
#include <stddef.h> #include <stddef.h>
#include "hal/ticker_api.h"
#include "hal/us_ticker_api.h" #include "hal/us_ticker_api.h"
namespace mbed { namespace mbed {

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");

View File

@ -1,5 +1,5 @@
/* events /*
* Copyright (c) 2016 ARM Limited * Copyright (c) 2016-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,20 +21,25 @@
#include "platform/mbed_assert.h" #include "platform/mbed_assert.h"
namespace events { namespace events {
/** \addtogroup events */ /** \ingroup events */
/** \addtogroup events-public-api Public API */
/** @{*/
/** Event /** Event
* *
* Representation of an event for fine-grain dispatch control * Representation of an event for fine-grain dispatch control
* @ingroup events
*/ */
template <typename F> template <typename F>
class Event; class Event;
/**
* \defgroup events_Event Event<void()> class
* @{
*/
/** Event /** Event
* *
* Representation of an event for fine-grain dispatch control * Representation of an event for fine-grain dispatch control
* @ingroup events
*/ */
template <typename... ArgTs> template <typename... ArgTs>
class Event<void(ArgTs...)> { class Event<void(ArgTs...)> {
@ -389,9 +394,8 @@ public:
Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { } Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { }
}; };
/** @}*/
/** \addtogroup events */
/** @{ */
// Convenience functions declared here to avoid cyclic // Convenience functions declared here to avoid cyclic
// dependency between Event and EventQueue // dependency between Event and EventQueue
@ -610,8 +614,7 @@ Event<void(ArgTs...)> EventQueue::event(mbed::Callback<R(B0, B1, B2, B3, B4, Arg
{ {
return Event<void(ArgTs...)>(this, cb, c0, c1, c2, c3, c4); return Event<void(ArgTs...)>(this, cb, c0, c1, c2, c3, c4);
} }
}
#endif
/** @}*/ /** @}*/
}
#endif

View File

@ -1,5 +1,5 @@
/* events /*
* Copyright (c) 2016 ARM Limited * Copyright (c) 2016-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,14 +18,16 @@
#ifndef EVENT_QUEUE_H #ifndef EVENT_QUEUE_H
#define EVENT_QUEUE_H #define EVENT_QUEUE_H
#include "equeue/equeue.h" #include "events/internal/equeue.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
#include <cstddef> #include <cstddef>
#include <new> #include <new>
namespace events { namespace events {
/** \addtogroup events */ /** \ingroup events */
/** \addtogroup events-public-api */
/** @{*/
/** EVENTS_EVENT_SIZE /** EVENTS_EVENT_SIZE
* Minimum size of an event * Minimum size of an event
@ -43,11 +45,14 @@ namespace events {
template <typename F> template <typename F>
class Event; class Event;
/**
* \defgroup events_EventQueue EventQueue class
* @{
*/
/** EventQueue /** EventQueue
* *
* Flexible event queue for dispatching events * Flexible event queue for dispatching events
* @ingroup events
*/ */
class EventQueue : private mbed::NonCopyable<EventQueue> { class EventQueue : private mbed::NonCopyable<EventQueue> {
public: public:
@ -1186,7 +1191,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY) #endif //!defined(DOXYGEN_ONLY)
}; };
/** @}*/
/** @}*/
} }
#endif #endif

View File

@ -1,10 +1,8 @@
/** \addtogroup events */
/** @{*/
/* /*
* Flexible event queue for dispatching events * Flexible event queue for dispatching events
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016-2019 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -26,11 +24,14 @@ extern "C" {
#endif #endif
// Platform specific files // Platform specific files
#include "equeue/equeue_platform.h" #include "events/internal/equeue_platform.h"
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
/** \ingroup events */
/** \addtogroup events-internal-api Internal API */
/** @{*/
// The minimum size of an event // The minimum size of an event
// This size is guaranteed to fit events created by event_call // This size is guaranteed to fit events created by event_call
@ -225,11 +226,10 @@ void equeue_background(equeue_t *queue,
// platform-specific error code. // platform-specific error code.
int equeue_chain(equeue_t *queue, equeue_t *target); int equeue_chain(equeue_t *queue, equeue_t *target);
/** @}*/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/** @}*/

View File

@ -1,10 +1,7 @@
/** \addtogroup events */
/** @{*/
/* /*
* System specific implementation * System specific implementation
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016-2019 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,6 +25,10 @@ extern "C" {
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
/** \ingroup events */
/** \addtogroup events-internal-api */
/** @{*/
// Currently supported platforms // Currently supported platforms
// //
// Uncomment to select a supported platform or reimplement this file // Uncomment to select a supported platform or reimplement this file
@ -150,11 +151,10 @@ void equeue_sema_destroy(equeue_sema_t *sema);
void equeue_sema_signal(equeue_sema_t *sema); void equeue_sema_signal(equeue_sema_t *sema);
bool equeue_sema_wait(equeue_sema_t *sema, int ms); bool equeue_sema_wait(equeue_sema_t *sema, int ms);
/** @}*/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
/** @}*/

View File

@ -1,8 +1,6 @@
/** \addtogroup events */ /** \addtogroup events */
/** @{*/ /** @{*/
/* events /* Copyright (c) 2016-2019 ARM Limited
* Copyright (c) 2016 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 +18,6 @@
#ifndef MBED_EVENTS_H #ifndef MBED_EVENTS_H
#define MBED_EVENTS_H #define MBED_EVENTS_H
#include "equeue/equeue.h"
#ifdef __cplusplus #ifdef __cplusplus
#include "events/EventQueue.h" #include "events/EventQueue.h"

View File

@ -1,8 +1,5 @@
/*
/** \addtogroup events */ * Copyright (c) 2016-2019 ARM Limited
/** @{*/
/* events
* Copyright (c) 2017 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,6 +19,9 @@
#include "events/EventQueue.h" #include "events/EventQueue.h"
namespace mbed { namespace mbed {
/** \ingroup events */
/** \addtogroup events-public-api */
/** @{*/
/** /**
* Return a pointer to an EventQueue, on which normal tasks can be queued. * Return a pointer to an EventQueue, on which normal tasks can be queued.
@ -85,8 +85,8 @@ events::EventQueue *mbed_highprio_event_queue();
#endif // MBED_CONF_RTOS_PRESENT #endif // MBED_CONF_RTOS_PRESENT
}; /** @}*/
}
#endif #endif
/** @}*/

View File

@ -17,7 +17,7 @@ endif
ifdef WORD ifdef WORD
CFLAGS += -m$(WORD) CFLAGS += -m$(WORD)
endif endif
CFLAGS += -I. -I.. CFLAGS += -I. -I.. -I../..
CFLAGS += -std=c99 CFLAGS += -std=c99
CFLAGS += -Wall CFLAGS += -Wall
CFLAGS += -D_XOPEN_SOURCE=600 CFLAGS += -D_XOPEN_SOURCE=600

View File

@ -207,4 +207,3 @@ comparison with previous runs:
make prof | tee results.txt make prof | tee results.txt
cat results.txt | make prof cat results.txt | make prof
``` ```

View File

@ -1,7 +1,7 @@
/* /*
* Flexible event queue for dispatching events * Flexible event queue for dispatching events
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016-2019 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "equeue/equeue.h" #include "events/internal/equeue.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>

View File

@ -2,7 +2,7 @@
* Implementation for the mbed library * Implementation for the mbed library
* https://github.com/mbedmicro/mbed * https://github.com/mbedmicro/mbed
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016-2019 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "equeue/equeue_platform.h" #include "events/internal/equeue_platform.h"
#if defined(EQUEUE_PLATFORM_MBED) #if defined(EQUEUE_PLATFORM_MBED)
@ -24,6 +24,7 @@
#include <string.h> #include <string.h>
#include "cmsis.h" #include "cmsis.h"
#include "platform/mbed_critical.h" #include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
#include "drivers/Timer.h" #include "drivers/Timer.h"
#include "drivers/Ticker.h" #include "drivers/Ticker.h"
#include "drivers/Timeout.h" #include "drivers/Timeout.h"

View File

@ -1,7 +1,7 @@
/* /*
* Implementation for Posix compliant platforms * Implementation for Posix compliant platforms
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016-2019 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "equeue/equeue_platform.h" #include "events/internal/equeue_platform.h"
#if defined(EQUEUE_PLATFORM_POSIX) #if defined(EQUEUE_PLATFORM_POSIX)

View File

@ -1,7 +1,7 @@
/* /*
* Profiling framework for the events library * Profiling framework for the events library
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "equeue.h" #include "events/internal/equeue.h"
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>

View File

@ -1,7 +1,7 @@
/* /*
* Testing framework for the events library * Testing framework for the events library
* *
* Copyright (c) 2016 Christopher Haster * Copyright (c) 2016 ARM Limited
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "equeue.h" #include "events/internal/equeue.h"
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <setjmp.h> #include <setjmp.h>

View File

@ -32,7 +32,7 @@
#if (DEVICEKEY_ENABLED) || defined(DOXYGEN_ONLY) #if (DEVICEKEY_ENABLED) || defined(DOXYGEN_ONLY)
namespace mbed { namespace mbed {
/** \addtogroup drivers */ /** \addtogroup device-key Device Key */
#define DEVICE_KEY_16BYTE 16 #define DEVICE_KEY_16BYTE 16
#define DEVICE_KEY_32BYTE 32 #define DEVICE_KEY_32BYTE 32
@ -56,7 +56,7 @@ enum DeviceKeyStatus {
/** Use this singleton if you need to derive a new key from the device root of trust. /** Use this singleton if you need to derive a new key from the device root of trust.
* *
* @note Synchronization level: Thread safe * @note Synchronization level: Thread safe
* @ingroup drivers * @ingroup device-key
*/ */
class DeviceKey : private mbed::NonCopyable<DeviceKey> { class DeviceKey : private mbed::NonCopyable<DeviceKey> {

View File

@ -2,7 +2,7 @@
/** \addtogroup hal */ /** \addtogroup hal */
/** @{*/ /** @{*/
/* mbed Microcontroller Library /* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited * Copyright (c) 2018-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,6 +26,8 @@
#include "hal/us_ticker_api.h" #include "hal/us_ticker_api.h"
#include "drivers/Timeout.h" #include "drivers/Timeout.h"
#include "platform/mbed_critical.h"
class LowPowerTickerWrapper { class LowPowerTickerWrapper {
public: public:

View File

@ -29,32 +29,67 @@ extern "C" {
#endif #endif
// Connection constants // Connection constants
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
int ethernet_init(void); int ethernet_init(void);
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
void ethernet_free(void); void ethernet_free(void);
// write size bytes from data to ethernet buffer // write size bytes from data to ethernet buffer
// return num bytes written // return num bytes written
// or -1 if size is too big // or -1 if size is too big
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
int ethernet_write(const char *data, int size); int ethernet_write(const char *data, int size);
// send ethernet write buffer, returning the packet size sent // send ethernet write buffer, returning the packet size sent
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
int ethernet_send(void); int ethernet_send(void);
// receive from ethernet buffer, returning packet size, or 0 if no packet // receive from ethernet buffer, returning packet size, or 0 if no packet
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
int ethernet_receive(void); int ethernet_receive(void);
// read size bytes in to data, return actual num bytes read (0..size) // read size bytes in to data, return actual num bytes read (0..size)
// if data == NULL, throw the bytes away // if data == NULL, throw the bytes away
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
int ethernet_read(char *data, int size); int ethernet_read(char *data, int size);
// get the ethernet address // get the ethernet address
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
void ethernet_address(char *mac); void ethernet_address(char *mac);
// see if the link is up // see if the link is up
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
int ethernet_link(void); int ethernet_link(void);
// force link settings // force link settings
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
void ethernet_set_link(int speed, int duplex); void ethernet_set_link(int speed, int duplex);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* Mbed Microcontroller Library /* Mbed Microcontroller Library
* Copyright (c) 2017-2018 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
@ -32,10 +32,15 @@
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY) #if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
namespace rtos { namespace rtos {
/** \addtogroup rtos */ /** \ingroup rtos */
/** \addtogroup rtos-public-api Public API */
/** @{*/ /** @{*/
struct Waiter; struct Waiter;
/**
* \defgroup rtos_ConditionVariable ConditionVariable class
* @{
*/
/** The ConditionVariable class is a synchronization primitive that allows /** The ConditionVariable class is a synchronization primitive that allows
* threads to wait until a particular condition occurs. * threads to wait until a particular condition occurs.
@ -327,9 +332,9 @@ protected:
#endif // !defined(DOXYGEN_ONLY) #endif // !defined(DOXYGEN_ONLY)
}; };
}
#endif
#endif
/** @}*/ /** @}*/
/** @}*/
} // namespace rtos
#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
* *
* 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
@ -30,7 +30,8 @@
#include "platform/NonCopyable.h" #include "platform/NonCopyable.h"
namespace rtos { namespace rtos {
/** \addtogroup rtos */ /** \ingroup rtos */
/** \addtogroup rtos-public-api */
/** @{*/ /** @{*/
/** /**
* \defgroup rtos_EventFlags EventFlags class * \defgroup rtos_EventFlags EventFlags class
@ -127,4 +128,3 @@ private:
} }
#endif #endif

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