@@ -226,6 +226,17 @@ void test_all_peripherals(std::list<PortType> &matched_ports, std::list<PortType
226
226
}
227
227
}
228
228
229
+ /* *
230
+ * Test function for all pinouts of all peripherals of a given type
231
+ *
232
+ * This template function takes in three template parameters:
233
+ * - PortType - The type of peripheral to test
234
+ * - FormFactorType - The form factor to test on
235
+ * - f - The test function to run.
236
+ *
237
+ * This function is calls the test function multiple times with
238
+ * the appropriate combinations of pins.
239
+ */
229
240
template <typename PortType, typename FormFactorType, typename PortType::TestFunctionType f>
230
241
void all_ports ()
231
242
{
@@ -236,6 +247,17 @@ void all_ports()
236
247
test_all_ports<PortType, FormFactorType, typename PortType::TestFunctionType, f>(matched_ports, not_matched_ports);
237
248
}
238
249
250
+ /* *
251
+ * Test function for one pinout of all peripherals of a given type
252
+ *
253
+ * This template function takes in three template parameters:
254
+ * - PortType - The type of peripheral to test
255
+ * - FormFactorType - The form factor to test on
256
+ * - f - The test function to run.
257
+ *
258
+ * This function is calls the test function once for each peripheral
259
+ * of the given type.
260
+ */
239
261
template <typename PortType, typename FormFactorType, typename PortType::TestFunctionType f>
240
262
void all_peripherals ()
241
263
{
@@ -250,6 +272,17 @@ void all_peripherals()
250
272
test_all_peripherals<PortType, typename PortType::TestFunctionType, f>(matched_ports, not_matched_ports);
251
273
}
252
274
275
+ /* *
276
+ * Test function for one pinout of one peripheral of a given type
277
+ *
278
+ * This template function takes in three template parameters:
279
+ * - PortType - The type of peripheral to test
280
+ * - FormFactorType - The form factor to test on
281
+ * - f - The test function to run.
282
+ *
283
+ * This function is calls the test function once for one peripheral
284
+ * of the given type.
285
+ */
253
286
template <typename PortType, typename FormFactorType, typename PortType::TestFunctionType f>
254
287
void one_peripheral ()
255
288
{
@@ -358,6 +391,13 @@ bool operator== (const Port<N, PinMapType, FormFactorType, FunctionType> &port1,
358
391
return true ;
359
392
}
360
393
394
+ /* *
395
+ * This is a convenience class for use with the above templates
396
+ *
397
+ * This class can be passed as a template parameter to all_ports,
398
+ * all_peripherals or one_peripheral to choose test pins from
399
+ * the default form factor.
400
+ */
361
401
class DefaultFormFactor {
362
402
public:
363
403
static const PinList *pins ()
@@ -376,6 +416,15 @@ class DefaultFormFactor {
376
416
}
377
417
};
378
418
419
+ /*
420
+ * Peripheral port declarations are given below
421
+ *
422
+ * Each Port type represents a set of pins used by a peripheral.
423
+ * The Port typedef is used as a template parameter to the functions
424
+ * all_ports, all_peripherals and one_peripheral to select the peripheral
425
+ * pin set to use for testing.
426
+ */
427
+
379
428
#if DEVICE_SPI
380
429
#include " spi_api.h"
381
430
struct SPIMaps {
0 commit comments