Fix seriously nasty linking errors

This commit is contained in:
Starbeamrainbowlabs 2019-06-24 14:47:14 +01:00
parent 6a203233fd
commit 1cf542adcd
6 changed files with 35 additions and 14 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
config.custom.h config.custom.h
settings.custom.h settings.custom.cpp
Reports/*.pdf Reports/*.pdf

View File

@ -1,3 +1,9 @@
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
#include "settings.h"
// LoRaWAN NwkSKey, network session key // LoRaWAN NwkSKey, network session key
// This is the default Semtech key, which is used by the early prototype TTN // This is the default Semtech key, which is used by the early prototype TTN
@ -11,3 +17,10 @@ static const u1_t PROGMEM APPSKEY[16] = { ..... };
// LoRaWAN end-device address (DevAddr) // LoRaWAN end-device address (DevAddr)
static const u4_t DEVADDR = 0x....; // <-- Change this address for every node! static const u4_t DEVADDR = 0x....; // <-- Change this address for every node!
const lmic_pinmap lmic_pins = {
.nss = PIN_SPI_CS_RFM95,
.rxtx = LMIC_UNUSED_PIN,
.rst = 9,
.dio = {2, 6, 7},
};

View File

@ -0,0 +1,14 @@
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>
/**
* Don't edit this file - you want to make a copy of settings.custom.cpp, call
* it settings.cpp, and edit that instead.
*/
extern const PROGMEM u1_t NWKSKEY[16];
extern const u1_t PROGMEM APPSKEY[16];
extern const u4_t DEVADDR;
extern const lmic_pinmap lmic_pins;

View File

@ -8,8 +8,8 @@
/* /*
* This is the main settings file - customise it to match your setup. * This is the main settings file - customise it to match your setup.
* Don't forget that you need to take a copy of settings.custom.h.example as * Don't forget that you need to take a copy of settings.custom.cpp.example as
* settings.custom.h, and fill in the private keys the program needs to talk * settings.custom.cpp, and fill in the private keys the program needs to talk
* over LORaWAN. * over LORaWAN.
*/ */
@ -34,13 +34,7 @@
// The SPI chip-select pin for the RFM 95 // The SPI chip-select pin for the RFM 95
#define PIN_SPI_CS_RFM95 10 #define PIN_SPI_CS_RFM95 10
// Pin mapping // Pin mapping - see settings.custom.cpp
const lmic_pinmap lmic_pins = {
.nss = PIN_SPI_CS_RFM95,
.rxtx = LMIC_UNUSED_PIN,
.rst = 9,
.dio = {2, 6, 7},
};
///////////////////////////////// /////////////////////////////////

View File

@ -10,7 +10,7 @@ static bool is_sending_complete = false;
static osjob_t sendjob; static osjob_t sendjob;
void radio_init() { void transmit_init() {
// LMIC init // LMIC init
os_init(); os_init();
// Reset the MAC state. Session and pending data transfers will be discarded. // Reset the MAC state. Session and pending data transfers will be discarded.
@ -66,7 +66,7 @@ void radio_init() {
* @param data The message to send. * @param data The message to send.
* @param length The length of the given message. * @param length The length of the given message.
*/ */
bool radio_send(uint8_t* data, int length) { bool transmit_send(uint8_t* data, int length) {
// Check if there is not a current TX/RX job running // Check if there is not a current TX/RX job running
if (LMIC.opmode & OP_TXRXPEND) { if (LMIC.opmode & OP_TXRXPEND) {
Serial.println(F("OP_TXRXPEND: There's already a job running, not sending")); Serial.println(F("OP_TXRXPEND: There's already a job running, not sending"));

View File

@ -3,11 +3,11 @@
/** /**
* Initialises the RFM95 LoRa radio. * Initialises the RFM95 LoRa radio.
*/ */
void radio_init(); void transmit_init();
/** /**
* Sends a specified message via LoRaWAN. * Sends a specified message via LoRaWAN.
* @param data The message to send. * @param data The message to send.
* @param length The length of the given message. * @param length The length of the given message.
*/ */
bool radio_send(byte* data, int length); bool transmit_send(byte* data, int length);