You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/porting/target/static_pinmap.md
+5-17Lines changed: 5 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -18,24 +18,13 @@ Supported peripherals:
18
18
- `QSPI`
19
19
- `CAN`
20
20
21
-
### Requirements and assumptions
22
-
23
-
1. Provide types which will hold static pinmaps for peripherals(`PWM`, `AnalogIn`, `AnalogOut`, `SPI`, `I2C`, `UART`, `QSPI`, `CAN`).
24
-
2. Provide `xxx_init_direct(xxx_t *obj, static_pinmap_t *)` functions to HAL API (these functions will not use pinmap tables).
25
-
3. Provide additional constructors in drivers layer which will use the `xxx_init_direct(xxx_t *obj, static_pinmap_t*)` HAL functions.
26
-
4. Provide default weak implementations of `xxx_init_direct(static_pinmap_t *)` functions. These functions will call standard `xxx_init(xxx_t *obj, PinName, ...)` function (backward compatibility for targets which do not support static pinmap mechanism).
27
-
5. Provide `constexpr` utility functions to lookup for pin mapping in compile time (requires C++14).
28
-
6. Provide `constexpr` pin-map tables in the header file.
29
-
7. Provide macros for the pin-map tables.
30
-
8. Provide `STATIC_PINMAP_READY` macro in `PinNames.h`.
31
-
32
21
### Implementing static pin-map extension
33
22
34
-
Most of the above points are already implemented. If you want to make static pinmap available on your platform please perform the following steps:
23
+
If you want to make static pinmap available on your platform please perform the following steps:
35
24
36
-
- Provide implementation of `xxx_init_direct(xxx_t *obj, static_pinmap_t *)` function (which does not use pinmap tables).
37
-
- `xxx_init()`will use pinmap tables to determine associated peripheral/function with the given pins, populate the pin-map structure and call void `xxx_init_direct()`.
38
-
- `xxx_init_direct()`will perform peripheral initialization using given static pinmap structure.
25
+
- Provide implementation of `xxx_init_direct(xxx_t *obj, static_pinmap_t *)` function and update implementation of `xxx_init()`.
26
+
- `xxx_init()`usees pinmap tables to determine associated peripheral/function with the given pins, populates the pin-map structure and calls void `xxx_init_direct()`.
27
+
- `xxx_init_direct()`performs peripheral initialization using given static pinmap structure.
39
28
40
29
Example implementation below:
41
30
@@ -68,7 +57,7 @@ Move pinmap tables from `PeripheralPins.c` to `PeripheralPinMaps.h` (create new
68
57
The tables are required in the header file, so can be included and used by constant expression utility functions to find and return mapping without pulling the pin-map table into the image.
69
58
70
59
**Note:**
71
-
Please include `<mstd_cstddef>` module and use `MSTD_CONSTEXPR_OBJ_11` macro instead `constexpr` specifier. This must be done for backward compatibility with `ARM 5` compiler which does not support constant expressions. When `ARM 5` compiler is in use `MSTD_CONSTEXPR_OBJ_11` will be translated to `const`.
60
+
Please include `<mstd_cstddef>` module and use `MSTD_CONSTEXPR_OBJ_11` macro instead `constexpr` specifier. When `PeripheralPinMaps.h` is included from the Mbed OS C++ code, we need to see it as `constexpr`, but if the target code includes it from C, it has to have it as `const`.
72
61
73
62
Example pin-map table below:
74
63
@@ -180,4 +169,3 @@ Run FPGA tests to check if your implementation is valid:
180
169
181
170
**Note:**
182
171
Your target must be ready to run FPGA-Test-Shield tests.
183
-
Currently the following peripherals can be tested: `Analogin`, `SPI`, `I2C`, `PWM`, `UART`.
0 commit comments