@@ -38,6 +38,11 @@ typedef struct {
3838 const PinName * pins ;
3939} PinList ;
4040
41+ typedef struct {
42+ uint32_t count ;
43+ const int * peripheral ;
44+ } PeripheralList ;
45+
4146void pin_function (PinName pin , int function );
4247void pin_mode (PinName pin , PinMode mode );
4348
@@ -123,6 +128,15 @@ bool pinmap_find_peripheral_pins(const PinList *whitelist, const PinList *blackl
123128 */
124129bool pinmap_list_has_pin (const PinList * list , PinName pin );
125130
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+
126140/**
127141 * Get the pin list of pins to avoid during testing
128142 *
@@ -139,6 +153,31 @@ bool pinmap_list_has_pin(const PinList *list, PinName pin);
139153 */
140154const PinList * pinmap_restricted_pins (void );
141155
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+
142181#ifdef TARGET_FF_ARDUINO
143182
144183/**
0 commit comments