@@ -38,6 +38,11 @@ typedef struct {
38
38
const PinName * pins ;
39
39
} PinList ;
40
40
41
+ typedef struct {
42
+ uint32_t count ;
43
+ const int * peripheral ;
44
+ } PeripheralList ;
45
+
41
46
void pin_function (PinName pin , int function );
42
47
void pin_mode (PinName pin , PinMode mode );
43
48
@@ -123,6 +128,15 @@ bool pinmap_find_peripheral_pins(const PinList *whitelist, const PinList *blackl
123
128
*/
124
129
bool pinmap_list_has_pin (const PinList * list , PinName pin );
125
130
131
+ /**
132
+ * Check if the peripheral is in the list
133
+ *
134
+ * @param list peripheral list to check
135
+ * @param peripheral peripheral to check for in the list
136
+ * @return true if the peripheral is in the list, false otherwise
137
+ */
138
+ bool pinmap_list_has_peripheral (const PeripheralList * list , int peripheral );
139
+
126
140
/**
127
141
* Get the pin list of pins to avoid during testing
128
142
*
@@ -139,6 +153,31 @@ bool pinmap_list_has_pin(const PinList *list, PinName pin);
139
153
*/
140
154
const PinList * pinmap_restricted_pins (void );
141
155
156
+ /**
157
+ * Get the pin list of peripherals to avoid during testing
158
+ *
159
+ * The restricted peripheral list is used to indicate to testing
160
+ * that a peripheral should be skipped due to some caveat about it.
161
+ * For example, using the USB serial port during tests will interfere
162
+ * with the test runner and should be avoided.
163
+ *
164
+ * Targets should override the weak implementation of this
165
+ * function if they have peripherals which should be
166
+ * skipped during testing.
167
+ *
168
+ * @note Some targets use the same value for multiple
169
+ * different types of peripherals. For example SPI 0
170
+ * and UART 0 may both be identified by the peripheral
171
+ * value 0. If your target does this then do not
172
+ * use this function to skip peripherals, as this will
173
+ * unintentionally cause all peripherals with that value
174
+ * to be skipped. Instead these entries should be removed
175
+ * from the peripheral PinMap itself.
176
+ *
177
+ * @return Pointer to a peripheral list of peripheral to avoid
178
+ */
179
+ const PeripheralList * pinmap_restricted_peripherals (void );
180
+
142
181
#ifdef TARGET_FF_ARDUINO
143
182
144
183
/**
0 commit comments