i’m trying to set the pin mapping for a custom pro mini board that isn’t supported within the Arduino_lmic_hal_boards library. I’ve previously been able to get my node to work using the ttn_otaa and ttn_abp sketches, as I just change the pin numbers in the array, but the helium.ino example sketch uses the inbuilt mapping. The example says:
// If your board isn't supported, declare an lmic_pinmap object as static
// or global, and set pPimMap to that pointer.
Can someone explain what this means and what is happening in the background? How can I take my custom pinmapping:
So once you’ve defined your boards pin map in lmic_pins you want to send its memory address to the pointer, you do this by putting an & in front of the variable name.
my code looks like this
// Pin mapping
// We use the built-in mapping -- see src/hal/getpinmap_thisboard.cpp
//
// If your board isn't supported, declare an lmic_pinmap object as static
// or global, and set pPimMap to that pointer.
//
lmic_pinmap lmic_pins = {
.nss = 15,
.rxtx = LMIC_UNUSED_PIN,
.rst = LMIC_UNUSED_PIN,
.dio = {5, 4, LMIC_UNUSED_PIN},
// optional: set polarity of rxtx pin.
.rxtx_rx_active = 0,
// optional: set RSSI cal for listen-before-talk
// this value is in dB, and is added to RSSI
// measured prior to decision.
// Must include noise guardband! Ignored in US,
// EU, IN, other markets where LBT is not required.
.rssi_cal = 10,
// optional: override LMIC_SPI_FREQ if non-zero
.spi_freq = 1000000,
};
const lmic_pinmap *pPinMap = &lmic_pins;
// don't die mysteriously; die noisily.
if (pPinMap == nullptr) {
pinMode(LED_BUILTIN, OUTPUT);
for (;;) {
// flash lights, sleep.
for (int i = 0; i < 5; ++i) {
digitalWrite(LED_BUILTIN, 1);
delay(100);
digitalWrite(LED_BUILTIN, 0);
delay(900);
}
Serial.println(F("board not known to library; add pinmap or update getconfig_thisboard.cpp"));
}
}