mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11073 from ARMmbed/feature-public-headers
Feature public headerspull/11186/head
commit
7d7416558a
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2013-2018 Arm Limited. All rights reserved.
|
||||
# Copyright (c) 2013-2019 Arm Limited. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
@ -222,14 +222,14 @@ matrix:
|
|||
# Check that example compiles without rtos
|
||||
- sed -n '/``` cpp/,/```/{/```$/Q;/```/d;p;}' ${EVENTS}/README.md > main.cpp
|
||||
- |
|
||||
rm -r rtos usb features/cellular features/netsocket features/nanostack \
|
||||
rm -r rtos drivers/source/usb features/cellular features/netsocket features/nanostack \
|
||||
features/lwipstack features/frameworks/greentea-client \
|
||||
features/frameworks/utest features/frameworks/unity components BUILD
|
||||
- python tools/make.py -t GCC_ARM -m DISCO_F401VC --source=. --build=BUILD/DISCO_F401VC/GCC_ARM -j0
|
||||
# Run local equeue tests
|
||||
- make -C ${EVENTS}/equeue test
|
||||
- make -C ${EVENTS}/source test
|
||||
# Run profiling tests
|
||||
- make -C ${EVENTS}/equeue prof | tee prof
|
||||
- make -C ${EVENTS}/source prof | tee prof
|
||||
after_success:
|
||||
# Update status, comparing with master if possible.
|
||||
- |
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "lp_ticker_api_tests.h"
|
||||
#include "hal/lp_ticker_api.h"
|
||||
#include "hal/mbed_lp_ticker_wrapper.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
|
||||
#if !DEVICE_LPTICKER
|
||||
#error [NOT_SUPPORTED] Low power timer not supported for this target
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "mbed.h"
|
||||
#include "qspi_api.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
|
||||
|
||||
#if !defined(QSPI_FLASH_CHIP_STRING)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "utest/utest.h"
|
||||
|
||||
#include "hal/qspi_api.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
#include "qspi_test_utils.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "unity/unity.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "mbed_lp_ticker_wrapper.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
|
||||
#include "sleep_test_utils.h"
|
||||
#include "sleep_api_tests.h"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <limits.h>
|
||||
#include "mbed.h"
|
||||
#include "mbed_lp_ticker_wrapper.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
#include "../sleep/sleep_test_utils.h"
|
||||
#include "sleep_manager_api_tests.h"
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "unity/unity.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
using namespace utest::v1;
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, ARM Limited, All Rights Reserved
|
||||
* Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include "USBHID.h"
|
||||
#include "USBMouse.h"
|
||||
#include "USBKeyboard.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
|
||||
// Reuse the VID & PID from basic USB test.
|
||||
#define USB_HID_VID 0x0d28
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, ARM Limited, All Rights Reserved
|
||||
* Copyright (c) 2018-2019, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include "usb_phy_api.h"
|
||||
#include "USBCDC.h"
|
||||
#include "USBSerial.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
|
||||
#define USB_CDC_VID 0x1f00
|
||||
#define USB_CDC_PID 0x2013
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -12,7 +12,7 @@ set(unittest-includes ${unittest-includes}
|
|||
|
||||
# Source files
|
||||
set(unittest-sources
|
||||
../drivers/Watchdog.cpp
|
||||
../drivers/source/Watchdog.cpp
|
||||
)
|
||||
|
||||
# Test files
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "SerialBase.h"
|
||||
#include "drivers/SerialBase.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "Callback.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
|
||||
/** mock Low Power Ticker
|
||||
*
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "SPI.h"
|
||||
#include "inttypes.h"
|
||||
#include "Timeout.h"
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
#define TRACE_GROUP "AtRF"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,21 @@
|
|||
#include "platform/PlatformMutex.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** \defgroup mbed-os-public Public API */
|
||||
|
||||
/** \addtogroup drivers-public-api Drivers
|
||||
* \ingroup mbed-os-public
|
||||
*/
|
||||
|
||||
/** \defgroup drivers-public-api-gpio GPIO
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_AnalogIn AnalogIn class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An analog input, used for reading the voltage on a pin
|
||||
*
|
||||
|
@ -48,7 +62,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class AnalogIn {
|
||||
|
||||
|
@ -58,37 +71,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 +125,11 @@ protected:
|
|||
analogin_t _adc;
|
||||
static SingletonPtr<PlatformMutex> _mutex;
|
||||
#endif //!defined(DOXYGEN_ONLY)
|
||||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 */
|
||||
/** \addtogroup drivers-public-api */
|
||||
|
||||
/**
|
||||
* \defgroup drivers_AnalogOut AnalogOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An analog output, used for setting the voltage on a pin
|
||||
*
|
||||
|
@ -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,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,12 +23,15 @@
|
|||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_BusIn BusIn class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital input bus, used for reading the state of a collection of pins
|
||||
*
|
||||
* @note Synchronization level: Thread safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class BusIn : private NonCopyable<BusIn> {
|
||||
|
||||
|
@ -125,6 +128,8 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,11 @@
|
|||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_BusInOut BusInOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital input output bus, used for setting the state of a collection of pins.
|
||||
* Implemented as an array of DigitalInOut pins, the bus can be constructed by any
|
||||
|
@ -30,7 +34,6 @@ namespace mbed {
|
|||
* capabilities
|
||||
*
|
||||
* @note Synchronization level: Thread safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class BusInOut : private NonCopyable<BusInOut> {
|
||||
|
||||
|
@ -147,6 +150,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,10 +22,13 @@
|
|||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_BusOut BusOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital output bus, used for setting the state of a collection of pins
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class BusOut : private NonCopyable<BusOut> {
|
||||
|
||||
|
@ -125,6 +128,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,19 @@
|
|||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** \defgroup drivers-public-api-can CAN
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_CANMessage CANMessage class
|
||||
* \ingroup drivers-public-api-can
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** CANMessage class
|
||||
*
|
||||
* @note Synchronization level: Thread safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class CANMessage : public CAN_Message {
|
||||
|
||||
|
@ -98,8 +105,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_CAN CAN class
|
||||
* \ingroup drivers-public-api-can
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A can bus client, used for communicating with can devices
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class CAN : private NonCopyable<CAN> {
|
||||
|
||||
|
@ -315,12 +329,15 @@ public:
|
|||
protected:
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
|
||||
can_t _can;
|
||||
Callback<void()> _irq[IrqCnt];
|
||||
PlatformMutex _mutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,13 @@
|
|||
#include "platform/platform.h"
|
||||
|
||||
#include "hal/gpio_api.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_DigitalIn DigitalIn class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital input, used for reading the state of a pin
|
||||
*
|
||||
|
@ -47,7 +50,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class DigitalIn {
|
||||
|
||||
|
@ -72,6 +74,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 +91,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 +125,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,17 @@
|
|||
#include "platform/platform.h"
|
||||
|
||||
#include "hal/gpio_api.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_DigitalInOut DigitalInOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital input/output, used for setting or reading a bi-directional pin
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class DigitalInOut {
|
||||
|
||||
|
@ -81,32 +83,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 +128,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 +152,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,13 @@
|
|||
|
||||
#include "platform/platform.h"
|
||||
#include "hal/gpio_api.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_DigitalOut DigitalOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital output, used for setting the state of a pin
|
||||
*
|
||||
|
@ -42,7 +45,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class DigitalOut {
|
||||
|
||||
|
@ -122,13 +124,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 +146,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,9 +23,20 @@
|
|||
#if DEVICE_ETHERNET || defined(DOXYGEN_ONLY)
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** \ingroup mbed-os-public */
|
||||
/** \addtogroup drivers-public-api */
|
||||
/** @{*/
|
||||
/**
|
||||
* \defgroup drivers_Ethernet Ethernet class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An ethernet interface, to use with the ethernet pins.
|
||||
*
|
||||
* @deprecated
|
||||
* EthInterface is now the preferred way to get an Ethernet object.
|
||||
* Alternatively, use NetworkInterface to get an instance of an appropriate network
|
||||
* interface (WiFi or Ethernet).
|
||||
*
|
||||
* @note Synchronization level: Not protected
|
||||
*
|
||||
|
@ -54,18 +65,28 @@ 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:
|
||||
|
||||
/** Initialize the ethernet interface.
|
||||
/**
|
||||
* @deprecated
|
||||
* Initialize the ethernet interface.
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
Ethernet();
|
||||
|
||||
/** Powers the hardware down.
|
||||
/**
|
||||
* @deprecated
|
||||
* Powers the hardware down.
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
virtual ~Ethernet();
|
||||
|
||||
enum Mode {
|
||||
|
@ -76,7 +97,9 @@ public:
|
|||
FullDuplex100
|
||||
};
|
||||
|
||||
/** Writes into an outgoing ethernet packet.
|
||||
/**
|
||||
* @deprecated
|
||||
* Writes into an outgoing ethernet packet.
|
||||
*
|
||||
* It will append size bytes of data to the previously written bytes.
|
||||
*
|
||||
|
@ -86,9 +109,12 @@ public:
|
|||
* @returns
|
||||
* The number of written bytes.
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
int write(const char *data, int size);
|
||||
|
||||
/** Send an outgoing ethernet packet.
|
||||
/**
|
||||
* @deprecated
|
||||
* Send an outgoing ethernet packet.
|
||||
*
|
||||
* After filling in the data in an ethernet packet it must be send.
|
||||
* Send will provide a new packet to write to.
|
||||
|
@ -97,9 +123,12 @@ public:
|
|||
* 0 if the sending was failed,
|
||||
* or the size of the packet successfully sent.
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
int send();
|
||||
|
||||
/** Receives an arrived ethernet packet.
|
||||
/**
|
||||
* @deprecated
|
||||
* Receives an arrived ethernet packet.
|
||||
*
|
||||
* Receiving an ethernet packet will drop the last received ethernet packet
|
||||
* and make a new ethernet packet ready to read.
|
||||
|
@ -109,9 +138,12 @@ public:
|
|||
* 0 if no ethernet packet is arrived,
|
||||
* or the size of the arrived packet.
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
int receive();
|
||||
|
||||
/** Read from an received ethernet packet.
|
||||
/**
|
||||
* @deprecated
|
||||
* Read from an received ethernet packet.
|
||||
*
|
||||
* After receive returned a number bigger than 0 it is
|
||||
* possible to read bytes from this packet.
|
||||
|
@ -124,15 +156,21 @@ public:
|
|||
* Each time read will start reading after the last read byte before.
|
||||
*
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
int read(char *data, int size);
|
||||
|
||||
/** Gives the ethernet address of the mbed.
|
||||
/**
|
||||
* @deprecated
|
||||
* Gives the ethernet address of the mbed.
|
||||
*
|
||||
* @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in.
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
void address(char *mac);
|
||||
|
||||
/** Returns if an ethernet link is present or not. It takes a while after Ethernet initialization to show up.
|
||||
/**
|
||||
* @deprecated
|
||||
* Returns if an ethernet link is present or not. It takes a while after Ethernet initialization to show up.
|
||||
*
|
||||
* @returns
|
||||
* 0 if no ethernet link is present,
|
||||
|
@ -155,9 +193,12 @@ public:
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
int link();
|
||||
|
||||
/** Sets the speed and duplex parameters of an ethernet link
|
||||
/**
|
||||
* @deprecated
|
||||
* Sets the speed and duplex parameters of an ethernet link
|
||||
*
|
||||
* - AutoNegotiate Auto negotiate speed and duplex
|
||||
* - HalfDuplex10 10 Mbit, half duplex
|
||||
|
@ -167,9 +208,13 @@ public:
|
|||
*
|
||||
* @param mode the speed and duplex mode to set the link to:
|
||||
*/
|
||||
MBED_DEPRECATED("The class has been deprecated and will be removed in the future.")
|
||||
void set_link(Mode mode);
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -49,12 +49,17 @@ extern uint32_t Load$$LR$$LR_IROM1$$Limit[];
|
|||
|
||||
namespace mbed {
|
||||
|
||||
/** \addtogroup drivers */
|
||||
/** \ingroup mbed-os-public */
|
||||
/** \addtogroup drivers-public-api */
|
||||
/** @{*/
|
||||
/**
|
||||
* \defgroup drivers_FlashIAP FlashIAP class
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Flash IAP driver. It invokes flash HAL functions.
|
||||
*
|
||||
* @note Synchronization level: Thread safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class FlashIAP : private NonCopyable<FlashIAP> {
|
||||
public:
|
||||
|
@ -159,6 +164,9 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
||||
} /* namespace mbed */
|
||||
|
||||
#endif /* DEVICE_FLASH */
|
||||
|
|
|
@ -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,19 @@
|
|||
#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 */
|
||||
/** \defgroup drivers-public-api-i2c I2C
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_I2C I2C class
|
||||
* \ingroup drivers-public-api-i2c
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An I2C Master, used for communicating with I2C slave devices
|
||||
*
|
||||
|
@ -70,7 +78,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class I2C : private NonCopyable<I2C> {
|
||||
|
||||
|
@ -242,6 +249,8 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,11 @@
|
|||
#include "hal/i2c_api.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \addtogroup drivers_I2CSlave I2CSlave class
|
||||
* \ingroup drivers-public-api-i2c
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An I2C Slave, used for communicating with an I2C Master device.
|
||||
*
|
||||
|
@ -64,7 +68,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class I2CSlave {
|
||||
|
||||
|
@ -160,6 +163,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,11 @@
|
|||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_InterruptIn InterruptIn class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A digital interrupt input, used to call a function on a rising or falling edge
|
||||
*
|
||||
|
@ -57,7 +61,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class InterruptIn : private NonCopyable<InterruptIn> {
|
||||
|
||||
|
@ -175,6 +178,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,11 @@
|
|||
#include <string.h>
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_InterruptManager InterruptManager class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** 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 +58,6 @@ namespace mbed {
|
|||
* InterruptManager::get()->add_handler(handler, TIMER3_IRQn);
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class InterruptManager : private NonCopyable<InterruptManager> {
|
||||
public:
|
||||
|
@ -170,6 +173,7 @@ public:
|
|||
#if !defined(DOXYGEN_ONLY)
|
||||
private:
|
||||
InterruptManager();
|
||||
|
||||
~InterruptManager();
|
||||
|
||||
void lock();
|
||||
|
@ -203,6 +207,8 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,19 @@
|
|||
#include "hal/lp_ticker_api.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** \defgroup drivers-public-api-ticker Ticker
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_LowPowerTicker LowPowerTicker class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Low Power Ticker
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class LowPowerTicker : public Ticker, private NonCopyable<LowPowerTicker> {
|
||||
|
||||
|
@ -45,6 +52,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,12 +26,15 @@
|
|||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \addtogroup drivers_LowPowerTimeout LowPowerTimeout class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Low Power Timout
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> {
|
||||
#if !defined(DOXYGEN_ONLY)
|
||||
|
@ -43,7 +46,9 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,12 +26,15 @@
|
|||
#include "hal/lp_ticker_api.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \addtogroup drivers_LowPowerTimer LowPowerTimer class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Low power timer
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class LowPowerTimer : public Timer, private NonCopyable<LowPowerTimer> {
|
||||
|
||||
|
@ -42,6 +45,8 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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 mbed-os-public */
|
||||
/** \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
|
||||
|
|
|
@ -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,13 @@
|
|||
#if DEVICE_PORTIN || defined(DOXYGEN_ONLY)
|
||||
|
||||
#include "hal/port_api.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_PortIn PortIn class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A multiple pin digital input
|
||||
*
|
||||
|
@ -51,7 +54,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class PortIn {
|
||||
public:
|
||||
|
@ -61,12 +63,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 +79,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 +92,8 @@ private:
|
|||
port_t _port;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,17 @@
|
|||
#if DEVICE_PORTINOUT || defined(DOXYGEN_ONLY)
|
||||
|
||||
#include "hal/port_api.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_PortInOut PortInOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A multiple pin digital in/out used to set/read multiple bi-directional pins
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class PortInOut {
|
||||
public:
|
||||
|
@ -40,12 +42,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 +65,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 +107,8 @@ private:
|
|||
port_t _port;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,14 @@
|
|||
#if DEVICE_PORTOUT || defined(DOXYGEN_ONLY)
|
||||
|
||||
#include "hal/port_api.h"
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_PortOut PortOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A multiple pin digital output
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
|
@ -50,7 +54,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class PortOut {
|
||||
public:
|
||||
|
@ -60,12 +63,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 +114,8 @@ private:
|
|||
port_t _port;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
102
drivers/PwmOut.h
102
drivers/PwmOut.h
|
@ -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,13 @@
|
|||
|
||||
#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 */
|
||||
/**
|
||||
* \defgroup drivers_PwmOut PwmOut class
|
||||
* \ingroup drivers-public-api-gpio
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A pulse-width modulation digital output
|
||||
*
|
||||
|
@ -48,7 +50,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class PwmOut {
|
||||
|
||||
|
@ -58,20 +59,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 +70,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 +82,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 +91,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 +150,18 @@ 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
|
||||
|
|
|
@ -29,8 +29,15 @@
|
|||
#define ONE_MHZ 1000000
|
||||
|
||||
namespace mbed {
|
||||
/** \defgroup drivers-public-api-spi SPI
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_QSPI QSPI class
|
||||
* \ingroup drivers-public-api-spi
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A QSPI Driver, used for communicating with QSPI slave devices
|
||||
*
|
||||
|
@ -69,7 +76,6 @@ namespace mbed {
|
|||
*
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class QSPI : private NonCopyable<QSPI> {
|
||||
|
||||
|
@ -225,6 +231,8 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,14 +21,21 @@
|
|||
|
||||
#if DEVICE_SERIAL || defined(DOXYGEN_ONLY)
|
||||
|
||||
#include "mbed_toolchain.h"
|
||||
#include "platform/mbed_toolchain.h"
|
||||
#include "drivers/SerialBase.h"
|
||||
#include "hal/serial_api.h"
|
||||
#include "platform/NonCopyable.h"
|
||||
#include <cstdarg>
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** \defgroup drivers-public-api-uart UART
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_RawSerial RawSerial class
|
||||
* \ingroup drivers-public-api-uart
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A serial port (UART) for communication with other serial devices
|
||||
* This is a variation of the Serial class that doesn't use streams,
|
||||
|
@ -51,7 +58,6 @@ namespace mbed {
|
|||
* pc.putc('A');
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class RawSerial: public SerialBase, private NonCopyable<RawSerial> {
|
||||
|
||||
|
@ -105,6 +111,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,14 +22,19 @@
|
|||
#include "reset_reason_api.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** \ingroup mbed-os-public */
|
||||
/** \addtogroup drivers-public-api */
|
||||
/** @{*/
|
||||
/**
|
||||
* \defgroup drivers_ResetReason ResetReason class
|
||||
* @{
|
||||
*/
|
||||
/** A platform-independent method of checking the cause of the last system reset.
|
||||
*
|
||||
* 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
|
||||
|
|
|
@ -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,16 @@
|
|||
#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 */
|
||||
/**
|
||||
* \addtogroup drivers_SPI SPI class
|
||||
* \ingroup drivers-public-api-spi
|
||||
* @{
|
||||
*/
|
||||
|
||||
struct use_gpio_ssel_t { };
|
||||
const use_gpio_ssel_t use_gpio_ssel;
|
||||
|
@ -90,7 +94,6 @@ const use_gpio_ssel_t use_gpio_ssel;
|
|||
* device.unlock();
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class SPI : private NonCopyable<SPI> {
|
||||
|
||||
|
@ -425,6 +428,8 @@ private:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // DEVICE_SPI || DOXYGEN_ONLY
|
||||
|
|
|
@ -25,7 +25,11 @@
|
|||
#include "hal/spi_api.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_SPISlave SPISlave class
|
||||
* \ingroup drivers-public-api-spi
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A SPI slave, used for communicating with a SPI master device.
|
||||
*
|
||||
|
@ -51,7 +55,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class SPISlave : private NonCopyable<SPISlave> {
|
||||
|
||||
|
@ -127,6 +130,8 @@ protected:
|
|||
#endif //!defined(DOXYGEN_ONLY)
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,16 @@
|
|||
#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 */
|
||||
/**
|
||||
* \defgroup drivers_Serial Serial class
|
||||
* \ingroup drivers-public-api-uart
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A serial port (UART) for communication with other serial devices
|
||||
*
|
||||
|
@ -49,7 +52,6 @@ namespace mbed {
|
|||
* pc.printf("Hello World\n");
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
|
||||
|
||||
|
@ -111,6 +113,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,13 +32,16 @@
|
|||
#endif
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_SerialBase SerialBase class
|
||||
* \ingroup drivers-public-api-uart
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** 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 +292,7 @@ protected:
|
|||
virtual ~SerialBase();
|
||||
|
||||
int _base_getc();
|
||||
|
||||
int _base_putc(int c);
|
||||
|
||||
#if DEVICE_SERIAL_ASYNCH
|
||||
|
@ -307,6 +311,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,26 @@
|
|||
#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 {
|
||||
/**
|
||||
* \defgroup drivers_SerialWireOutput SerialWireOutput class
|
||||
* \ingroup drivers-public-api
|
||||
* @{
|
||||
*/
|
||||
|
||||
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 +69,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // DEVICE_ITM
|
||||
|
|
|
@ -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,14 @@
|
|||
#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 */
|
||||
/**
|
||||
* \addtogroup drivers_Ticker Ticker class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A Ticker is used to call a function at a recurring interval
|
||||
*
|
||||
|
@ -62,19 +64,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 +152,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,13 @@
|
|||
|
||||
#include "drivers/Ticker.h"
|
||||
#include "platform/NonCopyable.h"
|
||||
#include "platform/mbed_power_mgmt.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \addtogroup drivers_Timeout Timeout class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A Timeout is used to call a function at a point in the future
|
||||
*
|
||||
|
@ -53,7 +56,6 @@ namespace mbed {
|
|||
* }
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class Timeout : public Ticker, private NonCopyable<Timeout> {
|
||||
|
||||
|
@ -63,6 +65,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,13 @@
|
|||
#include "platform/platform.h"
|
||||
#include "hal/ticker_api.h"
|
||||
#include "platform/NonCopyable.h"
|
||||
#include "platform/mbed_power_mgmt.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \addtogroup drivers_Timer Timer class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A general purpose timer
|
||||
*
|
||||
|
@ -47,7 +50,6 @@ namespace mbed {
|
|||
* printf("Toggle the led takes %d us", end - begin);
|
||||
* }
|
||||
* @endcode
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class Timer : private NonCopyable<Timer> {
|
||||
|
||||
|
@ -108,6 +110,8 @@ protected:
|
|||
};
|
||||
#endif
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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,18 @@
|
|||
#define MBED_TIMEREVENT_H
|
||||
|
||||
#include "hal/ticker_api.h"
|
||||
#include "hal/us_ticker_api.h"
|
||||
#include "platform/NonCopyable.h"
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \addtogroup drivers_TimerEvent TimerEvent class
|
||||
* \ingroup drivers-public-api-ticker
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Base abstraction for timer interrupts
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class TimerEvent : private NonCopyable<TimerEvent> {
|
||||
public:
|
||||
|
@ -82,6 +84,8 @@ protected:
|
|||
#endif
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -39,12 +38,14 @@
|
|||
#endif
|
||||
|
||||
namespace mbed {
|
||||
|
||||
/** \addtogroup drivers */
|
||||
/**
|
||||
* \defgroup drivers_UARTSerial UARTSerial class
|
||||
* \ingroup drivers-public-api-uart
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Class providing buffered UART communication functionality using separate circular buffer for send and receive channels
|
||||
*
|
||||
* @ingroup drivers
|
||||
*/
|
||||
|
||||
class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> {
|
||||
|
@ -312,6 +313,9 @@ private:
|
|||
void dcd_irq(void);
|
||||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} //namespace mbed
|
||||
|
||||
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
|
||||
|
|
|
@ -28,6 +28,17 @@
|
|||
#include "ByteBuffer.h"
|
||||
#include "rtos/EventFlags.h"
|
||||
|
||||
/** \defgroup drivers-public-api-usb USB
|
||||
* \ingroup drivers-public-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBAudio USBAudio class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* USBAudio example
|
||||
*
|
||||
|
@ -373,4 +384,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -27,6 +27,12 @@
|
|||
|
||||
class AsyncOp;
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBCDC USBCDC class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
class USBCDC: public USBDevice {
|
||||
public:
|
||||
|
||||
|
@ -224,4 +230,6 @@ protected:
|
|||
uint32_t _rx_size;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Arm Limited and affiliates.
|
||||
* Copyright (c) 2018-2019, Arm Limited and affiliates.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -38,6 +38,12 @@
|
|||
#define PACKET_TYPE_BROADCAST (1<<3)
|
||||
#define PACKET_TYPE_MULTICAST (1<<4)
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBCDC_ECM USBCDC_ECM class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
class USBCDC_ECM: public USBDevice {
|
||||
public:
|
||||
|
||||
|
@ -267,4 +273,6 @@ private:
|
|||
void _notify_connect();
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -25,7 +25,11 @@
|
|||
#include "USBHID_Types.h"
|
||||
#include "OperationList.h"
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBHID USBHID class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* USBHID example
|
||||
|
@ -268,4 +272,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -74,6 +74,12 @@ enum FUNCTION_KEY {
|
|||
UP_ARROW, /* Up arrow */
|
||||
};
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBKeyboard USBKeyboard class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* USBKeyboard example
|
||||
* @code
|
||||
|
@ -181,7 +187,7 @@ public:
|
|||
virtual void report_rx();
|
||||
|
||||
/**
|
||||
* Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important:
|
||||
* Read status of lock keys. Useful to switch-on/off LEDs according to key pressed. Only the first three bits of the result is important:
|
||||
* - First bit: NUM_LOCK
|
||||
* - Second bit: CAPS_LOCK
|
||||
* - Third bit: SCROLL_LOCK
|
||||
|
@ -209,4 +215,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -30,6 +30,12 @@
|
|||
|
||||
#define DEFAULT_CONFIGURATION (1)
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBMIDI USBMIDI class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* USBMIDI example
|
||||
*
|
||||
|
@ -182,4 +188,6 @@ private:
|
|||
bool _next_message();
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -22,19 +22,25 @@
|
|||
#include "USBDescriptor.h"
|
||||
#include "USBDevice_Types.h"
|
||||
#include "platform/Callback.h"
|
||||
#include "events/PolledQueue.h"
|
||||
#include "events/Task.h"
|
||||
#include "drivers/internal/PolledQueue.h"
|
||||
#include "drivers/internal/Task.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "Mutex.h"
|
||||
|
||||
#include "USBDevice.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBMSD USBMSD class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* USBMSD class: generic class in order to use all kinds of blocks storage chip
|
||||
*
|
||||
* Introduction
|
||||
*
|
||||
* USBMSD implements the MSD protocol. It permits to access a block device (flash, sdcard,...)
|
||||
* USBMSD implements the MSD protocol. It permits to access a block device (flash, SD Card,...)
|
||||
* from a computer over USB.
|
||||
*
|
||||
* @code
|
||||
|
@ -304,4 +310,6 @@ private:
|
|||
void fail();
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -49,6 +49,12 @@ enum MOUSE_TYPE {
|
|||
REL_MOUSE,
|
||||
};
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBMouse USBMouse class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* USBMouse example
|
||||
|
@ -232,4 +238,6 @@ private:
|
|||
bool mouse_send(int8_t x, int8_t y, uint8_t buttons, int8_t z);
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -28,6 +28,12 @@
|
|||
#include "USBHID.h"
|
||||
#include "PlatformMutex.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBMouseKeyboard USBMouseKeyboard class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* USBMouseKeyboard example
|
||||
* @code
|
||||
|
@ -207,7 +213,7 @@ public:
|
|||
bool media_control(MEDIA_KEY key);
|
||||
|
||||
/**
|
||||
* Read status of lock keys. Useful to switch-on/off leds according to key pressed. Only the first three bits of the result is important:
|
||||
* Read status of lock keys. Useful to switch-on/off LEDs according to key pressed. Only the first three bits of the result is important:
|
||||
* - First bit: NUM_LOCK
|
||||
* - Second bit: CAPS_LOCK
|
||||
* - Third bit: SCROLL_LOCK
|
||||
|
@ -243,4 +249,6 @@ private:
|
|||
virtual int _getc();
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -22,6 +22,12 @@
|
|||
#include "Stream.h"
|
||||
#include "Callback.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_USBSerial USBSerial class
|
||||
* \ingroup drivers-public-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* USBSerial example
|
||||
*
|
||||
|
@ -216,4 +222,6 @@ private:
|
|||
void (*_settings_changed_callback)(int baud, int bits, int parity, int stop);
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -28,8 +28,12 @@
|
|||
#include <cstdio>
|
||||
|
||||
namespace mbed {
|
||||
/**
|
||||
* \defgroup drivers_Watchdog Watchdog class
|
||||
* \ingroup drivers-public-api
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** \addtogroup drivers */
|
||||
/** A hardware watchdog timer that resets the system in the case of system
|
||||
* failures or malfunctions. If you fail to refresh the Watchdog timer periodically,
|
||||
* it resets the system after a set period of time.
|
||||
|
@ -56,7 +60,6 @@ namespace mbed {
|
|||
* @endcode
|
||||
*
|
||||
* @note Synchronization level: Interrupt safe
|
||||
* @ingroup drivers
|
||||
*/
|
||||
class Watchdog : private NonCopyable<Watchdog> {
|
||||
public:
|
||||
|
@ -149,6 +152,8 @@ private:
|
|||
bool _running;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // DEVICE_WATCHDOG
|
||||
|
|
|
@ -25,6 +25,21 @@
|
|||
#include "LinkEntry.h"
|
||||
#include "OperationListBase.h"
|
||||
|
||||
/** \defgroup mbed-os-internal Internal API */
|
||||
|
||||
/** \addtogroup drivers-internal-api Drivers
|
||||
* \ingroup mbed-os-internal
|
||||
*/
|
||||
|
||||
/** \defgroup drivers-internal-api-usb USB
|
||||
* \ingroup drivers-internal-api
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup drivers_AsyncOp AsyncOp class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
class AsyncOp: public LinkEntry {
|
||||
public:
|
||||
|
||||
|
@ -109,4 +124,6 @@ private:
|
|||
static void _host_unlock(rtos::Mutex *host_mutex);
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -20,6 +20,11 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* \defgroup drivers_ByteBuffer ByteBuffer class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
class ByteBuffer {
|
||||
public:
|
||||
|
||||
|
@ -116,5 +121,6 @@ private:
|
|||
uint8_t *_buf;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -20,6 +20,12 @@
|
|||
|
||||
#include "USBPhy.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_EndpointResolver EndpointResolver class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility class for resolving endpoints
|
||||
*
|
||||
|
@ -29,7 +35,6 @@
|
|||
* to check if the device has enough resources for the
|
||||
* given configuration.
|
||||
*
|
||||
* @ingroup usb_device_core
|
||||
*/
|
||||
class EndpointResolver {
|
||||
public:
|
||||
|
@ -89,5 +94,6 @@ private:
|
|||
bool _valid;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -20,6 +20,11 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* \defgroup drivers_LinkEntry LinkEntry class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
class LinkEntry {
|
||||
public:
|
||||
LinkEntry(): _next(NULL)
|
||||
|
@ -32,5 +37,6 @@ private:
|
|||
LinkEntry *_next;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -21,6 +21,11 @@
|
|||
#include "LinkEntry.h"
|
||||
#include "LinkedListBase.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_LinkedList LinkedList class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
template<class T>
|
||||
class LinkedList: public LinkedListBase {
|
||||
public:
|
||||
|
@ -58,4 +63,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -20,6 +20,11 @@
|
|||
|
||||
#include "LinkEntry.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_LinkedListBase LinkedListBase class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
class LinkedListBase {
|
||||
public:
|
||||
LinkedListBase();
|
||||
|
@ -58,4 +63,6 @@ private:
|
|||
LinkEntry *_tail;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -40,6 +40,13 @@
|
|||
|
||||
#define CABLE_NUM (0<<4)
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup drivers_MIDIMessage MIDIMessage class
|
||||
* \ingroup drivers-internal-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A MIDI message container */
|
||||
class MIDIMessage {
|
||||
public:
|
||||
|
@ -472,4 +479,6 @@ public:
|
|||
uint16_t length;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -21,6 +21,11 @@
|
|||
#include "OperationListBase.h"
|
||||
#include "AsyncOp.h"
|
||||
|
||||
/**
|
||||
* \defgroup drivers_OperationList OperationList class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
template<class T>
|
||||
class OperationList: public OperationListBase {
|
||||
public:
|
||||
|
@ -75,7 +80,7 @@ public:
|
|||
* Additionally process() must be called on this object
|
||||
* if there are still elements in the list.
|
||||
*
|
||||
* @return The async op at the head of the list
|
||||
* @return The asynchronous op at the head of the list
|
||||
*/
|
||||
T *dequeue_raw()
|
||||
{
|
||||
|
@ -84,4 +89,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -18,11 +18,15 @@
|
|||
#ifndef MBED_OPERATION_LIST_BASE_H
|
||||
#define MBED_OPERATION_LIST_BASE_H
|
||||
|
||||
#include "LinkedListBase.h"
|
||||
#include "Mutex.h"
|
||||
#include "drivers/internal/LinkedListBase.h"
|
||||
|
||||
class AsyncOp;
|
||||
|
||||
/**
|
||||
* \defgroup drivers_OperationListBase OperationListBase class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
class OperationListBase {
|
||||
public:
|
||||
|
||||
|
@ -72,7 +76,7 @@ public:
|
|||
* Additionally process() must be called on this object
|
||||
* if there are still elements in the list.
|
||||
*
|
||||
* @return The async op at the head of the list
|
||||
* @return The asynchronous op at the head of the list
|
||||
*/
|
||||
AsyncOp *dequeue_raw();
|
||||
|
||||
|
@ -94,4 +98,6 @@ private:
|
|||
LinkedListBase _list;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -18,18 +18,20 @@
|
|||
#ifndef POLLED_QUEUE_H
|
||||
#define POLLED_QUEUE_H
|
||||
|
||||
#include "events/TaskQueue.h"
|
||||
#include "drivers/internal/TaskQueue.h"
|
||||
#include "platform/Callback.h"
|
||||
#include "LinkedList.h"
|
||||
namespace events {
|
||||
/** \addtogroup events */
|
||||
|
||||
/**
|
||||
* \defgroup drivers_PolledQueue PolledQueue class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** PolledQueue
|
||||
*
|
||||
* This class is an implementation of TaskQueue which is
|
||||
* processed synchronously by calls to dispatch.
|
||||
* @ingroup events
|
||||
*/
|
||||
class PolledQueue: public TaskQueue {
|
||||
public:
|
||||
|
@ -67,6 +69,7 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -21,8 +21,10 @@
|
|||
#include <stdint.h>
|
||||
|
||||
namespace mbed {
|
||||
/** \addtogroup drivers */
|
||||
/** @{*/
|
||||
/** \addtogroup drivers-internal-api
|
||||
* \ingroup mbed-os-internal
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define MBED_CRC_TABLE_SIZE 256
|
||||
#define MBED_OPTIMIZED_CRC_TABLE_SIZE 16
|
||||
|
@ -35,6 +37,7 @@ extern const uint32_t Table_CRC_32bit_ANSI[MBED_CRC_TABLE_SIZE];
|
|||
extern const uint32_t Table_CRC_32bit_Rev_ANSI[MBED_OPTIMIZED_CRC_TABLE_SIZE];
|
||||
|
||||
/** @}*/
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif
|
|
@ -19,12 +19,14 @@
|
|||
#define MBED_TASK_H
|
||||
|
||||
#include "events/EventQueue.h"
|
||||
#include "events/TaskBase.h"
|
||||
#include "drivers/internal/TaskBase.h"
|
||||
#include "platform/mbed_assert.h"
|
||||
#include "platform/Callback.h"
|
||||
|
||||
namespace events {
|
||||
/** \addtogroup events */
|
||||
/** \addtogroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
template<typename F, typename A1 = void, typename A2 = void, typename A3 = void, typename A4 = void, typename A5 = void>
|
||||
|
@ -583,7 +585,6 @@ private:
|
|||
/** Task
|
||||
*
|
||||
* Representation of a postable task
|
||||
* @ingroup events
|
||||
*/
|
||||
template <typename R, typename A0, typename A1>
|
||||
class Task<R(A0, A1)>: public TaskBase {
|
||||
|
@ -647,8 +648,8 @@ private:
|
|||
All _args;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/** @}*/
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -27,15 +27,18 @@ class Semaphore;
|
|||
}
|
||||
|
||||
namespace events {
|
||||
/** \addtogroup events */
|
||||
|
||||
|
||||
class TaskQueue;
|
||||
|
||||
/**
|
||||
* \defgroup drivers_TaskBase TaskBase class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** TaskBase
|
||||
*
|
||||
* Representation of a caller allocated task
|
||||
* @ingroup events
|
||||
*/
|
||||
class TaskBase : public LinkEntry {
|
||||
public:
|
||||
|
@ -158,8 +161,8 @@ private:
|
|||
void _wake_check();
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/** @}*/
|
|
@ -18,21 +18,23 @@
|
|||
#ifndef TASK_QUEUE_H
|
||||
#define TASK_QUEUE_H
|
||||
|
||||
#include "events/TaskBase.h"
|
||||
#include "drivers/internal/TaskBase.h"
|
||||
#include "platform/Callback.h"
|
||||
#include "mbed_critical.h"
|
||||
|
||||
#define MBED_MAX_TASK_SIZE 32
|
||||
|
||||
namespace events {
|
||||
/** \addtogroup events */
|
||||
|
||||
|
||||
/**
|
||||
* \defgroup drivers_TaskQueue TaskQueue class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** TaskQueue
|
||||
*
|
||||
* Flexible task queue for dispatching tasks
|
||||
* @ingroup events
|
||||
*/
|
||||
class TaskQueue {
|
||||
public:
|
||||
|
@ -67,7 +69,7 @@ public:
|
|||
*
|
||||
* Cancels the given event so the event's memory can be reused.
|
||||
*
|
||||
* The cancel function is irq safe.
|
||||
* The cancel function is IRQ safe.
|
||||
*
|
||||
* If called while the event queue's dispatch loop is active, the cancel
|
||||
* function does not guarantee that the event will not execute after it
|
||||
|
@ -134,6 +136,7 @@ protected:
|
|||
}
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -24,22 +24,15 @@
|
|||
#include "mbed_critical.h"
|
||||
|
||||
/**
|
||||
* \defgroup usb_device USB Device
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup usb_device_core Core
|
||||
*
|
||||
* @ingroup usb_device
|
||||
* \defgroup drivers_USBDevice USBDevice class
|
||||
* \ingroup drivers-internal-api-usb
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Core USB Device driver
|
||||
*
|
||||
* USB driver which wraps and provides synchronization for a USBPhy object.
|
||||
*
|
||||
* @ingroup usb_device_core
|
||||
*/
|
||||
class USBDevice: public USBPhyEvents {
|
||||
public:
|
||||
|
@ -189,13 +182,13 @@ public:
|
|||
void endpoint_stall(usb_ep_t endpoint);
|
||||
|
||||
/**
|
||||
* Unstall an endpoint
|
||||
* Un-stall an endpoint
|
||||
*
|
||||
* Unstalling an endpoint resets data toggle back to DATA0.
|
||||
* Un-stalling an endpoint resets data toggle back to DATA0.
|
||||
* Additionally, if there is an ongoing transfer on this endpoint
|
||||
* it will be aborted.
|
||||
*
|
||||
* @param endpoint Endpoint to unstall
|
||||
* @param endpoint Endpoint to un-stall
|
||||
* @note This endpoint must already have been setup with endpoint_add
|
||||
*/
|
||||
void endpoint_unstall(usb_ep_t endpoint);
|
||||
|
@ -617,4 +610,6 @@ private:
|
|||
uint32_t _locked;
|
||||
};
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif
|
|
@ -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
|
|
@ -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
|
|
@ -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");
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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");
|
|
@ -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");
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -0,0 +1,57 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2019 ARM Limited
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "drivers/PortInOut.h"
|
||||
|
||||
|
||||
#if DEVICE_PORTINOUT
|
||||
|
||||
#include "platform/mbed_critical.h"
|
||||
|
||||
namespace mbed {
|
||||
|
||||
PortInOut::PortInOut(PortName port, int mask)
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
port_init(&_port, port, mask, PIN_INPUT);
|
||||
core_util_critical_section_exit();
|
||||
}
|
||||
|
||||
void PortInOut::output()
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
port_dir(&_port, PIN_OUTPUT);
|
||||
core_util_critical_section_exit();
|
||||
}
|
||||
|
||||
void PortInOut::input()
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
port_dir(&_port, PIN_INPUT);
|
||||
core_util_critical_section_exit();
|
||||
}
|
||||
|
||||
void PortInOut::mode(PinMode mode)
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
port_mode(&_port, mode);
|
||||
core_util_critical_section_exit();
|
||||
}
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // #if DEVICE_PORTINOUT
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue