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
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
# Run local equeue tests
- make -C ${EVENTS}/equeue test
- make -C ${EVENTS}/source test
# Run profiling tests
- make -C ${EVENTS}/equeue prof | tee prof
- make -C ${EVENTS}/source prof | tee prof
after_success:
# Update status, comparing with master if possible.
- |

View File

@ -105,7 +105,8 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../drivers"
"${PROJECT_SOURCE_DIR}/../hal"
"${PROJECT_SOURCE_DIR}/../events"
"${PROJECT_SOURCE_DIR}/../events/equeue"
"${PROJECT_SOURCE_DIR}/../events/source"
"${PROJECT_SOURCE_DIR}/../events/internal"
"${PROJECT_SOURCE_DIR}/../rtos"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX"
"${PROJECT_SOURCE_DIR}/../rtos/TARGET_CORTEX/rtx5/Include"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,13 @@
#include "platform/NonCopyable.h"
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_BusInOut BusInOut class
* @{
*/
/** A digital input output bus, used for setting the state of a collection of pins.
* Implemented as an array of DigitalInOut pins, the bus can be constructed by any
@ -30,7 +36,6 @@ namespace mbed {
* capabilities
*
* @note Synchronization level: Thread safe
* @ingroup drivers
*/
class BusInOut : private NonCopyable<BusInOut> {
@ -147,6 +152,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY)
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +20,15 @@
#include "platform/platform.h"
#include "hal/gpio_api.h"
#include "platform/mbed_critical.h"
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
*
@ -47,7 +52,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class DigitalIn {
@ -72,6 +76,7 @@ public:
// No lock needed in the constructor
gpio_init_in_ex(&gpio, pin, mode);
}
/** Read the input, represented as 0 or 1 (int)
*
* @returns
@ -88,12 +93,7 @@ public:
*
* @param pull PullUp, PullDown, PullNone, OpenDrain
*/
void mode(PinMode pull)
{
core_util_critical_section_enter();
gpio_mode(&gpio, pull);
core_util_critical_section_exit();
}
void mode(PinMode pull);
/** Return the output setting, represented as 0 or 1 (int)
*
@ -127,6 +127,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY)
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -19,10 +19,15 @@
#include "platform/platform.h"
#include "hal/gpio_api.h"
#include "platform/mbed_critical.h"
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
*
@ -42,7 +47,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class DigitalOut {
@ -122,13 +126,7 @@ public:
* state from the DigitalOut argument.
* \sa DigitalOut::write()
*/
DigitalOut &operator= (DigitalOut &rhs)
{
core_util_critical_section_enter();
write(rhs.read());
core_util_critical_section_exit();
return *this;
}
DigitalOut &operator= (DigitalOut &rhs);
/** A shorthand for read()
* \sa DigitalOut::read()
@ -150,6 +148,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY)
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -23,7 +23,13 @@
#if DEVICE_ETHERNET || defined(DOXYGEN_ONLY)
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_Ethernet Ethernet class
* @{
*/
/** An ethernet interface, to use with the ethernet pins.
*
@ -54,9 +60,13 @@ namespace mbed {
* }
* }
* @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:
@ -170,6 +180,9 @@ public:
void set_link(Mode mode);
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2015 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -30,11 +30,17 @@
#if DEVICE_I2C_ASYNCH
#include "platform/CThunk.h"
#include "hal/dma_api.h"
#include "platform/FunctionPointer.h"
#include "platform/Callback.h"
#endif
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
*
@ -70,7 +76,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class I2C : private NonCopyable<I2C> {
@ -242,6 +247,9 @@ private:
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -24,7 +24,13 @@
#include "hal/i2c_api.h"
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.
*
@ -64,7 +70,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class I2CSlave {
@ -160,6 +165,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY)
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
#ifndef MBED_CRC_API_H
#define MBED_CRC_API_H
#include "drivers/TableCRC.h"
#include "drivers/internal/TableCRC.h"
#include "hal/crc_api.h"
#include "platform/mbed_assert.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
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_MbedCRC MbedCRC class
* @{
*/
extern SingletonPtr<PlatformMutex> mbed_crc_mutex;
@ -101,7 +106,6 @@ extern SingletonPtr<PlatformMutex> mbed_crc_mutex;
* return 0;
* }
* @endcode
* @ingroup drivers
*/
template <uint32_t polynomial = POLY_32BIT_ANSI, uint8_t width = 32>
class MbedCRC {
@ -565,6 +569,8 @@ private:
#endif
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -22,10 +22,15 @@
#if DEVICE_PORTIN || defined(DOXYGEN_ONLY)
#include "hal/port_api.h"
#include "platform/mbed_critical.h"
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PortIn PortIn class
* @{
*/
/** A multiple pin digital input
*
@ -51,7 +56,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class PortIn {
public:
@ -61,12 +65,7 @@ public:
* @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)
*/
PortIn(PortName port, int mask = 0xFFFFFFFF)
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_INPUT);
core_util_critical_section_exit();
}
PortIn(PortName port, int mask = 0xFFFFFFFF);
/** Read the value input to the port
*
@ -82,12 +81,7 @@ public:
*
* @param mode PullUp, PullDown, PullNone, OpenDrain
*/
void mode(PinMode mode)
{
core_util_critical_section_enter();
port_mode(&_port, mode);
core_util_critical_section_exit();
}
void mode(PinMode mode);
/** A shorthand for read()
*/
@ -100,6 +94,9 @@ private:
port_t _port;
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -22,10 +22,15 @@
#if DEVICE_PORTOUT || defined(DOXYGEN_ONLY)
#include "hal/port_api.h"
#include "platform/mbed_critical.h"
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PortOut PortOut class
* @{
*/
/** A multiple pin digital output
*
* @note Synchronization level: Interrupt safe
@ -50,7 +55,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class PortOut {
public:
@ -60,12 +64,7 @@ public:
* @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)
*/
PortOut(PortName port, int mask = 0xFFFFFFFF)
{
core_util_critical_section_enter();
port_init(&_port, port, mask, PIN_OUTPUT);
core_util_critical_section_exit();
}
PortOut(PortName port, int mask = 0xFFFFFFFF);
/** Write the value to the output port
*
@ -116,6 +115,9 @@ private:
port_t _port;
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -21,11 +21,15 @@
#if DEVICE_PWMOUT || defined(DOXYGEN_ONLY)
#include "hal/pwmout_api.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-public-api */
/** @{*/
/**
* \defgroup drivers_PwmOut PwmOut class
* @{
*/
/** A pulse-width modulation digital output
*
@ -48,7 +52,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class PwmOut {
@ -58,20 +61,9 @@ public:
*
* @param pin PwmOut pin to connect to
*/
PwmOut(PinName pin) : _deep_sleep_locked(false)
{
core_util_critical_section_enter();
pwmout_init(&_pwm, pin);
core_util_critical_section_exit();
}
PwmOut(PinName pin);
~PwmOut()
{
core_util_critical_section_enter();
pwmout_free(&_pwm);
unlock_deep_sleep();
core_util_critical_section_exit();
}
~PwmOut();
/** 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%).
* Values outside this range will be saturated to 0.0f or 1.0f.
*/
void write(float value)
{
core_util_critical_section_enter();
lock_deep_sleep();
pwmout_write(&_pwm, value);
core_util_critical_section_exit();
}
void write(float value);
/** Return the current output duty-cycle setting, measured as a percentage (float)
*
@ -98,13 +84,7 @@ public:
* @note
* This value may not match exactly the value set by a previous write().
*/
float read()
{
core_util_critical_section_enter();
float val = pwmout_read(&_pwm);
core_util_critical_section_exit();
return val;
}
float read();
/** 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
* will be set to zero.
*/
void period(float seconds)
{
core_util_critical_section_enter();
pwmout_period(&_pwm, seconds);
core_util_critical_section_exit();
}
void period(float seconds);
/** 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
*/
void period_ms(int ms)
{
core_util_critical_section_enter();
pwmout_period_ms(&_pwm, ms);
core_util_critical_section_exit();
}
void period_ms(int ms);
/** 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
*/
void period_us(int us)
{
core_util_critical_section_enter();
pwmout_period_us(&_pwm, us);
core_util_critical_section_exit();
}
void period_us(int us);
/** 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)
*/
void pulsewidth(float seconds)
{
core_util_critical_section_enter();
pwmout_pulsewidth(&_pwm, seconds);
core_util_critical_section_exit();
}
void pulsewidth(float seconds);
/** 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
*/
void pulsewidth_ms(int ms)
{
core_util_critical_section_enter();
pwmout_pulsewidth_ms(&_pwm, ms);
core_util_critical_section_exit();
}
void pulsewidth_ms(int ms);
/** 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
*/
void pulsewidth_us(int us)
{
core_util_critical_section_enter();
pwmout_pulsewidth_us(&_pwm, us);
core_util_critical_section_exit();
}
void pulsewidth_us(int us);
/** A operator shorthand for write()
* \sa PwmOut::write()
@ -202,28 +152,19 @@ public:
#if !(DOXYGEN_ONLY)
protected:
/** Lock deep sleep only if it is not yet locked */
void lock_deep_sleep()
{
if (_deep_sleep_locked == false) {
sleep_manager_lock_deep_sleep();
_deep_sleep_locked = true;
}
}
void lock_deep_sleep();
/** Unlock deep sleep in case it is locked */
void unlock_deep_sleep()
{
if (_deep_sleep_locked == true) {
sleep_manager_unlock_deep_sleep();
_deep_sleep_locked = false;
}
}
void unlock_deep_sleep();
pwmout_t _pwm;
bool _deep_sleep_locked;
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -30,7 +30,13 @@
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
*
@ -69,7 +75,6 @@ namespace mbed {
*
* }
* @endcode
* @ingroup drivers
*/
class QSPI : private NonCopyable<QSPI> {
@ -225,6 +230,9 @@ private:
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -23,12 +23,17 @@
#include "mbed_toolchain.h"
#include "drivers/SerialBase.h"
#include "hal/serial_api.h"
#include "platform/NonCopyable.h"
#include <cstdarg>
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
* This is a variation of the Serial class that doesn't use streams,
@ -51,7 +56,6 @@ namespace mbed {
* pc.putc('A');
* }
* @endcode
* @ingroup drivers
*/
class RawSerial: public SerialBase, private NonCopyable<RawSerial> {
@ -105,6 +109,9 @@ protected:
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -22,14 +22,19 @@
#include "reset_reason_api.h"
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.
*
* When the system restarts, the reason for the restart is contained in
* the system registers at boot time in a platform specific manner.
* This API provides a generic method of fetching the reason for the restart.
*
* @ingroup drivers
*/
class ResetReason {
public:
@ -71,6 +76,9 @@ public:
static uint32_t get_raw();
};
/** @}*/
/** @}*/
} // namespace mbed
#endif // DEVICE_RESET_REASON

View File

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

View File

@ -25,7 +25,13 @@
#include "hal/spi_api.h"
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.
*
@ -51,7 +57,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class SPISlave : private NonCopyable<SPISlave> {
@ -127,6 +132,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY)
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -22,13 +22,18 @@
#if DEVICE_SERIAL || defined(DOXYGEN_ONLY)
#include "platform/Stream.h"
#include "SerialBase.h"
#include "drivers/SerialBase.h"
#include "platform/PlatformMutex.h"
#include "hal/serial_api.h"
#include "platform/NonCopyable.h"
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
*
@ -49,7 +54,6 @@ namespace mbed {
* pc.printf("Hello World\n");
* }
* @endcode
* @ingroup drivers
*/
class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
@ -111,6 +115,9 @@ protected:
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -21,12 +21,16 @@
#include "platform/Callback.h"
#include "platform/mbed_toolchain.h"
#include "platform/NonCopyable.h"
#include "platform/mbed_power_mgmt.h"
#include "hal/lp_ticker_api.h"
#include "platform/mbed_critical.h"
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
*
@ -62,19 +66,14 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class Ticker : public TimerEvent, private NonCopyable<Ticker> {
public:
Ticker() : TimerEvent(), _function(0), _lock_deepsleep(true)
{
}
Ticker();
// 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
*
@ -155,6 +154,9 @@ protected:
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -19,10 +19,15 @@
#include "drivers/Ticker.h"
#include "platform/NonCopyable.h"
#include "platform/mbed_power_mgmt.h"
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
*
@ -53,7 +58,6 @@ namespace mbed {
* }
* }
* @endcode
* @ingroup drivers
*/
class Timeout : public Ticker, private NonCopyable<Timeout> {
@ -63,6 +67,9 @@ protected:
#endif
};
/** @}*/
/** @}*/
} // namespace mbed
#endif

View File

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

View File

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

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -23,10 +23,9 @@
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
#include "platform/FileHandle.h"
#include "SerialBase.h"
#include "InterruptIn.h"
#include "drivers/SerialBase.h"
#include "drivers/InterruptIn.h"
#include "platform/PlatformMutex.h"
#include "hal/serial_api.h"
#include "platform/CircularBuffer.h"
#include "platform/NonCopyable.h"
@ -40,11 +39,16 @@
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
*
* @ingroup drivers
*/
class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> {
@ -312,6 +316,10 @@ private:
void dcd_irq(void);
};
/** @}*/
/** @}*/
} //namespace mbed
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)

