prevent passing of temporary pinmap objects

pull/11892/head
Przemyslaw Stekiel 2019-10-24 12:54:40 +02:00
parent 0147af8418
commit 933e77414d
10 changed files with 13 additions and 1 deletions

View File

@ -72,6 +72,7 @@ public:
* @param pinmap reference to structure which holds static pinmap. * @param pinmap reference to structure which holds static pinmap.
*/ */
AnalogIn(const PinMap &pinmap); AnalogIn(const PinMap &pinmap);
AnalogIn(const PinMap &&) = delete; // prevent passing of temporary objects
/** Create an AnalogIn, connected to the specified pin /** Create an AnalogIn, connected to the specified pin
* *

View File

@ -70,6 +70,7 @@ public:
* *
* @param pinmap reference to structure which holds static pinmap. * @param pinmap reference to structure which holds static pinmap.
*/ */
AnalogOut(const PinMap &&) = delete; // prevent passing of temporary objects
AnalogOut(const PinMap &pinmap) AnalogOut(const PinMap &pinmap)
{ {
analogout_init_direct(&_dac, &pinmap); analogout_init_direct(&_dac, &pinmap);

View File

@ -177,6 +177,7 @@ public:
* @param hz the bus frequency in hertz * @param hz the bus frequency in hertz
*/ */
CAN(const can_pinmap_t &pinmap); CAN(const can_pinmap_t &pinmap);
CAN(const can_pinmap_t &&) = delete; // prevent passing of temporary objects
/** Initialize CAN interface and set the frequency /** Initialize CAN interface and set the frequency
* *
@ -185,6 +186,7 @@ public:
* @param hz the bus frequency in hertz * @param hz the bus frequency in hertz
*/ */
CAN(const can_pinmap_t &pinmap, int hz); CAN(const can_pinmap_t &pinmap, int hz);
CAN(const can_pinmap_t &&, int) = delete; // prevent passing of temporary objects
virtual ~CAN(); virtual ~CAN();
@ -359,4 +361,3 @@ protected:
#endif #endif
#endif // MBED_CAN_H #endif // MBED_CAN_H

View File

@ -106,6 +106,7 @@ public:
* @param explicit_pinmap reference to structure which holds static pinmap. * @param explicit_pinmap reference to structure which holds static pinmap.
*/ */
I2C(const i2c_pinmap_t &explicit_pinmap); I2C(const i2c_pinmap_t &explicit_pinmap);
I2C(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
/** Set the frequency of the I2C interface /** Set the frequency of the I2C interface
* *

View File

@ -91,6 +91,7 @@ public:
* @param explicit_pinmap reference to structure which holds static pinmap. * @param explicit_pinmap reference to structure which holds static pinmap.
*/ */
I2CSlave(const i2c_pinmap_t &explicit_pinmap); I2CSlave(const i2c_pinmap_t &explicit_pinmap);
I2CSlave(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
/** Set the frequency of the I2C interface. /** Set the frequency of the I2C interface.
* *

View File

@ -66,6 +66,7 @@ public:
* @param pinmap reference to structure which holds static pinmap. * @param pinmap reference to structure which holds static pinmap.
*/ */
PwmOut(const PinMap &pinmap); PwmOut(const PinMap &pinmap);
PwmOut(const PinMap &&) = delete; // prevent passing of temporary objects
~PwmOut(); ~PwmOut();

View File

@ -113,6 +113,7 @@ public:
* *
*/ */
QSPI(const qspi_pinmap_t &pinmap, int mode = 0); QSPI(const qspi_pinmap_t &pinmap, int mode = 0);
QSPI(const qspi_pinmap_t &&, int = 0) = delete; // prevent passing of temporary objects
virtual ~QSPI() virtual ~QSPI()
{ {

View File

@ -143,6 +143,7 @@ public:
* @param explicit_pinmap reference to structure which holds static pinmap. * @param explicit_pinmap reference to structure which holds static pinmap.
*/ */
SPI(const spi_pinmap_t &explicit_pinmap); SPI(const spi_pinmap_t &explicit_pinmap);
SPI(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
/** Create a SPI master connected to the specified pins. /** Create a SPI master connected to the specified pins.
* *
@ -157,6 +158,7 @@ public:
* @param ssel SPI Chip Select pin. * @param ssel SPI Chip Select pin.
*/ */
SPI(const spi_pinmap_t &explicit_pinmap, PinName ssel); SPI(const spi_pinmap_t &explicit_pinmap, PinName ssel);
SPI(const spi_pinmap_t &&, PinName) = delete; // prevent passing of temporary objects
virtual ~SPI(); virtual ~SPI();

View File

@ -78,6 +78,7 @@ public:
* @param explicit_pinmap reference to structure which holds static pinmap. * @param explicit_pinmap reference to structure which holds static pinmap.
*/ */
SPISlave(const spi_pinmap_t &pinmap); SPISlave(const spi_pinmap_t &pinmap);
SPISlave(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
/** Configure the data transmission format. /** Configure the data transmission format.
* *

View File

@ -83,6 +83,7 @@ public:
* Either tx or rx may be specified as NC (Not Connected) if unused * Either tx or rx may be specified as NC (Not Connected) if unused
*/ */
Serial(const serial_pinmap_t &explicit_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE); Serial(const serial_pinmap_t &explicit_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
Serial(const serial_pinmap_t &&, const char* = NULL, int = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) = delete; // prevent passing of temporary objects
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud /** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
* *
@ -104,6 +105,7 @@ public:
* Either tx or rx may be specified as NC (Not Connected) if unused * Either tx or rx may be specified as NC (Not Connected) if unused
*/ */
Serial(const serial_pinmap_t &explicit_pinmap, int baud); Serial(const serial_pinmap_t &explicit_pinmap, int baud);
Serial(const serial_pinmap_t &&, int) = delete; // prevent passing of temporary objects
/* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through /* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
* the calls from the SerialBase instead for backwards compatibility. This problem is * the calls from the SerialBase instead for backwards compatibility. This problem is