Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TESTS/configs/baremetal.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"storage_tdb_external",
"fat_chan",
"lora",
"sx1276-lora-driver",
"nfc",
"network-emac",
"flashiap-block-device",
Expand Down
4 changes: 0 additions & 4 deletions connectivity/drivers/lora/COMPONENT_SX126X/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"name": "SX126X-lora-driver",
"config": {
"radio": {
"value": "SX126X",
"macro_name" : "MBED_CONF_LORA_RADIO"
},
"spi-frequency": {
"help": "SPI frequency, Default: 16 MHz",
"value": 16000000
Expand Down
4 changes: 0 additions & 4 deletions connectivity/drivers/lora/COMPONENT_SX1272/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"name": "sx1272-lora-driver",
"config": {
"radio": {
"value": "SX1272",
"macro_name" : "MBED_CONF_LORA_RADIO"
},
"spi-frequency": {
"help": "SPI frequency, Default: 8 MHz",
"value": 8000000
Expand Down
4 changes: 0 additions & 4 deletions connectivity/drivers/lora/COMPONENT_SX1276/mbed_lib.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"name": "sx1276-lora-driver",
"config": {
"radio": {
"value": "SX1276",
"macro_name" : "MBED_CONF_LORA_RADIO"
},
"spi-frequency": {
"help": "SPI frequency, Default: 8 MHz",
"value": 8000000
Expand Down
3 changes: 0 additions & 3 deletions connectivity/lorawan/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"help": "LoRa PHY region: EU868, AS923, AU915, CN470, CN779, EU433, IN865, KR920, US915",
"value": "EU868"
},
"radio": {
"help": "value set in radio driver : SX126X, SX1272, SX1276"
},
"over-the-air-activation": {
"help": "When set to 1 the application uses the Over-the-Air activation procedure, default: true",
"value": true
Expand Down
51 changes: 18 additions & 33 deletions connectivity/lorawan/tests/TESTS/lorawan/loraradio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] LORADIO test cases require a RTOS to run.
#else

#include "utest.h"
#include "unity.h"
#include "greentea-client/test_env.h"

#include "Semaphore.h"
#include "ThisThread.h"

#include "mbed_trace.h"
#define TRACE_GROUP "RTST"

#include "LoRaRadio.h"

#define SX1272 0xFF
#define SX1276 0xEE

#ifndef MBED_CONF_LORA_RADIO
#error [NOT_SUPPORTED] Lora radio is not set
#else

#if (MBED_CONF_LORA_RADIO == SX1272)
#if COMPONENT_SX1272
#include "SX1272_LoRaRadio.h"
#elif (MBED_CONF_LORA_RADIO == SX1276)
#elif COMPONENT_SX1276
#include "SX1276_LoRaRadio.h"
#elif COMPONENT_SX126X
#include "SX126X_LoRaRadio.h"
#else
#error Lora radio is not configured
#error [NOT_SUPPORTED] Lora radio is not configured
#endif

using namespace utest::v1;
Expand All @@ -64,39 +55,34 @@ static volatile event_t received_event;

static void tx_done()
{
rtos::ThisThread::sleep_for(2);
TEST_ASSERT_EQUAL(EV_NONE, received_event);
received_event = EV_TX_DONE;
TEST_ASSERT_EQUAL(osOK, event_sem.release());
}

static void tx_timeout()
{
rtos::ThisThread::sleep_for(2);
TEST_ASSERT_EQUAL(EV_NONE, received_event);
received_event = EV_TX_TIMEOUT;
TEST_ASSERT_EQUAL(osOK, event_sem.release());
}

static void rx_done(const uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
{
rtos::ThisThread::sleep_for(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why these sleep where present in the first place ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I am quite new in lora....

TEST_ASSERT_EQUAL(EV_NONE, received_event);
received_event = EV_RX_DONE;
TEST_ASSERT_EQUAL(osOK, event_sem.release());
}

static void rx_timeout()
{
rtos::ThisThread::sleep_for(2);
TEST_ASSERT_EQUAL(EV_NONE, received_event);
received_event = EV_RX_TIMEOUT;
TEST_ASSERT_EQUAL(osOK, event_sem.release());
}

static void rx_error()
{
rtos::ThisThread::sleep_for(2);
TEST_ASSERT_EQUAL(EV_NONE, received_event);
received_event = EV_RX_ERROR;
TEST_ASSERT_EQUAL(osOK, event_sem.release());
Expand Down Expand Up @@ -124,11 +110,11 @@ void test_set_tx_config()

TEST_ASSERT_EQUAL(RF_IDLE, radio->get_status());

radio->set_tx_config(MODEM_LORA, 13, 0,
0, 7,
1, 8,
false, true, false,
0, false, 100);
radio->set_tx_config(MODEM_LORA, 13, 0, // modem, power, fdev,
0, 7, // bandwidth, datarate,
1, 8, // coderate, preamble_len,
false, true, false, // fix_len, crc_on, freq_hop_on,
0, false, 1000); // hop_period, iq_inverted, timeout
radio->send(buffer, sizeof(buffer));

TEST_ASSERT_EQUAL(RF_TX_RUNNING, radio->get_status());
Expand Down Expand Up @@ -205,12 +191,12 @@ utest::v1::status_t test_setup(const size_t number_of_cases)

utest::v1::status_t case_setup_handler(const Case *const source, const size_t index_of_case)
{
#if (MBED_CONF_LORA_RADIO == SX1272)
#if COMPONENT_SX1272
radio = new SX1272_LoRaRadio();

#elif (MBED_CONF_LORA_RADIO == SX1276)
#elif COMPONENT_SX1276
radio = new SX1276_LoRaRadio();

#elif COMPONENT_SX126X
radio = new SX126X_LoRaRadio();
#endif

TEST_ASSERT(radio);
Expand All @@ -224,12 +210,14 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t
{
radio->sleep();

#if (MBED_CONF_LORA_RADIO == SX1272)
#if COMPONENT_SX1272
delete static_cast<SX1272_LoRaRadio *>(radio);

#elif (MBED_CONF_LORA_RADIO == SX1276)
#elif COMPONENT_SX1276
delete static_cast<SX1276_LoRaRadio *>(radio);

#elif COMPONENT_SX126X
delete static_cast<SX126X_LoRaRadio *>(radio);
#endif
radio = NULL;

Expand All @@ -251,6 +239,3 @@ int main()
{
return !Harness::run(specification);
}

#endif // (MBED_CONF_LORA_RADIO)
#endif // !defined(MBED_CONF_RTOS_PRESENT)