# `Circuits.GPIO.Diagnostics`
[🔗](https://github.com/elixir-circuits/circuits_gpio/blob/v2.3.1/lib/gpio/diagnostics.ex#L6)

Runtime diagnostics

This module provides simple diagnostics to verify GPIO controller and
implementation differences. Along with the device that you're using, this is
super helpful for diagnosing issues since some GPIO features aren't supposed
to work on some devices.

# `gpio_pair`

```elixir
@type gpio_pair() :: {Circuits.GPIO.gpio_spec(), Circuits.GPIO.gpio_spec()}
```

# `report`

```elixir
@spec report() :: String.t()
```

Reminder for how to use report/1

# `report`

```elixir
@spec report([gpio_pair()]) :: boolean()
```

Run GPIO diagnostics and print a report

Connect each output GPIO to the corresponding input GPIO. When using the cdev
stub implementation, any connected pairs can be used. For example, run:

```elixir
Circuits.GPIO.Diagnostics.report([
  {{"gpiochip0", 0}, {"gpiochip0", 1}},
  {{"gpiochip0", 2}, {"gpiochip0", 3}}
])
```

Pass more than one pair to also run multi-GPIO group diagnostics. This
function is intended for IEx prompt usage. See `run/1` for programmatic use.

# `report`

```elixir
@spec report(Circuits.GPIO.gpio_spec(), Circuits.GPIO.gpio_spec()) :: boolean()
```

Run diagnostics and print a report for a single pair of GPIOs

This calls `report/1`.

# `run`

```elixir
@spec run([gpio_pair()]) :: list()
```

Run GPIO tests and return a list of the results

# `run`

```elixir
@spec run(Circuits.GPIO.gpio_spec(), Circuits.GPIO.gpio_spec()) :: list()
```

# `speed_test`

```elixir
@spec speed_test(Circuits.GPIO.gpio_spec()) :: %{
  write_cps: float(),
  read_cps: float(),
  write_one_cps: float(),
  read_one_cps: float()
}
```

Run GPIO API performance tests

Disclaimer: There should be a better way than relying on the Circuits.GPIO
write performance on nearly every device. Write performance shouldn't be
terrible, though.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
