Skip to content

Commit 8be34d1

Browse files
author
Amanda Butler
authored
Merge pull request #930 from c1728p9/pinmap
Add pinmap docs to target porting summary page
2 parents acb397e + eb26764 commit 8be34d1

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 that 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 presence of an NC pin indicates the end of the pin map array. Below is an example implementation of the function to get the serial transmit pin map:
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 that don't use a pinmap, such as ones with peripherals that can connect to any pin, must still define pin maps because testing requires them. For these devices, the pin map 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)