View File

@ -28,8 +28,14 @@
#include <cstdio>
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
* failures or malfunctions. If you fail to refresh the Watchdog timer periodically,
* it resets the system after a set period of time.
@ -56,7 +62,6 @@ namespace mbed {
* @endcode
*
* @note Synchronization level: Interrupt safe
* @ingroup drivers
*/
class Watchdog : private NonCopyable<Watchdog> {
public:
@ -149,6 +154,9 @@ private:
bool _running;
};
/** @}*/
/** @}*/
} // namespace mbed
#endif // DEVICE_WATCHDOG

View File

@ -21,7 +21,8 @@
#include <stdint.h>
namespace mbed {
/** \addtogroup drivers */
/** \ingroup drivers */
/** \addtogroup drivers-internal-api Internal API */
/** @{*/
#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];
/** @}*/
} // namespace mbed
#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
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -15,14 +15,17 @@
* limitations under the License.
*/
#include "drivers/AnalogIn.h"
#include "drivers/DigitalIn.h"
#if DEVICE_ANALOGIN
#include "platform/mbed_critical.h"
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();
}
};
#endif
} // namespace mbed

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
* Copyright (c) 2017 ARM Limited
* Copyright (c) 2017-2019 ARM Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal

View File

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

View File

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

View File

@ -16,12 +16,9 @@
*/
#include <stddef.h>
#include "drivers/TableCRC.h"
#include "drivers/MbedCRC.h"
namespace mbed {
/** \addtogroup drivers */
/** @{*/
SingletonPtr<PlatformMutex> mbed_crc_mutex;
@ -75,6 +72,4 @@ MbedCRC<POLY_8BIT_CCITT, 8>::MbedCRC():
mbed_crc_ctor();
}
/** @}*/
} // 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
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -15,9 +15,7 @@
* limitations under the License.
*/
#include "drivers/RawSerial.h"
#include "platform/mbed_wait_api.h"
#include <stdio.h>
#include <cstdarg>
#if DEVICE_SERIAL

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -243,7 +243,6 @@ void SPI::abort_transfer()
#endif
}
void SPI::clear_transfer_buffer()
{
#if TRANSACTION_QUEUE_SIZE_SPI

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -15,7 +15,6 @@
* limitations under the License.
*/
#include "drivers/Serial.h"
#include "platform/mbed_wait_api.h"
#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 "drivers/TableCRC.h"
#include "drivers/internal/TableCRC.h"
namespace mbed {
/** \addtogroup drivers */
/** @{*/
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,
@ -151,6 +149,4 @@ extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE] =
0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c
};
/** @}*/
} // namespace mbed

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,9 +20,19 @@
#include "platform/FunctionPointer.h"
#include "hal/ticker_api.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
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()
{
core_util_critical_section_enter();

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -18,6 +18,7 @@
#include "hal/ticker_api.h"
#include "hal/us_ticker_api.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
namespace mbed {

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -17,7 +17,6 @@
#include "drivers/TimerEvent.h"
#include <stddef.h>
#include "hal/ticker_api.h"
#include "hal/us_ticker_api.h"
namespace mbed {

View File

@ -1,5 +1,5 @@
/* mbed Microcontroller Library
* Copyright (c) 2006-2017 ARM Limited
* Copyright (c) 2006-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -21,20 +21,25 @@
#include "platform/mbed_assert.h"
namespace events {
/** \addtogroup events */
/** \ingroup events */
/** \addtogroup events-public-api Public API */
/** @{*/
/** Event
*
* Representation of an event for fine-grain dispatch control
* @ingroup events
*/
template <typename F>
class Event;
/**
* \defgroup events_Event Event<void()> class
* @{
*/
/** Event
*
* Representation of an event for fine-grain dispatch control
* @ingroup events
*/
template <typename... ArgTs>
class Event<void(ArgTs...)> {
@ -389,9 +394,8 @@ public:
Event(q, mbed::callback(obj, method), b0, b1, b2, b3, b4) { }
};
/** @}*/
/** \addtogroup events */
/** @{ */
// Convenience functions declared here to avoid cyclic
// 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);
}
}
#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
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -18,14 +18,16 @@
#ifndef EVENT_QUEUE_H
#define EVENT_QUEUE_H
#include "equeue/equeue.h"
#include "events/internal/equeue.h"
#include "platform/Callback.h"
#include "platform/NonCopyable.h"
#include <cstddef>
#include <new>
namespace events {
/** \addtogroup events */
/** \ingroup events */
/** \addtogroup events-public-api */
/** @{*/
/** EVENTS_EVENT_SIZE
* Minimum size of an event
@ -43,11 +45,14 @@ namespace events {
template <typename F>
class Event;
/**
* \defgroup events_EventQueue EventQueue class
* @{
*/
/** EventQueue
*
* Flexible event queue for dispatching events
* @ingroup events
*/
class EventQueue : private mbed::NonCopyable<EventQueue> {
public:
@ -1186,7 +1191,9 @@ protected:
#endif //!defined(DOXYGEN_ONLY)
};
/** @}*/
/** @}*/
}
#endif

View File

@ -1,10 +1,8 @@
/** \addtogroup 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");
* you may not use this file except in compliance with the License.
@ -26,11 +24,14 @@ extern "C" {
#endif
// Platform specific files
#include "equeue/equeue_platform.h"
#include "events/internal/equeue_platform.h"
#include <stddef.h>
#include <stdint.h>
/** \ingroup events */
/** \addtogroup events-internal-api Internal API */
/** @{*/
// The minimum size of an event
// 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.
int equeue_chain(equeue_t *queue, equeue_t *target);
/** @}*/
#ifdef __cplusplus
}
#endif
#endif
/** @}*/

