# `CircuitsSim.SPI.SPIDevice`
[🔗](https://github.com/elixir-circuits/circuits_sim/blob/v0.1.2/lib/circuits_sim/spi/spi_device.ex#L1)

A protocol for SPI devices

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `handle_message`

```elixir
@spec handle_message(t(), any()) :: {any(), t()}
```

Handle an user message

User messages are used to modify the state of the simulated device outside of
SPI. This can be used to simulate real world changes like temperature changes
affecting a simulated temperature sensor. Another use is as a hook for getting
internal state.

# `render`

```elixir
@spec render(t()) :: IO.ANSI.ansidata()
```

Return the internal state as ASCII art

# `transfer`

```elixir
@spec transfer(t(), binary()) :: {binary(), t()}
```

Transfer data

---

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