}
-/* FIXME: We should add some system-wide way to "reserve" a pin, but anyway this
- * would not prevent anyone from configuring the same pin for two diferent functions
- * when not using our code.
- */
+void set_pins(const struct pio_config* pins)
+{
+ int i = 0;
+ for (i = 0; pins[i].pio.port != 0xFF; i++) {
+ config_pio(&(pins[i].pio), pins[i].mode);
+ }
+}
+
};
#define ARRAY_LAST_PIN {0xFF, 0xFF, 0xFF}
+#define PIO_LAST ARRAY_LAST_PIN
+
+struct pio_config {
+ struct pio pio;
+ uint32_t mode;
+};
+#define ARRAY_LAST_PIO { PIO_LAST, 0xFF }
#define PORT0_NB_PINS 32
/* Configure the pin in the requested function and mode. */
void config_pio(const struct pio* pp, uint32_t mode);
+/* Configure a set (array) of pins in a single loop */
+void set_pins(const struct pio_config* pins);
/****************************************************************************/
/* GPIO Pins */