HiPi
Perl Modules for Raspberry Pi
Version 0.92 - released 28 March 2024

HiPi::Interface::HopeRF69

This module provides a generic interface to the Hope RF69 range of RF transceiver modules. It should work with 315, 433, 868 and 915Mhz versions

It provides the interface to SPI for the Energenie code modules.

It uses HiPi::Device::SPI as a backend.

Methods

Create a new instance of the module class for types RF69W and RF69CW.

use HiPi qw( :rpi :hrf69 );
use HiPi::Interface::HopeRF69;
my $rf = HiPi::Interface::HopeRF69->new(
    devicename   => '/dev/spidev0.1',
    speed        => 9600000,
    reset_gpio   => undef,
);

Create a new instance of the module class for types RF69HW and RF69HCW.

use HiPi qw( :rpi :hrf69 );
use HiPi::Interface::HopeRF69;
my $rf = HiPi::Interface::HopeRF69->new(
    devicename          => '/dev/spidev0.1',
    speed               => 9600000,
    high_power_module   => 1,
    max_power_on        => 1,
    reset_gpio          => undef,
);

Send bytes in $arrayref as FSK message

$rf->send_message( \@messagebytes );

Send bytes in arrayref as OOK message with optional number of repeat cycles

$rf->send_ook_message( \@messagebytes );

Receive an FSK message. If there is a message in the FIFO it will be returned as a reference to an array of bytes received. If the FIFO is empty, method returns undef.

my $message = $rf->receive_message;
if( $message ) {
    my @bytes = @$message;
}

Reset the RF69 board using the reset_gpio pin specified ( if any ) in the constructor.

$rf->reset;