Skip to content

Instantly share code, notes, and snippets.

@tmecklem
Created November 8, 2017 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmecklem/b22ad3eb76d3c1307a8ec7710fafd82c to your computer and use it in GitHub Desktop.
Save tmecklem/b22ad3eb76d3c1307a8ec7710fafd82c to your computer and use it in GitHub Desktop.
alias RFM69.{Configuration, Device}
Device.start_link("spidev0.0", 24, 23)
test_configuration = %Configuration{
op_mode: 0x00,
frf: Configuration.frequency_to_registers(916_600_000),
bitrate: Configuration.bitrate_to_registers(16_384),
data_modul: 0x08,
pa_level: 0x5F,
lna: 0x88,
rx_bw: 0x40, # 250kHz with dcc freq shift 2, RxBwMant of 16 and RxBwExp of 0
afc_bw: 0x80, # dcc freq shift of 4
dio_mapping1: 0x80,
dio_mapping2: 0x07,
rssi_thresh: 0xE4,
preamble: 0x0018,
sync_config: 0x98,
sync_value: 0xFF00FF0001010101,
packet_config1: 0x00,
payload_length: 0x00,
fifo_thresh: 0x94,
packet_config2: 0x00
}
Device.write_configuration(test_configuration)
Device.write_single(0x6F, 0x30)
RFM69.set_base_frequency(916.500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment