Skip to content

Commit

Permalink
Merge pull request #233 from akshaim/master
Browse files Browse the repository at this point in the history
Support for IN865_867
  • Loading branch information
johanstokking committed May 16, 2018
2 parents 98485a4 + 4d5054b commit 3a01327
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
35 changes: 35 additions & 0 deletions src/TheThingsNetwork.cpp 100755 → 100644
Expand Up @@ -773,6 +773,37 @@ void TheThingsNetwork::configureKR920_923()
sendMacSet(MAC_PWRIDX, TTN_PWRIDX_KR920_923);
}

void TheThingsNetwork::configureIN865_867()
{
sendMacSet(MAC_ADR, "off"); // TODO: remove when ADR is implemented for this plan
sendMacSet(MAC_RX2, "2 866550000"); // SF10

// Disable the three default LoRaWAN channels
sendChSet(MAC_CHANNEL_STATUS, 0, "off");
sendChSet(MAC_CHANNEL_STATUS, 1, "off");
sendChSet(MAC_CHANNEL_STATUS, 2, "off");

// Channel 3
sendChSet(MAC_CHANNEL_DCYCLE, 3, "299");
sendChSet(MAC_CHANNEL_FREQ, 3, "865062500");
sendChSet(MAC_CHANNEL_DRRANGE, 3, "0 5");
sendChSet(MAC_CHANNEL_STATUS, 3, "on");

// Channel 4
sendChSet(MAC_CHANNEL_DCYCLE, 4, "299");
sendChSet(MAC_CHANNEL_FREQ, 4, "865402500");
sendChSet(MAC_CHANNEL_DRRANGE, 4, "0 5");
sendChSet(MAC_CHANNEL_STATUS, 4, "on");

// Channel 5
sendChSet(MAC_CHANNEL_DCYCLE, 5, "299");
sendChSet(MAC_CHANNEL_FREQ, 5, "865985000");
sendChSet(MAC_CHANNEL_DRRANGE, 5, "0 5");
sendChSet(MAC_CHANNEL_STATUS, 5, "on");

sendMacSet(MAC_PWRIDX, TTN_PWRIDX_IN865_867);
}

void TheThingsNetwork::configureChannels(uint8_t fsb)
{
switch (fp)
Expand All @@ -795,6 +826,9 @@ void TheThingsNetwork::configureChannels(uint8_t fsb)
case TTN_FP_KR920_923:
configureKR920_923();
break;
case TTN_FP_IN865_867:
configureIN865_867();
break;
default:
debugPrintMessage(ERR_MESSAGE, ERR_INVALID_FP);
break;
Expand All @@ -808,6 +842,7 @@ bool TheThingsNetwork::setSF(uint8_t sf)
switch (fp)
{
case TTN_FP_EU868:
case TTN_FP_IN865_867:
case TTN_FP_AS920_923:
case TTN_FP_AS923_925:
case TTN_FP_KR920_923:
Expand Down
5 changes: 4 additions & 1 deletion src/TheThingsNetwork.h 100755 → 100644
Expand Up @@ -18,6 +18,7 @@
#define TTN_PWRIDX_AS920_923 "1" // TODO: should be 0, but the current RN2903AS firmware doesn't accept that value (probably still using EU868: 1=14dBm)
#define TTN_PWRIDX_AS923_925 "1" // TODO: should be 0
#define TTN_PWRIDX_KR920_923 "1" // TODO: should be 0
#define TTN_PWRIDX_IN865_867 "1" // TODO: should be 0

#define TTN_BUFFER_SIZE 300

Expand All @@ -38,7 +39,8 @@ enum ttn_fp_t
TTN_FP_AU915,
TTN_FP_AS920_923,
TTN_FP_AS923_925,
TTN_FP_KR920_923
TTN_FP_KR920_923,
TTN_FP_IN865_867
};

class TheThingsNetwork
Expand Down Expand Up @@ -69,6 +71,7 @@ class TheThingsNetwork
void configureAS920_923();
void configureAS923_925();
void configureKR920_923();
void configureIN865_867();
void configureChannels(uint8_t fsb);
bool setSF(uint8_t sf);
bool waitForOk();
Expand Down

0 comments on commit 3a01327

Please sign in to comment.