Skip to content

Commit cb67f72

Browse files
committed
Add pinmap docs to target porting summary page
Add information on creating pinmaps for new targets in the porting page.
1 parent cd7cc90 commit cb67f72

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/porting/target/target.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,30 @@ PWMOUT | pwmout_api.h
5454
RTC | rtc_api.h
5555
SLEEP | sleep_api.h
5656
SPI SPISLAVE | spi_api.h
57+
QSPI | qspi_api.h
5758
TRNG | trng_api.h
5859
FLASH | flash_api.h
5960

61+
### Pinmap
62+
63+
All HAL APIs which use pins have functions to get the corresponding pin maps. These functions return a `PinMap` array with each entry containing a pin name, a peripheral and a function. The end of the pin map array is indicated by the presence of a NC pin. Below is an example implementation of the function to get the serial tx pinmap:
64+
65+
```C NOCI
66+
const PinMap PinMap_UART_TX[] = {
67+
{P0_19, UART_0, 1},
68+
{P1_13, UART_0, 3},
69+
{P1_27, UART_0, 2},
70+
{ NC , NC , 0}
71+
};
72+
73+
const PinMap *serial_tx_pinmap()
74+
{
75+
return PinMap_UART_TX;
76+
}
77+
```
78+
79+
Targets which don't make use of a pinmap, such as ones with peripherals that can be connected to any pin, must still define pinmaps as these are needed for testing. For these devices the pinmap does not need to be comprehensive. Instead it should list a representative sample of pins and peripherals so they can be tested appropriately.
80+
6081
### Testing
6182

6283
The Mbed OS HAL provides a set of conformance tests for the Mbed OS HAL APIs. You can use these tests to validate the correctness of your implementation. To run the all of the Mbed OS HAL API tests, use the following command:

0 commit comments

Comments
 (0)