Skip to content

Commit e5a6e56

Browse files
committed
Stop setting configuration on init
1 parent dd02fa4 commit e5a6e56

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

lib/rfm69/device.ex

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,19 @@ defmodule RFM69.Device do
1818
Accepts the SPI device (eg "spidev0.0"), the reset and interrupt GPIO pin numbers and initializes communication with
1919
the RFM69 chip.
2020
"""
21-
def start_link(spi_device, reset_pin, interrupt_pin, configuration = %Configuration{}) do
22-
GenServer.start_link(__MODULE__, [spi_device, reset_pin, interrupt_pin, configuration], name: __MODULE__)
21+
def start_link(spi_device, reset_pin, interrupt_pin) do
22+
GenServer.start_link(__MODULE__, [spi_device, reset_pin, interrupt_pin], name: __MODULE__)
2323
end
2424

2525
@doc """
2626
Initializes the SPI device and the reset and interrupt pins and prepares the RFM69 chip for interaction.
2727
"""
28-
def init([spi_device, reset_pin, interrupt_pin, configuration]) do
28+
def init([spi_device, reset_pin, interrupt_pin]) do
2929
with {:ok, spi_pid} <- SPI.start_link(spi_device, speed_hz: 6_000_000),
3030
{:ok, reset_pid} <- GPIO.start_link(reset_pin, :output),
3131
{:ok, interrupt_pid} <- GPIO.start_link(interrupt_pin, :input),
3232
:ok <- GPIO.write(reset_pid, 0),
33-
{:ok, <<0x24>>} <- _read_burst(spi_pid, @hardware_version, 1),
34-
configuration_bytes <- Configuration.to_binary(configuration),
35-
_write_burst(spi_pid, @configuration_start, configuration_bytes) do
33+
{:ok, <<0x24>>} <- _read_burst(spi_pid, @hardware_version, 1) do
3634

3735
{:ok, %{spi_pid: spi_pid, reset_pid: reset_pid, interrupt_pid: interrupt_pid}}
3836
else

0 commit comments

Comments
 (0)