kopia lustrzana https://github.com/helium/longfi-arduino
apply clang-format
rodzic
c5a2b266ac
commit
82b45efb81
24
GPS/GPS.ino
24
GPS/GPS.ino
|
@ -15,7 +15,6 @@
|
|||
*
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* For Helium developers, follow the Arduino Quickstart guide:
|
||||
|
@ -27,29 +26,29 @@
|
|||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#include <lmic.h>
|
||||
#include <arduino_lmic_hal_configuration.h>
|
||||
#include <Adafruit_GPS.h>
|
||||
#include <SPI.h>
|
||||
#include <arduino_lmic.h>
|
||||
#include <arduino_lmic_hal_boards.h>
|
||||
#include <arduino_lmic_hal_configuration.h>
|
||||
#include <arduino_lmic_lorawan_compliance.h>
|
||||
#include <arduino_lmic_user_configuration.h>
|
||||
#include <arduino_lmic.h>
|
||||
#include <hal/hal.h>
|
||||
#include <SPI.h>
|
||||
#include <Adafruit_GPS.h>
|
||||
#include <lmic.h>
|
||||
|
||||
#define GPSSerial Serial1
|
||||
|
||||
// Connect to the GPS on the hardware port
|
||||
Adafruit_GPS GPS(&GPSSerial);
|
||||
|
||||
|
||||
// This is the "App EUI" in Helium. Make sure it is little-endian (lsb).
|
||||
static const u1_t PROGMEM APPEUI[8] = {FILL_ME_IN};
|
||||
void os_getArtEui(u1_t *buf) { memcpy_P(buf, APPEUI, 8); }
|
||||
|
||||
// This should also be in little endian format
|
||||
// These are user configurable values and Helium console permits anything
|
||||
static const u1_t PROGMEM DEVEUI[8]= { 0x48, 0x65, 0x6c, 0x69, 0x75, 0x6d, 0x20, 0x20 };
|
||||
static const u1_t PROGMEM DEVEUI[8] = {0x48, 0x65, 0x6c, 0x69,
|
||||
0x75, 0x6d, 0x20, 0x20};
|
||||
void os_getDevEui(u1_t *buf) { memcpy_P(buf, DEVEUI, 8); }
|
||||
|
||||
// This is the "App Key" in Helium. It is big-endian (msb).
|
||||
|
@ -166,7 +165,8 @@ void onEvent (ev_t ev) {
|
|||
Serial.println(F(" bytes of payload"));
|
||||
}
|
||||
// Schedule next transmission
|
||||
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
|
||||
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL),
|
||||
do_send);
|
||||
break;
|
||||
case EV_LOST_TSYNC:
|
||||
Serial.println(F("EV_LOST_TSYNC"));
|
||||
|
@ -245,7 +245,6 @@ void do_send(osjob_t* j){
|
|||
Serial.println(F("Packet queued"));
|
||||
LMIC_setTxData2(1, payload, idx, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void setup() {
|
||||
|
@ -278,8 +277,9 @@ void setup() {
|
|||
// allow much more clock error than the X/1000 default. See:
|
||||
// https://github.com/mcci-catena/arduino-lorawan/issues/74#issuecomment-462171974
|
||||
// https://github.com/mcci-catena/arduino-lmic/commit/42da75b56#diff-16d75524a9920f5d043fe731a27cf85aL633
|
||||
// the X/1000 means an error rate of 0.1%; the above issue discusses using values up to 10%.
|
||||
// so, values from 10 (10% error, the most lax) to 1000 (0.1% error, the most strict) can be used.
|
||||
// the X/1000 means an error rate of 0.1%; the above issue discusses using
|
||||
// values up to 10%. so, values from 10 (10% error, the most lax) to 1000
|
||||
// (0.1% error, the most strict) can be used.
|
||||
LMIC_setClockError(1 * MAX_CLOCK_ERROR / 40);
|
||||
|
||||
LMIC_setLinkCheckMode(0);
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* For Helium developers, follow the Arduino Quickstart guide:
|
||||
|
@ -27,14 +26,14 @@
|
|||
*
|
||||
*******************************************************************************/
|
||||
|
||||
#include <lmic.h>
|
||||
#include <arduino_lmic_hal_configuration.h>
|
||||
#include <SPI.h>
|
||||
#include <arduino_lmic.h>
|
||||
#include <arduino_lmic_hal_boards.h>
|
||||
#include <arduino_lmic_hal_configuration.h>
|
||||
#include <arduino_lmic_lorawan_compliance.h>
|
||||
#include <arduino_lmic_user_configuration.h>
|
||||
#include <arduino_lmic.h>
|
||||
#include <hal/hal.h>
|
||||
#include <SPI.h>
|
||||
#include <lmic.h>
|
||||
|
||||
// This is the "App EUI" in Helium. Make sure it is little-endian (lsb).
|
||||
static const u1_t PROGMEM APPEUI[8] = {FILL_ME_IN};
|
||||
|
@ -42,7 +41,8 @@ void os_getArtEui (u1_t* buf) { memcpy_P(buf, APPEUI, 8);}
|
|||
|
||||
// This should also be in little endian format
|
||||
// These are user configurable values and Helium console permits anything
|
||||
static const u1_t PROGMEM DEVEUI[8]= { 0x48, 0x65, 0x6c, 0x69, 0x75, 0x6d, 0x20, 0x20 };
|
||||
static const u1_t PROGMEM DEVEUI[8] = {0x48, 0x65, 0x6c, 0x69,
|
||||
0x75, 0x6d, 0x20, 0x20};
|
||||
void os_getDevEui(u1_t *buf) { memcpy_P(buf, DEVEUI, 8); }
|
||||
|
||||
// This is the "App Key" in Helium. It is big-endian (msb).
|
||||
|
@ -92,7 +92,9 @@ const lmic_pinmap lmic_pins = {
|
|||
.nss = 7,
|
||||
.rxtx = 29,
|
||||
.rst = 8,
|
||||
.dio = { 25, // DIO0 (IRQ) is D25
|
||||
.dio =
|
||||
{
|
||||
25, // DIO0 (IRQ) is D25
|
||||
26, // DIO1 is D26
|
||||
27, // DIO2 is D27
|
||||
},
|
||||
|
@ -191,7 +193,8 @@ void onEvent (ev_t ev) {
|
|||
Serial.println(F(" bytes of payload"));
|
||||
}
|
||||
// Schedule next transmission
|
||||
os_setTimedCallback(&sendjob, os_getTime()+sec2osticks(TX_INTERVAL), do_send);
|
||||
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL),
|
||||
do_send);
|
||||
break;
|
||||
case EV_LOST_TSYNC:
|
||||
Serial.println(F("EV_LOST_TSYNC"));
|
||||
|
@ -269,8 +272,9 @@ void setup() {
|
|||
// allow much more clock error than the X/1000 default. See:
|
||||
// https://github.com/mcci-catena/arduino-lorawan/issues/74#issuecomment-462171974
|
||||
// https://github.com/mcci-catena/arduino-lmic/commit/42da75b56#diff-16d75524a9920f5d043fe731a27cf85aL633
|
||||
// the X/1000 means an error rate of 0.1%; the above issue discusses using values up to 10%.
|
||||
// so, values from 10 (10% error, the most lax) to 1000 (0.1% error, the most strict) can be used.
|
||||
// the X/1000 means an error rate of 0.1%; the above issue discusses using
|
||||
// values up to 10%. so, values from 10 (10% error, the most lax) to 1000
|
||||
// (0.1% error, the most strict) can be used.
|
||||
LMIC_setClockError(1 * MAX_CLOCK_ERROR / 40);
|
||||
|
||||
LMIC_setLinkCheckMode(0);
|
||||
|
@ -281,17 +285,13 @@ void setup() {
|
|||
do_send(&sendjob);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
os_runloop_once();
|
||||
}
|
||||
void loop() { os_runloop_once(); }
|
||||
|
||||
namespace Arduino_LMIC {
|
||||
|
||||
class HalConfiguration_Disco_L072cz_Lrwan1_t : public HalConfiguration_t
|
||||
{
|
||||
class HalConfiguration_Disco_L072cz_Lrwan1_t : public HalConfiguration_t {
|
||||
public:
|
||||
enum DIGITAL_PINS : uint8_t
|
||||
{
|
||||
enum DIGITAL_PINS : uint8_t {
|
||||
PIN_SX1276_NSS = 37,
|
||||
PIN_SX1276_NRESET = 33,
|
||||
PIN_SX1276_DIO0 = 38,
|
||||
|
@ -305,25 +305,22 @@ namespace Arduino_LMIC {
|
|||
// save some typing by bringing the pin numbers into scope
|
||||
static HalConfiguration_Disco_L072cz_Lrwan1_t myConfig;
|
||||
|
||||
static const HalPinmap_t myPinmap =
|
||||
{
|
||||
static const HalPinmap_t myPinmap = {
|
||||
.nss = HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_NSS,
|
||||
.rxtx = HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_RXTX,
|
||||
.rst = HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_NRESET,
|
||||
|
||||
.dio = {HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_DIO0,
|
||||
.dio =
|
||||
{
|
||||
HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_DIO0,
|
||||
HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_DIO1,
|
||||
HalConfiguration_Disco_L072cz_Lrwan1_t::PIN_SX1276_DIO2,
|
||||
},
|
||||
.rxtx_rx_active = 1,
|
||||
.rssi_cal = 10,
|
||||
.spi_freq = 8000000, /* 8MHz */
|
||||
.pConfig = &myConfig
|
||||
};
|
||||
.pConfig = &myConfig};
|
||||
|
||||
const HalPinmap_t GetPinmap_Disco_L072cz_Lrwan1(void)
|
||||
{
|
||||
return myPinmap;
|
||||
}
|
||||
const HalPinmap_t GetPinmap_Disco_L072cz_Lrwan1(void) { return myPinmap; }
|
||||
|
||||
}; // end namespace Arduino_LMIC
|
||||
|
|
Ładowanie…
Reference in New Issue