View File

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

View File

@ -1,8 +1,6 @@
/** \addtogroup events */
/** @{*/
/* events
* Copyright (c) 2016 ARM Limited
/* Copyright (c) 2016-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -20,10 +18,6 @@
#ifndef MBED_EVENTS_H
#define MBED_EVENTS_H
#include "equeue/equeue.h"
#ifdef __cplusplus
#include "events/EventQueue.h"

View File

@ -1,8 +1,5 @@
/** \addtogroup events */
/** @{*/
/* events
* Copyright (c) 2017 ARM Limited
/*
* Copyright (c) 2016-2019 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +19,9 @@
#include "events/EventQueue.h"
namespace mbed {
/** \ingroup events */
/** \addtogroup events-public-api */
/** @{*/
/**
* 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
/** @}*/

View File

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

View File

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

View File

@ -1,7 +1,7 @@
/*
* 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");
* 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
* limitations under the License.
*/
#include "equeue/equeue.h"
#include "events/internal/equeue.h"
#include <stdlib.h>
#include <stdint.h>

View File

@ -2,7 +2,7 @@
* Implementation for the mbed library
* 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");
* 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
* limitations under the License.
*/
#include "equeue/equeue_platform.h"
#include "events/internal/equeue_platform.h"
#if defined(EQUEUE_PLATFORM_MBED)
@ -24,6 +24,7 @@
#include <string.h>
#include "cmsis.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
#include "drivers/Timer.h"
#include "drivers/Ticker.h"
#include "drivers/Timeout.h"

