Skip to content

Commit b531ca6

Browse files
author
Filip Jagodzinski
committed
STM: HAL: Add a restricted peripherals list
Add the STDIO_UART peripheral to pinmap_restricted_peripherals(). This peripheral cannot be tested as it is essential for the greentea communication. This patch is for ST only; other target families may use the same value for different types of peripherals, e.g. UART_0 == I2C_0 == SPI_0. Rename pinmap.c to pinmap.cpp to overcome a C restriction of constant array initializer elements only.
1 parent e2cd417 commit b531ca6

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

targets/TARGET_STM/pinmap.c renamed to targets/TARGET_STM/pinmap.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@
3232
#include "PortNames.h"
3333
#include "mbed_error.h"
3434
#include "pin_device.h"
35+
#include "PeripheralPins.h"
3536

36-
extern GPIO_TypeDef *Set_GPIO_Clock(uint32_t port_idx);
37+
extern "C" GPIO_TypeDef *Set_GPIO_Clock(uint32_t port_idx);
3738

3839
const uint32_t ll_pin_defines[16] = {
3940
LL_GPIO_PIN_0,
@@ -197,3 +198,27 @@ void pin_mode(PinName pin, PinMode mode)
197198
LL_HSEM_ReleaseLock(HSEM, CFG_HW_GPIO_SEMID, HSEM_CR_COREID_CURRENT);
198199
#endif /* DUAL_CORE */
199200
}
201+
202+
/**
203+
* List of peripherals excluded from testing
204+
*/
205+
const PeripheralList *pinmap_restricted_peripherals()
206+
{
207+
#if DEVICE_SERIAL
208+
static const int stdio_uart = pinmap_peripheral(STDIO_UART_TX, PinMap_UART_TX);
209+
static const int peripherals[] = {
210+
stdio_uart
211+
};
212+
static const PeripheralList peripheral_list = {
213+
sizeof peripherals / sizeof peripherals[0],
214+
peripherals
215+
};
216+
return &peripheral_list;
217+
#else
218+
static const PeripheralList peripheral_list = {
219+
0,
220+
0
221+
};
222+
return &peripheral_list;
223+
#endif
224+
}

0 commit comments

Comments
 (0)