diff --git a/.gitignore b/.gitignore index 3214de6..e1478a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ config.custom.h +settings.custom.h Reports/*.pdf diff --git a/iot/main/gps.h b/iot/main/gps.h index 40d2ee4..85c79b5 100644 --- a/iot/main/gps.h +++ b/iot/main/gps.h @@ -22,7 +22,7 @@ void gps_fetch(); * Call gps_fetch() first. * @return TinyGPSLocation The current location. */ -TinyGPSLocation gps_info(); +TinyGPSPlus gps_info(); /** * Ends the connection to the GPS device and puts it to sleep in order to save diff --git a/iot/main/radio.cpp b/iot/main/radio.cpp index a83ca9e..6f76a70 100644 --- a/iot/main/radio.cpp +++ b/iot/main/radio.cpp @@ -1,9 +1,9 @@ -#pragma once - #include #include #include +#include "settings.h" + // Global static variable that's used to detect when LMIC has finished doing it's thing static bool is_sending_complete = false; diff --git a/iot/main/radio.h b/iot/main/radio.h index d572f63..3f1db5e 100644 --- a/iot/main/radio.h +++ b/iot/main/radio.h @@ -10,4 +10,4 @@ void radio_init(); * @param data The message to send. * @param length The length of the given message. */ -void radio_send(byte* data, int length); +bool radio_send(byte* data, int length); diff --git a/iot/main/settings.custom.h.example b/iot/main/settings.custom.h.example new file mode 100644 index 0000000..63bad2b --- /dev/null +++ b/iot/main/settings.custom.h.example @@ -0,0 +1,13 @@ + +// LoRaWAN NwkSKey, network session key +// This is the default Semtech key, which is used by the early prototype TTN +// network. +static const PROGMEM u1_t NWKSKEY[16] = { .... }; + +// LoRaWAN AppSKey, application session key +// This is the default Semtech key, which is used by the early prototype TTN +// network. +static const u1_t PROGMEM APPSKEY[16] = { ..... }; + +// LoRaWAN end-device address (DevAddr) +static const u4_t DEVADDR = 0x....; // <-- Change this address for every node! diff --git a/iot/main/settings.h b/iot/main/settings.h index d49ac0e..a93a3b3 100644 --- a/iot/main/settings.h +++ b/iot/main/settings.h @@ -1,6 +1,17 @@ #pragma once -#include +#include +#include +#include + +#include "settings.custom.h" + +/* + * 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 + * settings.custom.h, and fill in the private keys the program needs to talk + * over LORaWAN. + */ ////////////////////////////////// ////////////// Main ////////////// @@ -20,16 +31,17 @@ /// RFM95 /// ///////////// +// The SPI chip-select pin for the RFM 95 +#define PIN_SPI_CS_RFM95 10 + // Pin mapping const lmic_pinmap lmic_pins = { - .nss = 10, + .nss = PIN_SPI_CS_RFM95, .rxtx = LMIC_UNUSED_PIN, .rst = 9, .dio = {2, 6, 7}, }; -// The SPI chip-select pin for the RFM 95 -#define PIN_SPI_CS_RFM95 10 ///////////////////////////////// ////////////// GPS //////////////