[riot-notifications] [RIOT-OS/RIOT] tests: add test for periph_gpio without stdio dep (#16583)

Karl Fessel notifications at github.com
Mon Jul 5 19:26:43 CEST 2021


@kfessel commented on this pull request.

I think "PIN_IN and OUT" need some correlation  and would use macro logic to activate test when the matching PIN_IN and OUT is defined.

I think having default OUT configurations on unknown Board and therefor unknown pins connected to each other is not safe



> +# ================================
+#
+# For each input mode one pin is configured accordingly and an output pin is used to display the
+# current value read. It is suggested that the corresponding output pins are connected to LEDs, so
+# that the output level is visualized.
+#
+# For each GPIO IRQ flank one pin is configured accordingly and an output pin is toggled on each
+# IRQ triggered. Note that no debouncing is done in software, so expect some flickering on the
+# output pin if you don't connect a Schmitt trigger or so to the inputs.
+
+# Pin to use as floating input and corresponding output pin
+PIN_IN          := GPIO_PIN(0, 0)
+PIN_OUT_1       := GPIO_PIN(0, 6)
+
+# Pin to use as input with pull up resistor and corresponding output pin
+PIN_IN_PU       := GPIO_PIN(0, 1)

```suggestion
PIN_IN_2_PU       := GPIO_PIN(0, 1)
```
korrelate to OUT_2

> +static gpio_t pin_out_4 = PIN_OUT_4;
+static gpio_t pin_out_5 = PIN_OUT_5;
+static gpio_t pin_out_6 = PIN_OUT_6;
+
+static void _cb(void *arg)
+{
+    gpio_t *pin = arg;
+    gpio_toggle(*pin);
+}
+
+int main(void)
+{
+    expect(0 == gpio_init(pin_in, GPIO_IN));
+    expect(0 == gpio_init(pin_out_1, GPIO_OUT));
+
+    if (!IS_ACTIVE(NO_PULL_UP)) {

```suggestion
    if (defined(PIN_IN_PU) {
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16583#pullrequestreview-699339324
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210705/d9171f6b/attachment-0001.htm>


More information about the notifications mailing list