RFM69 v0.1.2 RFM69.Device View Source

RFM69.Device is a GenServer to manage the SPI, reset and receive interrupt pids state and provide functions for reading and writing the registers and the FIFO buffer.

Link to this section Summary

Functions

Sets the receive pin interrupt so that the next incoming packet triggers an {:ok, :interrupt_received} message to the caller so that the fifo buffer can be processed to decode the packet

Cancels the recieve pin interrupt. The interrupt is canceled under normal conditions when a response message is triggered, but in the case of a timeout where the caller no longer has interest in the next packet, this function can be used

Initializes the SPI device and the reset and interrupt pins and prepares the RFM69 chip for interaction

Read burst operations happen similarly to write_burst, where the first byte is the register location, and each subsequent byte sent (the value of the tx byte doesn’t matter) results in a byte read with the value of that register location using the same auto-incrementing as in writes

Read single is a subtype of read_burst where only the location byte and a “don’t care” byte are sent in the frame and the second byte returned is the register value

Sets the reset GPIO pin high long enough to power cycle the RFM69 chip

Accepts the SPI device (eg “spidev0.0”), the reset and interrupt GPIO pin numbers and initializes communication with the RFM69 chip

Writing to one or more configuration register locations is done via a “write burst”, where the first byte transferred over SPI is the location logically ORed with 0x80 (the write bit), the second byte is the value for that register location, and each subsequent sent byte is stored in the proceeding register locations. The RFM69 chip auto-increments the register location for each byte so that a single frame of bytes can write the entire register configuration

Writes a full configuration struct to the registers on the chip

Sets the frequency to the appropriate chip registers

Write single is a subtype of write_burst where only the location byte and a single value byte are sent in the frame

Link to this section Functions

Link to this function await_interrupt() View Source
await_interrupt() :: :ok

Sets the receive pin interrupt so that the next incoming packet triggers an {:ok, :interrupt_received} message to the caller so that the fifo buffer can be processed to decode the packet.

Link to this function cancel_interrupt() View Source
cancel_interrupt() :: :ok

Cancels the recieve pin interrupt. The interrupt is canceled under normal conditions when a response message is triggered, but in the case of a timeout where the caller no longer has interest in the next packet, this function can be used.

Initializes the SPI device and the reset and interrupt pins and prepares the RFM69 chip for interaction.

Link to this function read_burst(location, byte_count) View Source
read_burst(byte, pos_integer) :: {:ok, binary}

Read burst operations happen similarly to write_burst, where the first byte is the register location, and each subsequent byte sent (the value of the tx byte doesn’t matter) results in a byte read with the value of that register location using the same auto-incrementing as in writes.

Link to this function read_single(location) View Source
read_single(byte) :: {:ok, byte}

Read single is a subtype of read_burst where only the location byte and a “don’t care” byte are sent in the frame and the second byte returned is the register value.

Sets the reset GPIO pin high long enough to power cycle the RFM69 chip

Link to this function start_link(spi_device, reset_pin, interrupt_pin) View Source

Accepts the SPI device (eg “spidev0.0”), the reset and interrupt GPIO pin numbers and initializes communication with the RFM69 chip.

Link to this function write_burst(location, data) View Source
write_burst(byte, binary) :: :ok

Writing to one or more configuration register locations is done via a “write burst”, where the first byte transferred over SPI is the location logically ORed with 0x80 (the write bit), the second byte is the value for that register location, and each subsequent sent byte is stored in the proceeding register locations. The RFM69 chip auto-increments the register location for each byte so that a single frame of bytes can write the entire register configuration.

Link to this function write_configuration(rf_config) View Source
write_configuration(RFM69.Configuration.t) :: :ok

Writes a full configuration struct to the registers on the chip.

Link to this function write_frequency(frequency_in_hz) View Source
write_frequency(pos_integer) :: {:ok}

Sets the frequency to the appropriate chip registers

Link to this function write_single(location, data) View Source
write_single(byte, byte) :: :ok

Write single is a subtype of write_burst where only the location byte and a single value byte are sent in the frame.