View File

@ -1,7 +1,7 @@
/*
* 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");
* 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
* limitations under the License.
*/
#include "equeue/equeue_platform.h"
#include "events/internal/equeue_platform.h"
#if defined(EQUEUE_PLATFORM_POSIX)

View File

@ -1,7 +1,7 @@
/*
* 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");
* 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
* limitations under the License.
*/
#include "equeue.h"
#include "events/internal/equeue.h"
#include <unistd.h>
#include <stdio.h>
#include <setjmp.h>

View File

@ -1,7 +1,7 @@
/*
* 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");
* 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
* limitations under the License.
*/
#include "equeue.h"
#include "events/internal/equeue.h"
#include <unistd.h>
#include <stdio.h>
#include <setjmp.h>

View File

@ -32,7 +32,7 @@
#if (DEVICEKEY_ENABLED) || defined(DOXYGEN_ONLY)
namespace mbed {
/** \addtogroup drivers */
/** \addtogroup device-key Device Key */
#define DEVICE_KEY_16BYTE 16
#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.
*
* @note Synchronization level: Thread safe
* @ingroup drivers
* @ingroup device-key
*/
class DeviceKey : private mbed::NonCopyable<DeviceKey> {

View File

@ -2,7 +2,7 @@
/** \addtogroup hal */
/** @{*/
/* mbed Microcontroller Library
* Copyright (c) 2018 ARM Limited
* Copyright (c) 2018-2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -26,6 +26,8 @@
#include "hal/us_ticker_api.h"
#include "drivers/Timeout.h"
#include "platform/mbed_critical.h"
class LowPowerTickerWrapper {
public:

View File

@ -29,32 +29,67 @@ extern "C" {
#endif
// Connection constants
MBED_DEPRECATED(
"Ethernet drivers are provided by a class derived from `EMAC` attached to"
" either lwIP or Nanostack."
)
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);
// write size bytes from data to ethernet buffer
// return num bytes written
// 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);
// 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);
// 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);
// read size bytes in to data, return actual num bytes read (0..size)
// 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);
// 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);
// 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);
// 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);
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@ -32,10 +32,15 @@
#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup rtos-public-api Public API */
/** @{*/
struct Waiter;
/**
* \defgroup rtos_ConditionVariable ConditionVariable class
* @{
*/
/** The ConditionVariable class is a synchronization primitive that allows
* threads to wait until a particular condition occurs.
@ -327,9 +332,9 @@ protected:
#endif // !defined(DOXYGEN_ONLY)
};
}
#endif
#endif
/** @}*/
/** @}*/
} // namespace rtos
#endif
#endif

View File

@ -1,5 +1,5 @@
/* 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
* of this software and associated documentation files (the "Software"), to deal
@ -30,7 +30,8 @@
#include "platform/NonCopyable.h"
namespace rtos {
/** \addtogroup rtos */
/** \ingroup rtos */
/** \addtogroup rtos-public-api */
/** @{*/
/**
* \defgroup rtos_EventFlags EventFlags class
@ -127,4 +128,3 @@ private:
}
#endif

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