Skip to content

Commit

Permalink
Fix #65: add au921, in866, as923jp variants
Browse files Browse the repository at this point in the history
  • Loading branch information
terrillmoore committed Jun 2, 2018
1 parent f60cd76 commit 3dba35d
Showing 1 changed file with 85 additions and 2 deletions.
87 changes: 85 additions & 2 deletions examples/raw-feather/raw-feather.ino
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,64 @@ void setup() {

// default tx power for US: 21 dBm
LMIC.txpow = 21;
#elif defined(CFG_au921)
// make it easier for test, by pull the parameters up to the top of the
// block. Ideally, we'd use the serial port to drive this; or have
// a voting protocol where one side is elected the controller and
// guides the responder through all the channels, powers, ramps
// the transmit power from min to max, and measures the RSSI and SNR.
// Even more amazing would be a scheme where the controller could
// handle multiple nodes; in that case we'd have a way to do
// production test and qualification. However, using an RWC5020A
// is a much better use of development time.

// set fDownlink true to use a downlink channel; false
// to use an uplink channel. Generally speaking, uplink
// is more interesting, because you can prove that gateways
// *should* be able to hear you.
const static bool fDownlink = false;

// the downlink channel to be used.
const static uint8_t kDownlinkChannel = 3;

// the uplink channel to be used.
const static uint8_t kUplinkChannel = 8 + 3;

// this is automatically set to the proper bandwidth in kHz,
// based on the selected channel.
uint32_t uBandwidth;

if (! fDownlink)
{
if (kUplinkChannel < 64)
{
LMIC.freq = AU921_125kHz_UPFBASE +
kUplinkChannel * AU921_125kHz_UPFSTEP;
uBandwidth = 125;
}
else
{
LMIC.freq = AU921_500kHz_UPFBASE +
(kUplinkChannel - 64) * AU921_500kHz_UPFSTEP;
uBandwidth = 500;
}
}
else
{
// downlink channel
LMIC.freq = AU921_500kHz_DNFBASE +
kDownlinkChannel * AU921_500kHz_DNFSTEP;
uBandwidth = 500;
}

// Use a suitable spreading factor
if (uBandwidth < 500)
LMIC.datarate = AU921_DR_SF7; // DR4
else
LMIC.datarate = AU921_DR_SF12CR; // DR8

// default tx power for AU: 30 dBm
LMIC.txpow = 30;
#elif defined(CFG_as923)
// make it easier for test, by pull the parameters up to the top of the
// block. Ideally, we'd use the serial port to drive this; or have
Expand All @@ -321,7 +379,7 @@ void setup() {
// handle multiple nodes; in that case we'd have a way to do
// production test and qualification. However, using an RWC5020A
// is a much better use of development time.
const static uint8_t kChannel = 1;
const static uint8_t kChannel = 0;
uint32_t uBandwidth;

LMIC.freq = AS923_F1 + kChannel * 200000;
Expand All @@ -333,8 +391,33 @@ void setup() {
else
LMIC.datarate = AS923_DR_SF7B; // DR8

// default tx power for US: 21 dBm
// default tx power for AS: 21 dBm
LMIC.txpow = 16;

if (LMIC_COUNTRY_CODE == LMIC_COUNTRY_CODE_JP)
{
LMIC.lbt_ticks = us2osticks(AS923JP_LBT_US);
LMIC.lbt_dbmax = AS923JP_LBT_DB_MAX;
}
#elif defined(CFG_in866)
// make it easier for test, by pull the parameters up to the top of the
// block. Ideally, we'd use the serial port to drive this; or have
// a voting protocol where one side is elected the controller and
// guides the responder through all the channels, powers, ramps
// the transmit power from min to max, and measures the RSSI and SNR.
// Even more amazing would be a scheme where the controller could
// handle multiple nodes; in that case we'd have a way to do
// production test and qualification. However, using an RWC5020A
// is a much better use of development time.
const static uint8_t kChannel = 0;
uint32_t uBandwidth;

LMIC.freq = IN866_F1 + kChannel * 200000;
uBandwidth = 125;

LMIC.datarate = IN866_DR_SF7; // DR7
// default tx power for IN: 30 dBm
LMIC.txpow = IN866_TX_EIRP_MAX_DBM;
#else
# error Unsupported LMIC regional configuration.
#endif
Expand Down

0 comments on commit 3dba35d

Please sign in to comment.