Skip to content

Commit afa7630

Browse files
authored
Merge pull request #11632 from mprse/explicit_pinmap_gold_2
Add explicit pin-map support for extra targets
2 parents 4e8222a + d38c7d6 commit afa7630

File tree

55 files changed

+2606
-1495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2606
-1495
lines changed

drivers/AnalogIn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class AnalogIn {
7272
* @param pinmap reference to structure which holds static pinmap.
7373
*/
7474
AnalogIn(const PinMap &pinmap);
75+
AnalogIn(const PinMap &&) = delete; // prevent passing of temporary objects
7576

7677
/** Create an AnalogIn, connected to the specified pin
7778
*

drivers/AnalogOut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class AnalogOut {
7070
*
7171
* @param pinmap reference to structure which holds static pinmap.
7272
*/
73+
AnalogOut(const PinMap &&) = delete; // prevent passing of temporary objects
7374
AnalogOut(const PinMap &pinmap)
7475
{
7576
analogout_init_direct(&_dac, &pinmap);

drivers/CAN.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,24 @@ class CAN : private NonCopyable<CAN> {
170170
*/
171171
CAN(PinName rd, PinName td, int hz);
172172

173+
/** Initialize CAN interface
174+
*
175+
* @param pinmap reference to structure which holds static pinmap
176+
* @param td the transmit pin
177+
* @param hz the bus frequency in hertz
178+
*/
179+
CAN(const can_pinmap_t &pinmap);
180+
CAN(const can_pinmap_t &&) = delete; // prevent passing of temporary objects
181+
182+
/** Initialize CAN interface and set the frequency
183+
*
184+
* @param pinmap reference to structure which holds static pinmap
185+
* @param td the transmit pin
186+
* @param hz the bus frequency in hertz
187+
*/
188+
CAN(const can_pinmap_t &pinmap, int hz);
189+
CAN(const can_pinmap_t &&, int) = delete; // prevent passing of temporary objects
190+
173191
virtual ~CAN();
174192

175193
/** Set the frequency of the CAN interface
@@ -343,4 +361,3 @@ class CAN : private NonCopyable<CAN> {
343361
#endif
344362

345363
#endif // MBED_CAN_H
346-

drivers/I2C.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class I2C : private NonCopyable<I2C> {
106106
* @param explicit_pinmap reference to structure which holds static pinmap.
107107
*/
108108
I2C(const i2c_pinmap_t &explicit_pinmap);
109+
I2C(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
109110

110111
/** Set the frequency of the I2C interface
111112
*

drivers/I2CSlave.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class I2CSlave {
9191
* @param explicit_pinmap reference to structure which holds static pinmap.
9292
*/
9393
I2CSlave(const i2c_pinmap_t &explicit_pinmap);
94+
I2CSlave(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
9495

9596
/** Set the frequency of the I2C interface.
9697
*

drivers/PwmOut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class PwmOut {
6666
* @param pinmap reference to structure which holds static pinmap.
6767
*/
6868
PwmOut(const PinMap &pinmap);
69+
PwmOut(const PinMap &&) = delete; // prevent passing of temporary objects
6970

7071
~PwmOut();
7172

drivers/QSPI.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,19 @@ class QSPI : private NonCopyable<QSPI> {
102102
*
103103
*/
104104
QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, PinName ssel = NC, int mode = 0);
105+
106+
/** Create a QSPI master connected to the specified pins
107+
*
108+
* io0-io3 is used to specify the Pins used for Quad SPI mode
109+
*
110+
* @param pinmap reference to structure which holds static pinmap
111+
* @param mode Clock polarity and phase mode (0 - 3) of SPI
112+
* (Default: Mode=0 uses CPOL=0, CPHA=0, Mode=1 uses CPOL=1, CPHA=1)
113+
*
114+
*/
115+
QSPI(const qspi_pinmap_t &pinmap, int mode = 0);
116+
QSPI(const qspi_pinmap_t &&, int = 0) = delete; // prevent passing of temporary objects
117+
105118
virtual ~QSPI()
106119
{
107120
}
@@ -222,13 +235,16 @@ class QSPI : private NonCopyable<QSPI> {
222235
int _mode; //SPI mode
223236
bool _initialized;
224237
PinName _qspi_io0, _qspi_io1, _qspi_io2, _qspi_io3, _qspi_clk, _qspi_cs; //IO lines, clock and chip select
238+
const qspi_pinmap_t *_explicit_pinmap;
239+
bool (QSPI::* _init_func)(void);
225240

226241
private:
227242
/* Private acquire function without locking/unlocking
228243
* Implemented in order to avoid duplicate locking and boost performance
229244
*/
230245
bool _acquire(void);
231246
bool _initialize();
247+
bool _initialize_direct();
232248

233249
/*
234250
* This function builds the qspi command struct to be send to Hal

drivers/SPI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class SPI : private NonCopyable<SPI> {
143143
* @param explicit_pinmap reference to structure which holds static pinmap.
144144
*/
145145
SPI(const spi_pinmap_t &explicit_pinmap);
146+
SPI(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
146147

147148
/** Create a SPI master connected to the specified pins.
148149
*
@@ -157,6 +158,7 @@ class SPI : private NonCopyable<SPI> {
157158
* @param ssel SPI Chip Select pin.
158159
*/
159160
SPI(const spi_pinmap_t &explicit_pinmap, PinName ssel);
161+
SPI(const spi_pinmap_t &&, PinName) = delete; // prevent passing of temporary objects
160162

161163
virtual ~SPI();
162164

drivers/SPISlave.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class SPISlave : private NonCopyable<SPISlave> {
7878
* @param explicit_pinmap reference to structure which holds static pinmap.
7979
*/
8080
SPISlave(const spi_pinmap_t &pinmap);
81+
SPISlave(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
8182

8283
/** Configure the data transmission format.
8384
*

drivers/Serial.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
8383
* Either tx or rx may be specified as NC (Not Connected) if unused
8484
*/
8585
Serial(const serial_pinmap_t &explicit_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
86+
Serial(const serial_pinmap_t &&, const char * = NULL, int = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) = delete; // prevent passing of temporary objects
8687

8788
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
8889
*
@@ -104,6 +105,7 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
104105
* Either tx or rx may be specified as NC (Not Connected) if unused
105106
*/
106107
Serial(const serial_pinmap_t &explicit_pinmap, int baud);
108+
Serial(const serial_pinmap_t &&, int) = delete; // prevent passing of temporary objects
107109

108110
/* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through
109111
* the calls from the SerialBase instead for backwards compatibility. This problem is

0 commit comments

Comments
 (0)