Computing LoRa registers for RadioHead Arduino library

Standard

I have made a spreadsheet to automatically compute the registers’ value for different LoRa configurations for the RadioHead arduino library. The spreadsheet is available via google docs HERE.

To add more configurations to the RadioHead libraries, just copy the column “MODEM_CONFIG_TABLE[]” in “RH_RF95.cpp”, and column “ModemConfigChoice”  in “RH_RF95.h”(see example below). If you are interested in more settings just ask, and I will add them to the spreadsheet.

Example (with edits in bold):

In RH_RF95.cppPROGMEM static const RH_RF95::ModemConfig MODEM_CONFIG_TABLE[] ={
 // 1d, 1e, 26
 { 0x72, 0x74, 0x00}, // Bw125Cr45Sf128 (the chip default)
 { 0x92, 0x74, 0x00}, // Bw500Cr45Sf128
 { 0x48, 0x94, 0x00}, // Bw31_25Cr48Sf512
 { 0x78, 0xc4, 0x00}, // Bw125Cr48Sf4096
 {0x72,0x74,0x00}, //sf128cr4/5bw125
 {0x82,0x74,0x00}, //sf128cr4/5bw250
 {0x92,0x74,0x00}, //sf128cr4/5bw500
 {0x78,0x74,0x00}, //sf128cr4/8bw125
 {0x88,0x74,0x00}, //sf128cr4/8bw250
 {0x98,0x74,0x00}, //sf128cr4/8bw500
 {0x72,0x94,0x00}, //sf512cr4/5bw125
 {0x82,0x94,0x00}, //sf512cr4/5bw250
 {0x92,0x94,0x00}, //sf512cr4/5bw500
 {0x78,0x94,0x00}, //sf512cr4/8bw125
 {0x88,0x94,0x00}, //sf512cr4/8bw250
 {0x98,0x94,0x00}, //sf512cr4/8bw500
 {0x72,0xB4,0x00}, //sf2048cr4/5bw125
 {0x82,0xB4,0x00}, //sf2048cr4/5bw250
 {0x92,0xB4,0x00}, //sf2048cr4/5bw500
 {0x78,0xB4,0x00}, //sf2048cr4/8bw125
 {0x88,0xB4,0x00}, //sf2048cr4/8bw250
 {0x98,0xB4,0x00}, //sf2048cr4/8bw500
 };
In RH_RF95.h

typedef enum
 {
 Bw125Cr45Sf128 = 0, // Default medium range
 Bw500Cr45Sf128,     // Fast+short range
 Bw31_25Cr48Sf512,   // Slow+long range
 Bw125Cr48Sf4096,    // Slow+long range
 sf128cr45bw125,
 sf128cr45bw250,
 sf128cr45bw500,
 sf128cr48bw125,
 sf128cr48bw250,
 sf128cr48bw500,
 sf512cr45bw125,
 sf512cr45bw250,
 sf512cr45bw500,
 sf512cr48bw125,
 sf512cr48bw250,
 sf512cr48bw500,
 sf2048cr45bw125,
 sf2048cr45bw250,
 sf2048cr45bw500,
 sf2048cr48bw125,
 sf2048cr48bw250,
 sf2048cr48bw500,
 } ModemConfigChoice;