LoRa regions unittested, stubs licences revisited

pull/8233/head
Antti Kauppila 2018-09-14 13:10:19 +03:00
parent 445384852e
commit 0f8cfd8631
62 changed files with 1073 additions and 287 deletions

View File

@ -18,17 +18,83 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "LoRaPHYAS923.h" #include "LoRaPHYAS923.h"
#include "LoRaPHY_stub.h"
class my_radio : public LoRaRadio
{
public:
virtual void init_radio(radio_events_t *events){};
virtual void radio_reset(){};
virtual void sleep(void){};
virtual void standby(void){};
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
uint32_t datarate, uint8_t coderate,
uint32_t bandwidth_afc, uint16_t preamble_len,
uint16_t symb_timeout, bool fix_len,
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous){};
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
uint8_t coderate, uint16_t preamble_len,
bool fix_len, bool crc_on, bool freq_hop_on,
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
virtual void send(uint8_t *buffer, uint8_t size){};
virtual void receive(void){};
virtual void set_channel(uint32_t freq){};
virtual uint32_t random(void){};
virtual uint8_t get_status(void){return uint8_value;};
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
virtual void set_public_network(bool enable){};
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
virtual bool perform_carrier_sense(radio_modems_t modem,
uint32_t freq,
int16_t rssi_threshold,
uint32_t max_carrier_sense_time){ return bool_value;};
virtual void start_cad(void){};
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
virtual void lock(void){};
virtual void unlock(void){};
bool bool_value;
uint8_t uint8_value;
};
class Test_LoRaPHYAS923 : public testing::Test { class Test_LoRaPHYAS923 : public testing::Test {
protected: protected:
LoRaPHYAS923 *object; LoRaPHYAS923 *object;
my_radio radio;
virtual void SetUp() virtual void SetUp()
{ {
LoRaPHY_stub::radio = &radio;
object = new LoRaPHYAS923(); object = new LoRaPHYAS923();
} }
virtual void TearDown() virtual void TearDown()
{ {
LoRaPHY_stub::radio = NULL;
delete object; delete object;
} }
}; };
@ -38,3 +104,40 @@ TEST_F(Test_LoRaPHYAS923, constructor)
EXPECT_TRUE(object); EXPECT_TRUE(object);
} }
TEST_F(Test_LoRaPHYAS923, get_alternate_DR)
{
EXPECT_TRUE(2 == object->get_alternate_DR(1));
}
TEST_F(Test_LoRaPHYAS923, set_next_channel)
{
channel_selection_params_t next_channel;
lorawan_time_t backoff_time = 0;
lorawan_time_t time = 0;
uint8_t ch = 1;
next_channel.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 0;
EXPECT_TRUE(LORAWAN_STATUS_NO_CHANNEL_FOUND == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
next_channel.aggregate_timeoff = 1;
radio.bool_value = false;
EXPECT_TRUE(LORAWAN_STATUS_DUTYCYCLE_RESTRICTED == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
next_channel.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 1;
EXPECT_TRUE(LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
radio.bool_value = true;
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
}
TEST_F(Test_LoRaPHYAS923, apply_DR_offset)
{
//0, 1, 2, 3, 4, 5, -1, -2
for (int i=0; i < 8; i++) {
uint8_t val = i>5?5:2;
EXPECT_TRUE(object->apply_DR_offset(0, i));
}
}

View File

@ -18,17 +18,83 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "LoRaPHYAU915.h" #include "LoRaPHYAU915.h"
#include "LoRaPHY_stub.h"
class my_radio : public LoRaRadio
{
public:
virtual void init_radio(radio_events_t *events){};
virtual void radio_reset(){};
virtual void sleep(void){};
virtual void standby(void){};
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
uint32_t datarate, uint8_t coderate,
uint32_t bandwidth_afc, uint16_t preamble_len,
uint16_t symb_timeout, bool fix_len,
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous){};
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
uint8_t coderate, uint16_t preamble_len,
bool fix_len, bool crc_on, bool freq_hop_on,
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
virtual void send(uint8_t *buffer, uint8_t size){};
virtual void receive(void){};
virtual void set_channel(uint32_t freq){};
virtual uint32_t random(void){};
virtual uint8_t get_status(void){return uint8_value;};
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
virtual void set_public_network(bool enable){};
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
virtual bool perform_carrier_sense(radio_modems_t modem,
uint32_t freq,
int16_t rssi_threshold,
uint32_t max_carrier_sense_time){ return bool_value;};
virtual void start_cad(void){};
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
virtual void lock(void){};
virtual void unlock(void){};
bool bool_value;
uint8_t uint8_value;
};
class Test_LoRaPHYAU915 : public testing::Test { class Test_LoRaPHYAU915 : public testing::Test {
protected: protected:
LoRaPHYAU915 *object; LoRaPHYAU915 *object;
my_radio radio;
virtual void SetUp() virtual void SetUp()
{ {
LoRaPHY_stub::radio = &radio;
object = new LoRaPHYAU915(); object = new LoRaPHYAU915();
} }
virtual void TearDown() virtual void TearDown()
{ {
LoRaPHY_stub::radio = NULL;
delete object; delete object;
} }
}; };
@ -38,3 +104,129 @@ TEST_F(Test_LoRaPHYAU915, constructor)
EXPECT_TRUE(object); EXPECT_TRUE(object);
} }
TEST_F(Test_LoRaPHYAU915, rx_config)
{
rx_config_params_t p;
radio.uint8_value = 1;
EXPECT_TRUE(!object->rx_config(&p));
radio.uint8_value = 0;
p.is_repeater_supported = true;
EXPECT_TRUE(object->rx_config(&p));
p.is_repeater_supported = false;
EXPECT_TRUE(object->rx_config(&p));
}
TEST_F(Test_LoRaPHYAU915, tx_config)
{
tx_config_params_t p;
int8_t tx;
lorawan_time_t time;
p.tx_power = 9;
EXPECT_TRUE(object->tx_config(&p, &tx, &time));
}
TEST_F(Test_LoRaPHYAU915, link_ADR_request)
{
adr_req_params_t params;
int8_t dr_out;
int8_t tx_power_out;
uint8_t nb_rep_out;
uint8_t nb_bytes_parsed;
LoRaPHY_stub::uint8_value = 1;
LoRaPHY_stub::ch_mask_value = 6;
LoRaPHY_stub::adr_parse_count = 2;
EXPECT_TRUE(1 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 7;
EXPECT_TRUE(1 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 5;
LoRaPHY_stub::uint8_value = 6;
EXPECT_TRUE(6 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 66;
LoRaPHY_stub::uint8_value = 7;
EXPECT_TRUE(7 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
}
TEST_F(Test_LoRaPHYAU915, accept_rx_param_setup_req)
{
rx_param_setup_req_t p;
radio.bool_value = false;
EXPECT_TRUE(0 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 923300000 - 1;
EXPECT_TRUE(0 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 927500000 + 1;
p.datarate = 6;
LoRaPHY_stub::bool_counter = 0;
LoRaPHY_stub::bool_table[0] = true;
EXPECT_TRUE(2 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 923300000 + 600000;
LoRaPHY_stub::bool_counter = 0;
LoRaPHY_stub::bool_table[0] = true;
LoRaPHY_stub::bool_table[1] = true;
EXPECT_TRUE(7 == object->accept_rx_param_setup_req(&p));
}
TEST_F(Test_LoRaPHYAU915, get_alternate_DR)
{
EXPECT_TRUE(0 == object->get_alternate_DR(0));
EXPECT_TRUE(6 == object->get_alternate_DR(1));
}
TEST_F(Test_LoRaPHYAU915, set_next_channel)
{
channel_selection_params_t params;
uint8_t channel;
lorawan_time_t time;
lorawan_time_t timeoff;
params.current_datarate = 6;
params.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 0;
EXPECT_TRUE(LORAWAN_STATUS_NO_CHANNEL_FOUND == object->set_next_channel(&params, &channel, &time, &timeoff));
radio.bool_value = false;
params.aggregate_timeoff = 1;
EXPECT_TRUE(LORAWAN_STATUS_DUTYCYCLE_RESTRICTED == object->set_next_channel(&params, &channel, &time, &timeoff));
params.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 1;
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_next_channel(&params, &channel, &time, &timeoff));
}
TEST_F(Test_LoRaPHYAU915, apply_DR_offset)
{
// { DR_8, DR_8, DR_8, DR_8, DR_8, DR_8 }, // DR_0
// { DR_9, DR_8, DR_8, DR_8, DR_8, DR_8 }, // DR_1
// { DR_10, DR_9, DR_8, DR_8, DR_8, DR_8 }, // DR_2
// { DR_11, DR_10, DR_9, DR_8, DR_8, DR_8 }, // DR_3
// { DR_12, DR_11, DR_10, DR_9, DR_8, DR_8 }, // DR_4
// { DR_13, DR_12, DR_11, DR_10, DR_9, DR_8 }, // DR_5
// { DR_13, DR_13, DR_12, DR_11, DR_10, DR_9 }, // DR_6
for (int i = 0; i < 7; i++) {
for (int j=0; j < 6; j++ ) {
uint8_t val = 8 + i;
val -= j;
if (val > 13) val = 13;
if (val < 8) val = 8;
EXPECT_TRUE(val == object->apply_DR_offset(i, j));
}
}
}

View File

@ -18,17 +18,85 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "LoRaPHYCN470.h" #include "LoRaPHYCN470.h"
#include "LoRaPHY_stub.h"
class my_radio : public LoRaRadio
{
public:
virtual void init_radio(radio_events_t *events){};
virtual void radio_reset(){};
virtual void sleep(void){};
virtual void standby(void){};
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
uint32_t datarate, uint8_t coderate,
uint32_t bandwidth_afc, uint16_t preamble_len,
uint16_t symb_timeout, bool fix_len,
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous){};
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
uint8_t coderate, uint16_t preamble_len,
bool fix_len, bool crc_on, bool freq_hop_on,
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
virtual void send(uint8_t *buffer, uint8_t size){};
virtual void receive(void){};
virtual void set_channel(uint32_t freq){};
virtual uint32_t random(void){};
virtual uint8_t get_status(void){return uint8_value;};
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
virtual void set_public_network(bool enable){};
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
virtual bool perform_carrier_sense(radio_modems_t modem,
uint32_t freq,
int16_t rssi_threshold,
uint32_t max_carrier_sense_time){ return bool_value;};
virtual void start_cad(void){};
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
virtual void lock(void){};
virtual void unlock(void){};
bool bool_value;
uint8_t uint8_value;
};
class Test_LoRaPHYCN470 : public testing::Test { class Test_LoRaPHYCN470 : public testing::Test {
protected: protected:
LoRaPHYCN470 *object; LoRaPHYCN470 *object;
my_radio radio;
virtual void SetUp() virtual void SetUp()
{ {
LoRaPHY_stub::radio = &radio;
object = new LoRaPHYCN470(); object = new LoRaPHYCN470();
} }
virtual void TearDown() virtual void TearDown()
{ {
LoRaPHY_stub::radio = NULL;
delete object; delete object;
} }
}; };
@ -38,3 +106,94 @@ TEST_F(Test_LoRaPHYCN470, constructor)
EXPECT_TRUE(object); EXPECT_TRUE(object);
} }
TEST_F(Test_LoRaPHYCN470, set_next_channel)
{
channel_selection_params_t params;
uint8_t channel;
lorawan_time_t time;
lorawan_time_t timeoff;
params.current_datarate = 4;
params.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 0;
EXPECT_TRUE(LORAWAN_STATUS_NO_CHANNEL_FOUND == object->set_next_channel(&params, &channel, &time, &timeoff));
radio.bool_value = false;
params.aggregate_timeoff = 1;
EXPECT_TRUE(LORAWAN_STATUS_DUTYCYCLE_RESTRICTED == object->set_next_channel(&params, &channel, &time, &timeoff));
params.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 1;
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_next_channel(&params, &channel, &time, &timeoff));
}
TEST_F(Test_LoRaPHYCN470, rx_config)
{
rx_config_params_t p;
radio.uint8_value = 1;
EXPECT_TRUE(!object->rx_config(&p));
radio.uint8_value = 0;
p.is_repeater_supported = true;
EXPECT_TRUE(object->rx_config(&p));
p.is_repeater_supported = false;
EXPECT_TRUE(object->rx_config(&p));
}
TEST_F(Test_LoRaPHYCN470, tx_config)
{
tx_config_params_t p;
int8_t tx;
lorawan_time_t time;
p.tx_power = 9;
EXPECT_TRUE(object->tx_config(&p, &tx, &time));
}
TEST_F(Test_LoRaPHYCN470, link_ADR_request)
{
adr_req_params_t params;
int8_t dr_out;
int8_t tx_power_out;
uint8_t nb_rep_out;
uint8_t nb_bytes_parsed;
LoRaPHY_stub::uint8_value = 1;
LoRaPHY_stub::ch_mask_value = 6;
LoRaPHY_stub::adr_parse_count = 2;
EXPECT_TRUE(1 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 7;
EXPECT_TRUE(1 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 5;
LoRaPHY_stub::uint8_value = 6;
EXPECT_TRUE(6 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 66;
LoRaPHY_stub::uint8_value = 7;
EXPECT_TRUE(7 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
}
TEST_F(Test_LoRaPHYCN470, accept_rx_param_setup_req)
{
rx_param_setup_req_t p;
EXPECT_TRUE(0 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 923300000 - 1;
EXPECT_TRUE(0 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 927500000 + 1;
p.datarate = 6;
LoRaPHY_stub::bool_counter = 0;
LoRaPHY_stub::bool_table[0] = true;
EXPECT_TRUE(2 == object->accept_rx_param_setup_req(&p));
}

View File

@ -38,3 +38,10 @@ TEST_F(Test_LoRaPHYIN865, constructor)
EXPECT_TRUE(object); EXPECT_TRUE(object);
} }
TEST_F(Test_LoRaPHYIN865, apply_DR_offset)
{
EXPECT_TRUE(0 == object->apply_DR_offset(0, 0));
}

View File

@ -17,18 +17,83 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "LoRaPHYKR920.h" #include "LoRaPHYKR920.h"
#include "LoRaPHY_stub.h"
#include "LoRaRadio.h"
class my_radio : public LoRaRadio
{
public:
virtual void init_radio(radio_events_t *events){};
virtual void radio_reset(){};
virtual void sleep(void){};
virtual void standby(void){};
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
uint32_t datarate, uint8_t coderate,
uint32_t bandwidth_afc, uint16_t preamble_len,
uint16_t symb_timeout, bool fix_len,
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous){};
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
uint8_t coderate, uint16_t preamble_len,
bool fix_len, bool crc_on, bool freq_hop_on,
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
virtual void send(uint8_t *buffer, uint8_t size){};
virtual void receive(void){};
virtual void set_channel(uint32_t freq){};
virtual uint32_t random(void){};
virtual uint8_t get_status(void){};
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
virtual void set_public_network(bool enable){};
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
virtual bool perform_carrier_sense(radio_modems_t modem,
uint32_t freq,
int16_t rssi_threshold,
uint32_t max_carrier_sense_time){ return bool_value;};
virtual void start_cad(void){};
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
virtual void lock(void){};
virtual void unlock(void){};
bool bool_value;
};
class Test_LoRaPHYKR920 : public testing::Test { class Test_LoRaPHYKR920 : public testing::Test {
protected: protected:
LoRaPHYKR920 *object; LoRaPHYKR920 *object;
my_radio radio;
virtual void SetUp() virtual void SetUp()
{ {
LoRaPHY_stub::radio = &radio;
object = new LoRaPHYKR920(); object = new LoRaPHYKR920();
} }
virtual void TearDown() virtual void TearDown()
{ {
LoRaPHY_stub::radio = NULL;
delete object; delete object;
} }
}; };
@ -38,3 +103,54 @@ TEST_F(Test_LoRaPHYKR920, constructor)
EXPECT_TRUE(object); EXPECT_TRUE(object);
} }
TEST_F(Test_LoRaPHYKR920, verify_frequency_for_band)
{
radio.bool_value = false;
EXPECT_TRUE(false == object->verify_frequency_for_band(0, 0));
radio.bool_value = true;
EXPECT_TRUE(false == object->verify_frequency_for_band(0, 0));
EXPECT_TRUE(true == object->verify_frequency_for_band(921100000, 0));
}
TEST_F(Test_LoRaPHYKR920, tx_config)
{
tx_config_params_t tx_config;
int8_t tx_power = 0;
lorawan_time_t time;
tx_config.tx_power = 9;
EXPECT_TRUE(true == object->tx_config(&tx_config, &tx_power, &time));
}
TEST_F(Test_LoRaPHYKR920, set_next_channel)
{
channel_selection_params_t next_channel;
lorawan_time_t backoff_time = 0;
lorawan_time_t time = 0;
uint8_t ch = 1;
next_channel.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 0;
EXPECT_TRUE(LORAWAN_STATUS_NO_CHANNEL_FOUND == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
next_channel.aggregate_timeoff = 1;
radio.bool_value = false;
EXPECT_TRUE(LORAWAN_STATUS_DUTYCYCLE_RESTRICTED == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
next_channel.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 1;
EXPECT_TRUE(LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
radio.bool_value = true;
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_next_channel(&next_channel, &ch, &backoff_time, &time));
}
TEST_F(Test_LoRaPHYKR920, set_tx_cont_mode)
{
cw_mode_params_t params;
params.tx_power = 9;
object->set_tx_cont_mode(&params, 0);
}

View File

@ -17,18 +17,83 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "LoRaPHYUS915.h" #include "LoRaPHYUS915.h"
#include "LoRaPHY_stub.h"
class my_radio : public LoRaRadio
{
public:
virtual void init_radio(radio_events_t *events){};
virtual void radio_reset(){};
virtual void sleep(void){};
virtual void standby(void){};
virtual void set_rx_config (radio_modems_t modem, uint32_t bandwidth,
uint32_t datarate, uint8_t coderate,
uint32_t bandwidth_afc, uint16_t preamble_len,
uint16_t symb_timeout, bool fix_len,
uint8_t payload_len,
bool crc_on, bool freq_hop_on, uint8_t hop_period,
bool iq_inverted, bool rx_continuous){};
virtual void set_tx_config(radio_modems_t modem, int8_t power, uint32_t fdev,
uint32_t bandwidth, uint32_t datarate,
uint8_t coderate, uint16_t preamble_len,
bool fix_len, bool crc_on, bool freq_hop_on,
uint8_t hop_period, bool iq_inverted, uint32_t timeout){};
virtual void send(uint8_t *buffer, uint8_t size){};
virtual void receive(void){};
virtual void set_channel(uint32_t freq){};
virtual uint32_t random(void){};
virtual uint8_t get_status(void){return uint8_value;};
virtual void set_max_payload_length(radio_modems_t modem, uint8_t max){};
virtual void set_public_network(bool enable){};
virtual uint32_t time_on_air(radio_modems_t modem, uint8_t pkt_len){};
virtual bool perform_carrier_sense(radio_modems_t modem,
uint32_t freq,
int16_t rssi_threshold,
uint32_t max_carrier_sense_time){ return bool_value;};
virtual void start_cad(void){};
virtual bool check_rf_frequency(uint32_t frequency){ return bool_value; };
virtual void set_tx_continuous_wave(uint32_t freq, int8_t power, uint16_t time){};
virtual void lock(void){};
virtual void unlock(void){};
bool bool_value;
uint8_t uint8_value;
};
class Test_LoRaPHYUS915 : public testing::Test { class Test_LoRaPHYUS915 : public testing::Test {
protected: protected:
LoRaPHYUS915 *object; LoRaPHYUS915 *object;
my_radio radio;
virtual void SetUp() virtual void SetUp()
{ {
LoRaPHY_stub::radio = &radio;
object = new LoRaPHYUS915(); object = new LoRaPHYUS915();
} }
virtual void TearDown() virtual void TearDown()
{ {
LoRaPHY_stub::radio = NULL;
delete object; delete object;
} }
}; };
@ -38,3 +103,134 @@ TEST_F(Test_LoRaPHYUS915, constructor)
EXPECT_TRUE(object); EXPECT_TRUE(object);
} }
TEST_F(Test_LoRaPHYUS915, restore_default_channels)
{
object->restore_default_channels();
}
TEST_F(Test_LoRaPHYUS915, rx_config)
{
rx_config_params_t p;
radio.uint8_value = 1;
EXPECT_TRUE(!object->rx_config(&p));
radio.uint8_value = 0;
p.is_repeater_supported = true;
EXPECT_TRUE(object->rx_config(&p));
p.is_repeater_supported = false;
EXPECT_TRUE(object->rx_config(&p));
}
TEST_F(Test_LoRaPHYUS915, tx_config)
{
tx_config_params_t p;
int8_t tx;
lorawan_time_t time;
EXPECT_TRUE(object->tx_config(&p, &tx, &time));
}
TEST_F(Test_LoRaPHYUS915, link_ADR_request)
{
adr_req_params_t params;
int8_t dr_out;
int8_t tx_power_out;
uint8_t nb_rep_out;
uint8_t nb_bytes_parsed;
EXPECT_TRUE(0 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::uint8_value = 1;
LoRaPHY_stub::ch_mask_value = 6;
LoRaPHY_stub::adr_parse_count = 2;
EXPECT_TRUE(1 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 7;
EXPECT_TRUE(1 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 5;
LoRaPHY_stub::uint8_value = 6;
EXPECT_TRUE(6 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
LoRaPHY_stub::adr_parse_count = 2;
LoRaPHY_stub::ch_mask_value = 66;
LoRaPHY_stub::uint8_value = 7;
EXPECT_TRUE(7 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
}
TEST_F(Test_LoRaPHYUS915, accept_rx_param_setup_req)
{
rx_param_setup_req_t p;
EXPECT_TRUE(0 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 923300000 - 1;
EXPECT_TRUE(0 == object->accept_rx_param_setup_req(&p));
radio.bool_value = true;
p.frequency = 927500000 + 1;
p.datarate = 6;
LoRaPHY_stub::bool_counter = 0;
LoRaPHY_stub::bool_table[0] = true;
EXPECT_TRUE(2 == object->accept_rx_param_setup_req(&p));
}
TEST_F(Test_LoRaPHYUS915, get_alternate_DR)
{
EXPECT_TRUE(0 == object->get_alternate_DR(0));
EXPECT_TRUE(4 == object->get_alternate_DR(1));
}
TEST_F(Test_LoRaPHYUS915, set_next_channel)
{
channel_selection_params_t params;
uint8_t channel;
lorawan_time_t time;
lorawan_time_t timeoff;
params.current_datarate = 4;
params.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 0;
EXPECT_TRUE(LORAWAN_STATUS_NO_CHANNEL_FOUND == object->set_next_channel(&params, &channel, &time, &timeoff));
radio.bool_value = false;
params.aggregate_timeoff = 1;
EXPECT_TRUE(LORAWAN_STATUS_DUTYCYCLE_RESTRICTED == object->set_next_channel(&params, &channel, &time, &timeoff));
params.aggregate_timeoff = 0;
LoRaPHY_stub::uint8_value = 1;
EXPECT_TRUE(LORAWAN_STATUS_OK == object->set_next_channel(&params, &channel, &time, &timeoff));
}
TEST_F(Test_LoRaPHYUS915, apply_DR_offset)
{
//10, 9, 8, 8
//11, 10, 9, 8
//12, 11, 10, 9
//13, 12, 11, 10
//13, 13, 12, 11
for (int i = 0; i < 5; i++) {
for (int j=0; j < 4; j++ ) {
uint8_t val = 10 + i;
val -= j;
if (val > 13) val = 13;
if (val < 8) val = 8;
EXPECT_TRUE(val == object->apply_DR_offset(i, j));
}
}
}
TEST_F(Test_LoRaPHYUS915, set_tx_cont_mode)
{
cw_mode_params_t p;
object->set_tx_cont_mode(&p, 0);
p.datarate = 4;
object->set_tx_cont_mode(&p, 0);
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2018 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "CellularUtil.h" #include "CellularUtil.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef __FILE_HANDLE_STUB_H__ #ifndef __FILE_HANDLE_STUB_H__
#define __FILE_HANDLE_STUB_H__ #define __FILE_HANDLE_STUB_H__

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2018 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "Kernel.h" #include "Kernel.h"
namespace rtos { namespace rtos {

View File

@ -1,27 +1,19 @@
/** /*
/ _____) _ | | * Copyright (c) , Arm Limited and affiliates.
( (____ _____ ____ _| |_ _____ ____| |__ * SPDX-License-Identifier: Apache-2.0
\____ \| ___ | (_ _) ___ |/ ___) _ \ *
_____) ) ____| | | || |_| ____( (___| | | | * Licensed under the Apache License, Version 2.0 (the "License");
(______/|_____)_|_|_| \__)_____)\____)_| |_| * you may not use this file except in compliance with the License.
(C)2013 Semtech * You may obtain a copy of the License at
___ _____ _ ___ _ _____ ___ ___ ___ ___ *
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| * http://www.apache.org/licenses/LICENSE-2.0
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| *
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| * Unless required by applicable law or agreed to in writing, software
embedded.connectivity.solutions=============== * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Description: LoRaWAN stack layer that controls both MAC and PHY underneath * See the License for the specific language governing permissions and
* limitations under the License.
License: Revised BSD License, see LICENSE.TXT file include in the project */
Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause
*/
#include "LoRaMacChannelPlan.h" #include "LoRaMacChannelPlan.h"

View File

@ -1,26 +1,19 @@
/** /*
/ _____) _ | | * Copyright (c) , Arm Limited and affiliates.
( (____ _____ ____ _| |_ _____ ____| |__ * SPDX-License-Identifier: Apache-2.0
\____ \| ___ | (_ _) ___ |/ ___) _ \ *
_____) ) ____| | | || |_| ____( (___| | | | * Licensed under the Apache License, Version 2.0 (the "License");
(______/|_____)_|_|_| \__)_____)\____)_| |_| * you may not use this file except in compliance with the License.
(C)2013 Semtech * You may obtain a copy of the License at
___ _____ _ ___ _ _____ ___ ___ ___ ___ *
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| * http://www.apache.org/licenses/LICENSE-2.0
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| *
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| * Unless required by applicable law or agreed to in writing, software
embedded.connectivity.solutions=============== * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Description: LoRa MAC layer implementation * See the License for the specific language governing permissions and
* limitations under the License.
License: Revised BSD License, see LICENSE.TXT file include in the project */
Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause
*/
#include "LoRaMacCommand.h" #include "LoRaMacCommand.h"
#include "LoRaMac.h" #include "LoRaMac.h"

View File

@ -1,27 +1,19 @@
/** /*
* / _____) _ | | * Copyright (c) , Arm Limited and affiliates.
* ( (____ _____ ____ _| |_ _____ ____| |__ * SPDX-License-Identifier: Apache-2.0
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013 Semtech
* ___ _____ _ ___ _ _____ ___ ___ ___ ___
* / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
* \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
* |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
* embedded.connectivity.solutions===============
* *
* Description: LoRa MAC crypto implementation * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* License: Revised BSD License, see LICENSE.TXT file include in the project * http://www.apache.org/licenses/LICENSE-2.0
* *
* Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jäckle ( STACKFORCE ) * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* Copyright (c) 2017, Arm Limited and affiliates. * See the License for the specific language governing permissions and
* * limitations under the License.
* SPDX-License-Identifier: BSD-3-Clause */
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>

View File

@ -1,26 +1,20 @@
/** /*
/ _____) _ | | * Copyright (c) , Arm Limited and affiliates.
( (____ _____ ____ _| |_ _____ ____| |__ * SPDX-License-Identifier: Apache-2.0
\____ \| ___ | (_ _) ___ |/ ___) _ \ *
_____) ) ____| | | || |_| ____( (___| | | | * Licensed under the Apache License, Version 2.0 (the "License");
(______/|_____)_|_|_| \__)_____)\____)_| |_| * you may not use this file except in compliance with the License.
(C)2013 Semtech * You may obtain a copy of the License at
___ _____ _ ___ _ _____ ___ ___ ___ ___ *
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| * http://www.apache.org/licenses/LICENSE-2.0
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| *
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| * Unless required by applicable law or agreed to in writing, software
embedded.connectivity.solutions=============== * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Description: LoRa MAC layer implementation
License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdlib.h> #include <stdlib.h>
#include "LoRaMac.h" #include "LoRaMac.h"

View File

@ -1,32 +1,18 @@
/** /*
* @file LoRaPHYEU868.cpp * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* @brief Implements LoRaPHY for European 868 MHz band * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* \code * http://www.apache.org/licenses/LICENSE-2.0
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013 Semtech
* ___ _____ _ ___ _ _____ ___ ___ ___ ___
* / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
* \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
* |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
* embedded.connectivity.solutions===============
*
* \endcode
*
*
* License: Revised BSD License, see LICENSE.TXT file include in the project
*
* Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: BSD-3-Clause
* *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include "LoRaPHYEU868.h" #include "LoRaPHYEU868.h"

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdbool.h> #include <stdbool.h>
@ -8,6 +24,7 @@
#include "LoRaPHY.h" #include "LoRaPHY.h"
#include "LoRaPHY_stub.h" #include "LoRaPHY_stub.h"
LoRaRadio *LoRaPHY_stub::radio = NULL;
uint32_t LoRaPHY_stub::uint32_value = 0; uint32_t LoRaPHY_stub::uint32_value = 0;
uint16_t LoRaPHY_stub::uint16_value = 0; uint16_t LoRaPHY_stub::uint16_value = 0;
uint8_t LoRaPHY_stub::uint8_value = 0; uint8_t LoRaPHY_stub::uint8_value = 0;
@ -19,9 +36,11 @@ channel_params_t *LoRaPHY_stub::channel_params_ptr = NULL;
uint8_t LoRaPHY_stub::bool_counter = 0; uint8_t LoRaPHY_stub::bool_counter = 0;
bool LoRaPHY_stub::bool_table[20] = {}; bool LoRaPHY_stub::bool_table[20] = {};
uint8_t LoRaPHY_stub::linkAdrNbBytesParsed = 0; uint8_t LoRaPHY_stub::linkAdrNbBytesParsed = 0;
uint8_t LoRaPHY_stub::ch_mask_value = 0;
uint8_t LoRaPHY_stub::adr_parse_count = 0;
LoRaPHY::LoRaPHY() LoRaPHY::LoRaPHY()
: _radio(NULL) : _radio(LoRaPHY_stub::radio)
{ {
} }
@ -154,6 +173,12 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle,
uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t *payload, uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t *payload,
link_adr_params_t *params) link_adr_params_t *params)
{ {
params->ch_mask_ctrl = LoRaPHY_stub::ch_mask_value;
if (LoRaPHY_stub::adr_parse_count) {
return --LoRaPHY_stub::adr_parse_count;
}
return LoRaPHY_stub::uint8_value; return LoRaPHY_stub::uint8_value;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -23,6 +23,7 @@
namespace LoRaPHY_stub namespace LoRaPHY_stub
{ {
extern LoRaRadio *radio;
extern uint8_t bool_counter; extern uint8_t bool_counter;
extern bool bool_table[20]; extern bool bool_table[20];
extern uint32_t uint32_value; extern uint32_t uint32_value;
@ -34,4 +35,6 @@ extern uint16_t uint16_value;
extern lorawan_status_t lorawan_status_value; extern lorawan_status_t lorawan_status_value;
extern channel_params_t* channel_params_ptr; extern channel_params_t* channel_params_ptr;
extern uint8_t linkAdrNbBytesParsed; extern uint8_t linkAdrNbBytesParsed;
extern uint8_t ch_mask_value;
extern uint8_t adr_parse_count;
} }

View File

@ -1,27 +1,19 @@
/** /*
/ _____) _ | | * Copyright (c) , Arm Limited and affiliates.
( (____ _____ ____ _| |_ _____ ____| |__ * SPDX-License-Identifier: Apache-2.0
\____ \| ___ | (_ _) ___ |/ ___) _ \ *
_____) ) ____| | | || |_| ____( (___| | | | * Licensed under the Apache License, Version 2.0 (the "License");
(______/|_____)_|_|_| \__)_____)\____)_| |_| * you may not use this file except in compliance with the License.
(C)2013 Semtech * You may obtain a copy of the License at
___ _____ _ ___ _ _____ ___ ___ ___ ___ *
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| * http://www.apache.org/licenses/LICENSE-2.0
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| *
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| * Unless required by applicable law or agreed to in writing, software
embedded.connectivity.solutions=============== * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Description: LoRaWAN stack layer that controls both MAC and PHY underneath * See the License for the specific language governing permissions and
* limitations under the License.
License: Revised BSD License, see LICENSE.TXT file include in the project */
Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause
*/
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,22 +1,19 @@
/** /*
/ _____) _ | | * Copyright (c) , Arm Limited and affiliates.
( (____ _____ ____ _| |_ _____ ____| |__ * SPDX-License-Identifier: Apache-2.0
\____ \| ___ | (_ _) ___ |/ ___) _ \ *
_____) ) ____| | | || |_| ____( (___| | | | * Licensed under the Apache License, Version 2.0 (the "License");
(______/|_____)_|_|_| \__)_____)\____)_| |_| * you may not use this file except in compliance with the License.
(C)2013 Semtech * You may obtain a copy of the License at
*
Description: Timer objects and scheduling management * http://www.apache.org/licenses/LICENSE-2.0
*
License: Revised BSD License, see LICENSE.TXT file include in the project * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Maintainer: Miguel Luis and Gregory Cristian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
Copyright (c) 2017, Arm Limited and affiliates. */
SPDX-License-Identifier: BSD-3-Clause
*/
#include "LoRaWANTimer.h" #include "LoRaWANTimer.h"

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Arm Limited and affiliates. * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Arm Limited and affiliates. * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,23 +1,18 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017-2017 ARM Limited * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and associated documentation files (the "Software"), to deal * you may not use this file except in compliance with the License.
* in the Software without restriction, including without limitation the rights * You may obtain a copy of the License at
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * See the License for the specific language governing permissions and
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * limitations under the License.
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
#include "ObservingBlockDevice.h" #include "ObservingBlockDevice.h"

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,23 +1,18 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017-2017 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and associated documentation files (the "Software"), to deal * you may not use this file except in compliance with the License.
* in the Software without restriction, including without limitation the rights * You may obtain a copy of the License at
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * See the License for the specific language governing permissions and
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * limitations under the License.
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/ */
#include "ReadOnlyBlockDevice.h" #include "ReadOnlyBlockDevice.h"

View File

@ -1,5 +1,6 @@
/* mbed Microcontroller Library /*
* Copyright (c) 2017 ARM Limited * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef TIMER_STUB_H #ifndef TIMER_STUB_H
#define TIMER_STUB_H #define TIMER_STUB_H

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBEDTLS_CONFIG_FILE) #if !defined(MBEDTLS_CONFIG_FILE)

View File

@ -1,26 +1,18 @@
/** /*
* \file cipher.c * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
* *
* \brief Generic cipher wrapper for mbed TLS * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* *
* \author Adriaan de Jong <dejong@fox-it.com> * http://www.apache.org/licenses/LICENSE-2.0
* *
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved * Unless required by applicable law or agreed to in writing, software
* SPDX-License-Identifier: Apache-2.0 * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* Licensed under the Apache License, Version 2.0 (the "License"); you may * See the License for the specific language governing permissions and
* not use this file except in compliance with the License. * limitations under the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/ */
#if !defined(MBEDTLS_CONFIG_FILE) #if !defined(MBEDTLS_CONFIG_FILE)

View File

@ -1,3 +1,19 @@
/*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBEDTLS_CONFIG_FILE) #if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h" #include "mbedtls/config.h"

View File

@ -1,18 +1,20 @@
/* /*
* Copyright (c) 2014-2018 ARM Limited. All rights reserved. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may *
* not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT * distributed under the License is distributed on an "AS IS" BASIS,
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "common_functions.h" #include "common_functions.h"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Arm Limited and affiliates. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,16 +1,16 @@
/* /*
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License");
* not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * distributed under the License is distributed on an "AS IS" BASIS,
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) , Arm Limited and affiliates. * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) , Arm Limited and affiliates. * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifndef __MBED_POLL_STUB_H__ #ifndef __MBED_POLL_STUB_H__
#define __MBED_POLL_STUB_H__ #define __MBED_POLL_STUB_H__

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) , Arm Limited and affiliates. * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,3 +1,20 @@
/*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "nvic_wrapper.h" #include "nvic_wrapper.h"
void NVIC_SystemReset(void) {} void NVIC_SystemReset(void) {}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2017, Arm Limited and affiliates. * Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>

View File

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include "randLIB.h" #include "randLIB.h"
void randLIB_seed_random(void) void randLIB_seed_random(void)

View File

@ -1,18 +1,20 @@
/* /*
* Copyright (c) 2014-2018 ARM Limited. All rights reserved. * Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the License); you may *
* not use this file except in compliance with the License. * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT * distributed under the License is distributed on an "AS IS" BASIS,
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>

View File

@ -615,10 +615,5 @@ lorawan_status_t LoRaPHYAU915::set_next_channel(channel_selection_params_t* next
uint8_t LoRaPHYAU915::apply_DR_offset(int8_t dr, int8_t dr_offset) uint8_t LoRaPHYAU915::apply_DR_offset(int8_t dr, int8_t dr_offset)
{ {
int8_t datarate = datarate_offsets_AU915[dr][dr_offset]; return datarate_offsets_AU915[dr][dr_offset];
if (datarate < 0) {
datarate = DR_0;
}
return datarate;
} }

View File

@ -676,11 +676,5 @@ void LoRaPHYUS915::set_tx_cont_mode(cw_mode_params_t* params, uint32_t given_fre
uint8_t LoRaPHYUS915::apply_DR_offset(int8_t dr, int8_t dr_offset) uint8_t LoRaPHYUS915::apply_DR_offset(int8_t dr, int8_t dr_offset)
{ {
int8_t datarate = datarate_offsets_US915[dr][dr_offset]; return datarate_offsets_US915[dr][dr_offset];
if (datarate < 0) {
datarate = DR_0;
}
return datarate;
} }