Skip to content

Commit 3927aae

Browse files
authored
Merge pull request #11820 from mprse/explicit_to_static
Change `explicit pinmap` to `static pinmap`
2 parents 4a689ff + 25b8101 commit 3927aae

File tree

60 files changed

+152
-148
lines changed

Some content is hidden

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

60 files changed

+152
-148
lines changed

TESTS/mbed_hal_fpga_ci_test_shield/analogin/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "greentea-client/test_env.h"
2929
#include "mbed.h"
3030
#include "pinmap.h"
31-
#include "hal/explicit_pinmap.h"
31+
#include "hal/static_pinmap.h"
3232
#include "test_utils.h"
3333
#include "MbedTester.h"
3434
#include "analogin_fpga_test.h"

TESTS/mbed_hal_fpga_ci_test_shield/i2c/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "mbed.h"
3030
#include "i2c_api.h"
3131
#include "pinmap.h"
32-
#include "hal/explicit_pinmap.h"
32+
#include "hal/static_pinmap.h"
3333
#include "test_utils.h"
3434
#include "I2CTester.h"
3535
#include "i2c_fpga_test.h"
@@ -69,11 +69,11 @@ void fpga_i2c_test_write(PinName sda, PinName scl)
6969
i2c_t i2c;
7070
memset(&i2c, 0, sizeof(i2c));
7171
if (init_direct) {
72-
#if EXPLICIT_PINMAP_READY
72+
#if STATIC_PINMAP_READY
7373
const i2c_pinmap_t pinmap = get_i2c_pinmap(sda, scl);
7474
i2c_init_direct(&i2c, &pinmap);
7575
#else
76-
//skip this test case if explicit pinmap is not supported
76+
//skip this test case if static pinmap is not supported
7777
return;
7878
#endif
7979
} else {

TESTS/mbed_hal_fpga_ci_test_shield/pwm/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "mbed.h"
3030
#include "MbedTester.h"
3131
#include "pinmap.h"
32-
#include "hal/explicit_pinmap.h"
32+
#include "hal/static_pinmap.h"
3333
#include "test_utils.h"
3434
#include "pwm_fpga_test.h"
3535

TESTS/mbed_hal_fpga_ci_test_shield/spi/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "mbed.h"
3030
#include "SPIMasterTester.h"
3131
#include "pinmap.h"
32-
#include "hal/explicit_pinmap.h"
32+
#include "hal/static_pinmap.h"
3333
#include "test_utils.h"
3434
#include "spi_fpga_test.h"
3535

TESTS/mbed_hal_fpga_ci_test_shield/uart/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "serial_api.h"
3535
#include "us_ticker_api.h"
3636
#include "uart_fpga_test.h"
37-
#include "hal/explicit_pinmap.h"
37+
#include "hal/static_pinmap.h"
3838

3939
using namespace utest::v1;
4040

@@ -128,11 +128,11 @@ static void uart_test_common(int baudrate, int data_bits, SerialParity parity, i
128128
#if DEVICE_SERIAL_FC
129129
if (use_flow_control) {
130130
if (init_direct) {
131-
#if EXPLICIT_PINMAP_READY
131+
#if STATIC_PINMAP_READY
132132
const serial_fc_pinmap_t pinmap = get_uart_fc_pinmap(rts, cts);
133133
serial_set_flow_control_direct(&serial, FlowControlRTSCTS, &pinmap);
134134
#else
135-
//skip this test case if explicit pinmap is not supported
135+
//skip this test case if static pinmap is not supported
136136
return;
137137
#endif
138138
} else {

UNITTESTS/stubs/pwmout_api_stub.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ void pwmout_init(pwmout_t *obj, PinName pin)
2121
{
2222
}
2323

24+
void pwmout_init_direct(pwmout_t *obj, const PinMap *pinmap)
25+
{
26+
}
27+
2428
void pwmout_free(pwmout_t *obj)
2529
{
2630
}

drivers/I2C.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ class I2C : private NonCopyable<I2C> {
103103

104104
/** Create an I2C Master interface, connected to the specified pins
105105
*
106-
* @param explicit_pinmap reference to structure which holds static pinmap.
106+
* @param static_pinmap reference to structure which holds static pinmap.
107107
*/
108-
I2C(const i2c_pinmap_t &explicit_pinmap);
108+
I2C(const i2c_pinmap_t &static_pinmap);
109109
I2C(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
110110

111111
/** Set the frequency of the I2C interface

drivers/I2CSlave.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ class I2CSlave {
8888

8989
/** Create an I2C Slave interface, connected to the specified pins.
9090
*
91-
* @param explicit_pinmap reference to structure which holds static pinmap.
91+
* @param static_pinmap reference to structure which holds static pinmap.
9292
*/
93-
I2CSlave(const i2c_pinmap_t &explicit_pinmap);
93+
I2CSlave(const i2c_pinmap_t &static_pinmap);
9494
I2CSlave(const i2c_pinmap_t &&) = delete; // prevent passing of temporary objects
9595

9696
/** Set the frequency of the I2C interface.

drivers/QSPI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class QSPI : private NonCopyable<QSPI> {
235235
int _mode; //SPI mode
236236
bool _initialized;
237237
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;
238+
const qspi_pinmap_t *_static_pinmap;
239239
bool (QSPI::* _init_func)(void);
240240

241241
private:

drivers/SPI.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ class SPI : private NonCopyable<SPI> {
140140
*
141141
* @note You can specify mosi or miso as NC if not used.
142142
*
143-
* @param explicit_pinmap reference to structure which holds static pinmap.
143+
* @param static_pinmap reference to structure which holds static pinmap.
144144
*/
145-
SPI(const spi_pinmap_t &explicit_pinmap);
145+
SPI(const spi_pinmap_t &static_pinmap);
146146
SPI(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects
147147

148148
/** Create a SPI master connected to the specified pins.
@@ -154,10 +154,10 @@ class SPI : private NonCopyable<SPI> {
154154
*
155155
* @note You can specify mosi or miso as NC if not used.
156156
*
157-
* @param explicit_pinmap reference to structure which holds static pinmap.
157+
* @param static_pinmap reference to structure which holds static pinmap.
158158
* @param ssel SPI Chip Select pin.
159159
*/
160-
SPI(const spi_pinmap_t &explicit_pinmap, PinName ssel);
160+
SPI(const spi_pinmap_t &static_pinmap, PinName ssel);
161161
SPI(const spi_pinmap_t &&, PinName) = delete; // prevent passing of temporary objects
162162

163163
virtual ~SPI();
@@ -438,7 +438,7 @@ class SPI : private NonCopyable<SPI> {
438438
/* Select count to handle re-entrant selection */
439439
int8_t _select_count;
440440
/* Static pinmap data */
441-
const spi_pinmap_t *_explicit_pinmap;
441+
const spi_pinmap_t *_static_pinmap;
442442
/* SPI peripheral name */
443443
SPIName _peripheral_name;
444444
/* Pointer to spi init function */

drivers/SPISlave.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class SPISlave : private NonCopyable<SPISlave> {
7575
*
7676
* @note Either mosi or miso can be specified as NC if not used.
7777
*
78-
* @param explicit_pinmap reference to structure which holds static pinmap.
78+
* @param static_pinmap reference to structure which holds static pinmap.
7979
*/
8080
SPISlave(const spi_pinmap_t &pinmap);
8181
SPISlave(const spi_pinmap_t &&) = delete; // prevent passing of temporary objects

drivers/Serial.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
7575

7676
/** Create a Serial port, connected to the specified transmit and receive pins
7777
*
78-
* @param explicit_pinmap reference to structure which holds static pinmap.
78+
* @param static_pinmap reference to structure which holds static pinmap.
7979
* @param name The name of the stream associated with this serial port (optional)
8080
* @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE or 9600)
8181
*
8282
* @note
8383
* Either tx or rx may be specified as NC (Not Connected) if unused
8484
*/
85-
Serial(const serial_pinmap_t &explicit_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
85+
Serial(const serial_pinmap_t &static_pinmap, const char *name = NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
8686
Serial(const serial_pinmap_t &&, const char * = NULL, int = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) = delete; // prevent passing of temporary objects
8787

8888
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
@@ -98,13 +98,13 @@ class Serial : public SerialBase, public Stream, private NonCopyable<Serial> {
9898

9999
/** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
100100
*
101-
* @param explicit_pinmap reference to structure which holds static pinmap.
101+
* @param static_pinmap reference to structure which holds static pinmap.
102102
* @param baud The baud rate of the serial port
103103
*
104104
* @note
105105
* Either tx or rx may be specified as NC (Not Connected) if unused
106106
*/
107-
Serial(const serial_pinmap_t &explicit_pinmap, int baud);
107+
Serial(const serial_pinmap_t &static_pinmap, int baud);
108108
Serial(const serial_pinmap_t &&, int) = delete; // prevent passing of temporary objects
109109

110110
/* Stream gives us a FileHandle with non-functional poll()/readable()/writable. Pass through

drivers/SerialBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class SerialBase : private NonCopyable<SerialBase> {
206206
* @param type the flow control type (Disabled, RTS, CTS, RTSCTS)
207207
* @param pinmap reference to structure which holds static pinmap
208208
*/
209-
void set_flow_control(Flow type, const serial_fc_pinmap_t &explicit_pinmap);
209+
void set_flow_control(Flow type, const serial_fc_pinmap_t &static_pinmap);
210210
#endif
211211

212212
static void _irq_handler(uint32_t id, SerialIrq irq_type);
@@ -320,7 +320,7 @@ class SerialBase : private NonCopyable<SerialBase> {
320320
#if !defined(DOXYGEN_ONLY)
321321
protected:
322322
SerialBase(PinName tx, PinName rx, int baud);
323-
SerialBase(const serial_pinmap_t &explicit_pinmap, int baud);
323+
SerialBase(const serial_pinmap_t &static_pinmap, int baud);
324324
virtual ~SerialBase();
325325

326326
int _base_getc();

drivers/UARTSerial.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UA
6060
UARTSerial(PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
6161

6262
/** Create a UARTSerial port, connected to the specified transmit and receive pins, with a particular baud rate.
63-
* @param explicit_pinmap reference to structure which holds static pinmap
63+
* @param static_pinmap reference to structure which holds static pinmap
6464
* @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
6565
*/
66-
UARTSerial(const serial_pinmap_t &explicit_pinmap, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
66+
UARTSerial(const serial_pinmap_t &static_pinmap, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
6767

6868
virtual ~UARTSerial();
6969

drivers/source/I2C.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ I2C::I2C(PinName sda, PinName scl) :
4747
unlock();
4848
}
4949

50-
I2C::I2C(const i2c_pinmap_t &explicit_pinmap) :
50+
I2C::I2C(const i2c_pinmap_t &static_pinmap) :
5151
#if DEVICE_I2C_ASYNCH
5252
_irq(this), _usage(DMA_USAGE_NEVER), _deep_sleep_locked(false),
5353
#endif
5454
_i2c(), _hz(100000)
5555
{
5656
lock();
5757
// The init function also set the frequency to 100000
58-
_sda = explicit_pinmap.sda_pin;
59-
_scl = explicit_pinmap.scl_pin;
60-
recover(explicit_pinmap.sda_pin, explicit_pinmap.scl_pin);
61-
i2c_init_direct(&_i2c, &explicit_pinmap);
58+
_sda = static_pinmap.sda_pin;
59+
_scl = static_pinmap.scl_pin;
60+
recover(static_pinmap.sda_pin, static_pinmap.scl_pin);
61+
i2c_init_direct(&_i2c, &static_pinmap);
6262
// Used to avoid unnecessary frequency updates
6363
_owner = this;
6464
unlock();

drivers/source/I2CSlave.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ I2CSlave::I2CSlave(PinName sda, PinName scl) : _i2c()
2727
i2c_slave_mode(&_i2c, 1);
2828
}
2929

30-
I2CSlave::I2CSlave(const i2c_pinmap_t &explicit_pinmap) : _i2c()
30+
I2CSlave::I2CSlave(const i2c_pinmap_t &static_pinmap) : _i2c()
3131
{
32-
i2c_init_direct(&_i2c, &explicit_pinmap);
32+
i2c_init_direct(&_i2c, &static_pinmap);
3333
i2c_frequency(&_i2c, 100000);
3434
i2c_slave_mode(&_i2c, 1);
3535
}

drivers/source/QSPI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ QSPI::QSPI(PinName io0, PinName io1, PinName io2, PinName io3, PinName sclk, Pin
4949
_qspi_io3 = io3;
5050
_qspi_clk = sclk;
5151
_qspi_cs = ssel;
52-
_explicit_pinmap = NULL;
52+
_static_pinmap = NULL;
5353
_inst_width = QSPI_CFG_BUS_SINGLE;
5454
_address_width = QSPI_CFG_BUS_SINGLE;
5555
_address_size = QSPI_CFG_ADDR_SIZE_24;
@@ -75,7 +75,7 @@ QSPI::QSPI(const qspi_pinmap_t &pinmap, int mode) : _qspi()
7575
_qspi_io3 = pinmap.data3_pin;
7676
_qspi_clk = pinmap.sclk_pin;
7777
_qspi_cs = pinmap.ssel_pin;
78-
_explicit_pinmap = &pinmap;
78+
_static_pinmap = &pinmap;
7979
_inst_width = QSPI_CFG_BUS_SINGLE;
8080
_address_width = QSPI_CFG_BUS_SINGLE;
8181
_address_size = QSPI_CFG_ADDR_SIZE_24;
@@ -291,7 +291,7 @@ bool QSPI::_initialize_direct()
291291
return _initialized;
292292
}
293293

294-
qspi_status_t ret = qspi_init_direct(&_qspi, _explicit_pinmap, _hz, _mode);
294+
qspi_status_t ret = qspi_init_direct(&_qspi, _static_pinmap, _hz, _mode);
295295
if (QSPI_STATUS_OK == ret) {
296296
_initialized = true;
297297
} else {

drivers/source/SPI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel) :
3737
_sclk(sclk),
3838
_hw_ssel(ssel),
3939
_sw_ssel(NC),
40-
_explicit_pinmap(NULL),
40+
_static_pinmap(NULL),
4141
_init_func(_do_init)
4242
{
4343
// Need backwards compatibility with HALs not providing API
@@ -59,7 +59,7 @@ SPI::SPI(PinName mosi, PinName miso, PinName sclk, PinName ssel, use_gpio_ssel_t
5959
_sclk(sclk),
6060
_hw_ssel(NC),
6161
_sw_ssel(ssel, 1),
62-
_explicit_pinmap(NULL),
62+
_static_pinmap(NULL),
6363
_init_func(_do_init)
6464
{
6565
// Need backwards compatibility with HALs not providing API
@@ -80,7 +80,7 @@ SPI::SPI(const spi_pinmap_t &pinmap) :
8080
_sclk(pinmap.sclk_pin),
8181
_hw_ssel(pinmap.ssel_pin),
8282
_sw_ssel(NC),
83-
_explicit_pinmap(&pinmap),
83+
_static_pinmap(&pinmap),
8484
_peripheral_name((SPIName)pinmap.peripheral),
8585
_init_func(_do_init_direct)
8686

@@ -97,7 +97,7 @@ SPI::SPI(const spi_pinmap_t &pinmap, PinName ssel) :
9797
_sclk(pinmap.sclk_pin),
9898
_hw_ssel(NC),
9999
_sw_ssel(ssel, 1),
100-
_explicit_pinmap(&pinmap),
100+
_static_pinmap(&pinmap),
101101
_peripheral_name((SPIName)pinmap.peripheral),
102102
_init_func(_do_init_direct)
103103
{
@@ -111,7 +111,7 @@ void SPI::_do_init(SPI *obj)
111111

112112
void SPI::_do_init_direct(SPI *obj)
113113
{
114-
spi_init_direct(&obj->_peripheral->spi, obj->_explicit_pinmap);
114+
spi_init_direct(&obj->_peripheral->spi, obj->_static_pinmap);
115115
}
116116

117117
void SPI::_do_construct()

drivers/source/Serial.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Serial::Serial(PinName tx, PinName rx, const char *name, int baud) : SerialBase(
2424
{
2525
}
2626

27-
Serial::Serial(const serial_pinmap_t &explicit_pinmap, const char *name, int baud) : SerialBase(explicit_pinmap, baud), Stream(name)
27+
Serial::Serial(const serial_pinmap_t &static_pinmap, const char *name, int baud) : SerialBase(static_pinmap, baud), Stream(name)
2828
{
2929
}
3030

3131
Serial::Serial(PinName tx, PinName rx, int baud): SerialBase(tx, rx, baud), Stream(NULL)
3232
{
3333
}
3434

35-
Serial::Serial(const serial_pinmap_t &explicit_pinmap, int baud): SerialBase(explicit_pinmap, baud), Stream(NULL)
35+
Serial::Serial(const serial_pinmap_t &static_pinmap, int baud): SerialBase(static_pinmap, baud), Stream(NULL)
3636
{
3737
}
3838

drivers/source/SerialBase.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ SerialBase::SerialBase(PinName tx, PinName rx, int baud) :
4040
_init();
4141
}
4242

43-
SerialBase::SerialBase(const serial_pinmap_t &explicit_pinmap, int baud) :
43+
SerialBase::SerialBase(const serial_pinmap_t &static_pinmap, int baud) :
4444
#if DEVICE_SERIAL_ASYNCH
4545
_thunk_irq(this), _tx_usage(DMA_USAGE_NEVER),
4646
_rx_usage(DMA_USAGE_NEVER), _tx_callback(NULL),
@@ -49,16 +49,16 @@ SerialBase::SerialBase(const serial_pinmap_t &explicit_pinmap, int baud) :
4949
#endif
5050
_serial(),
5151
_baud(baud),
52-
_tx_pin(explicit_pinmap.tx_pin),
53-
_rx_pin(explicit_pinmap.rx_pin)
52+
_tx_pin(static_pinmap.tx_pin),
53+
_rx_pin(static_pinmap.rx_pin)
5454
{
5555
// No lock needed in the constructor
5656

5757
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
5858
_irq[i] = NULL;
5959
}
6060

61-
serial_init_direct(&_serial, &explicit_pinmap);
61+
serial_init_direct(&_serial, &static_pinmap);
6262
serial_baud(&_serial, _baud);
6363
serial_irq_handler(&_serial, SerialBase::_irq_handler, (uint32_t)this);
6464
}
@@ -316,11 +316,11 @@ void SerialBase::set_flow_control(Flow type, PinName flow1, PinName flow2)
316316
unlock();
317317
}
318318

319-
void SerialBase::set_flow_control(Flow type, const serial_fc_pinmap_t &explicit_pinmap)
319+
void SerialBase::set_flow_control(Flow type, const serial_fc_pinmap_t &static_pinmap)
320320
{
321321
lock();
322322
FlowControl flow_type = (FlowControl)type;
323-
serial_set_flow_control_direct(&_serial, flow_type, &explicit_pinmap);
323+
serial_set_flow_control_direct(&_serial, flow_type, &static_pinmap);
324324
unlock();
325325
}
326326
#endif

0 commit comments

Comments
 (0)