Skip to content

Commit 3f388ca

Browse files
committed
drivers: Mark non identity types as non copyable with the NonCopyable traits.
Classes changed: CAN, Ethernet, FlashIAP, I2C, InterruptIn, LowPowerTicker, LowPowerTimeout, LowPowerTimer, RawSerial, Serial, SerialBase, SPI, SPISlave, Ticker, Timeout, Timer, TimerEvent and UARTSerial.
1 parent 7f5b992 commit 3f388ca

18 files changed

+36
-18
lines changed

drivers/CAN.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "hal/can_api.h"
2424
#include "platform/Callback.h"
2525
#include "platform/PlatformMutex.h"
26+
#include "platform/NonCopyable.h"
2627

2728
namespace mbed {
2829
/** \addtogroup drivers */
@@ -78,7 +79,7 @@ class CANMessage : public CAN_Message {
7879
/** A can bus client, used for communicating with can devices
7980
* @ingroup drivers
8081
*/
81-
class CAN {
82+
class CAN : private NonCopyable<CAN> {
8283

8384
public:
8485
/** Creates an CAN interface connected to specific pins.

drivers/Ethernet.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define MBED_ETHERNET_H
1818

1919
#include "platform/platform.h"
20+
#include "platform/NonCopyable.h"
2021

2122
#if defined (DEVICE_ETHERNET) || defined(DOXYGEN_ONLY)
2223

@@ -54,7 +55,7 @@ namespace mbed {
5455
* @endcode
5556
* @ingroup drivers
5657
*/
57-
class Ethernet {
58+
class Ethernet : private NonCopyable<Ethernet> {
5859

5960
public:
6061

drivers/FlashIAP.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "flash_api.h"
2828
#include "platform/SingletonPtr.h"
2929
#include "platform/PlatformMutex.h"
30+
#include "platform/NonCopyable.h"
3031

3132
namespace mbed {
3233

@@ -37,7 +38,7 @@ namespace mbed {
3738
* @note Synchronization level: Thread safe
3839
* @ingroup drivers
3940
*/
40-
class FlashIAP {
41+
class FlashIAP : private NonCopyable<FlashIAP> {
4142
public:
4243
FlashIAP();
4344
~FlashIAP();

drivers/I2C.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "hal/i2c_api.h"
2424
#include "platform/SingletonPtr.h"
2525
#include "platform/PlatformMutex.h"
26+
#include "platform/NonCopyable.h"
2627

2728
#if DEVICE_I2C_ASYNCH
2829
#include "platform/CThunk.h"
@@ -53,7 +54,7 @@ namespace mbed {
5354
* @endcode
5455
* @ingroup drivers
5556
*/
56-
class I2C {
57+
class I2C : private NonCopyable<I2C> {
5758

5859
public:
5960
enum RxStatus {

drivers/InterruptIn.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "platform/Callback.h"
2626
#include "platform/mbed_critical.h"
2727
#include "platform/mbed_toolchain.h"
28+
#include "platform/NonCopyable.h"
2829

2930
namespace mbed {
3031
/** \addtogroup drivers */
@@ -56,7 +57,7 @@ namespace mbed {
5657
* @endcode
5758
* @ingroup drivers
5859
*/
59-
class InterruptIn {
60+
class InterruptIn : private NonCopyable<InterruptIn> {
6061

6162
public:
6263

drivers/LowPowerTicker.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "platform/platform.h"
2020
#include "drivers/Ticker.h"
21+
#include "platform/NonCopyable.h"
2122

2223
#if defined (DEVICE_LOWPOWERTIMER) || defined(DOXYGEN_ONLY)
2324

@@ -31,7 +32,7 @@ namespace mbed {
3132
* @note Synchronization level: Interrupt safe
3233
* @ingroup drivers
3334
*/
34-
class LowPowerTicker : public Ticker {
35+
class LowPowerTicker : public Ticker, private NonCopyable<LowPowerTicker> {
3536

3637
public:
3738
LowPowerTicker() : Ticker(get_lp_ticker_data()) {

drivers/LowPowerTimeout.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "hal/lp_ticker_api.h"
2424
#include "drivers/LowPowerTicker.h"
25+
#include "platform/NonCopyable.h"
2526

2627
namespace mbed {
2728
/** \addtogroup drivers */
@@ -31,7 +32,7 @@ namespace mbed {
3132
* @note Synchronization level: Interrupt safe
3233
* @ingroup drivers
3334
*/
34-
class LowPowerTimeout : public LowPowerTicker {
35+
class LowPowerTimeout : public LowPowerTicker, private NonCopyable<LowPowerTimeout> {
3536

3637
private:
3738
virtual void handler(void) {

drivers/LowPowerTimer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "platform/platform.h"
2020
#include "drivers/Timer.h"
21+
#include "platform/NonCopyable.h"
2122

2223
#if defined (DEVICE_LOWPOWERTIMER) || defined(DOXYGEN_ONLY)
2324

@@ -31,7 +32,7 @@ namespace mbed {
3132
* @note Synchronization level: Interrupt safe
3233
* @ingroup drivers
3334
*/
34-
class LowPowerTimer : public Timer {
35+
class LowPowerTimer : public Timer, private NonCopyable<LowPowerTimer> {
3536

3637
public:
3738
LowPowerTimer() : Timer(get_lp_ticker_data()) {

drivers/RawSerial.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include "drivers/SerialBase.h"
2424
#include "hal/serial_api.h"
25+
#include "platform/NonCopyable.h"
2526

2627
namespace mbed {
2728
/** \addtogroup drivers */
@@ -49,7 +50,7 @@ namespace mbed {
4950
* @endcode
5051
* @ingroup drivers
5152
*/
52-
class RawSerial: public SerialBase {
53+
class RawSerial: public SerialBase, private NonCopyable<RawSerial> {
5354

5455
public:
5556
/** Create a RawSerial port, connected to the specified transmit and receive pins, with the specified baud.

drivers/SPI.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "platform/PlatformMutex.h"
2424
#include "hal/spi_api.h"
2525
#include "platform/SingletonPtr.h"
26+
#include "platform/NonCopyable.h"
2627

2728
#if DEVICE_SPI_ASYNCH
2829
#include "platform/CThunk.h"
@@ -72,7 +73,7 @@ namespace mbed {
7273
* @endcode
7374
* @ingroup drivers
7475
*/
75-
class SPI {
76+
class SPI : private NonCopyable<SPI> {
7677

7778
public:
7879

0 commit comments

Comments
 (0)