-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from mcci-catena/issue49
Fix #49: add compilable example, update README, add to travis
- Loading branch information
Showing
3 changed files
with
132 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
Module: simple_feather.ino | ||
Function: | ||
Example app matching the documentation in the project | ||
README.md. | ||
Copyright notice and License: | ||
See LICENSE file accompanying this project. | ||
Author: | ||
Terry Moore, MCCI Corporation November 2018 | ||
Notes: | ||
This app is not complete -- it only presents skeleton | ||
code for the methods you must provide in order to | ||
use this library. However, it compiles! | ||
*/ | ||
|
||
#include <Arduino_LoRaWAN_ttn.h> | ||
|
||
class cMyLoRaWAN : public Arduino_LoRaWAN_ttn { | ||
public: | ||
cMyLoRaWAN() {}; | ||
cMyLoRaWAN(const lmic_pinmap& pinmap) : Arduino_LoRaWAN_ttn(pinmap) {}; | ||
protected: | ||
// you'll need to provide implementations for each of the following. | ||
virtual bool GetOtaaProvisioningInfo(Arduino_LoRaWAN::OtaaProvisioningInfo*) override; | ||
virtual void NetSaveFCntUp(uint32_t uFCntUp) override; | ||
virtual void NetSaveFCntDown(uint32_t uFCntDown) override; | ||
virtual void NetSaveSessionInfo(const SessionInfo &Info, const uint8_t *pExtraInfo, size_t nExtraInfo) override; | ||
}; | ||
|
||
// pinmap - this is for Feather M0 LoRa | ||
const cMyLoRaWAN::lmic_pinmap myPinMap = { | ||
.nss = 8, | ||
.rxtx = cMyLoRaWAN::lmic_pinmap::LMIC_UNUSED_PIN, | ||
.rst = 4, | ||
.dio = { 3, 6, cMyLoRaWAN::lmic_pinmap::LMIC_UNUSED_PIN }, | ||
.rxtx_rx_active = 0, | ||
.rssi_cal = 0, | ||
.spi_freq = 8000000, | ||
}; | ||
|
||
// set up the data structures. | ||
cMyLoRaWAN myLoRaWAN(myPinMap); | ||
|
||
void setup() { | ||
myLoRaWAN.begin(); | ||
} | ||
|
||
void loop() { | ||
myLoRaWAN.loop(); | ||
} | ||
|
||
// this method is called when the LMIC needs OTAA info. | ||
// return false to indicate "no provisioning", otherwise | ||
// fill in the data and return true. | ||
bool | ||
cMyLoRaWAN::GetOtaaProvisioningInfo( | ||
OtaaProvisioningInfo *pInfo | ||
) { | ||
return false; | ||
} | ||
|
||
void | ||
cMyLoRaWAN::NetSaveFCntDown(uint32_t uFCntDown) { | ||
// save uFcntDown somwwhere | ||
} | ||
|
||
void | ||
cMyLoRaWAN::NetSaveFCntUp(uint32_t uFCntUp) { | ||
// save uFCntUp somewhere | ||
} | ||
|
||
void | ||
cMyLoRaWAN::NetSaveSessionInfo( | ||
const SessionInfo &Info, | ||
const uint8_t *pExtraInfo, | ||
size_t nExtraInfo | ||
) { | ||
// save Info somewhere. | ||
} |
0ba36ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
0ba36ff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're welcome.