mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14195 from jeromecoutant/PR_LORA_BARE
LoraRadio test update for baremetal supportpull/14232/head
commit
40cd33001d
|
@ -19,6 +19,7 @@
|
|||
"storage_tdb_external",
|
||||
"fat_chan",
|
||||
"lora",
|
||||
"sx1276-lora-driver",
|
||||
"nfc",
|
||||
"network-emac",
|
||||
"flashiap-block-device",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
@ -64,7 +55,6 @@ 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());
|
||||
|
@ -72,7 +62,6 @@ static void tx_done()
|
|||
|
||||
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());
|
||||
|
@ -80,7 +69,6 @@ static void tx_timeout()
|
|||
|
||||
static void rx_done(const uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
|
||||
{
|
||||
rtos::ThisThread::sleep_for(2);
|
||||
TEST_ASSERT_EQUAL(EV_NONE, received_event);
|
||||
received_event = EV_RX_DONE;
|
||||
TEST_ASSERT_EQUAL(osOK, event_sem.release());
|
||||
|
@ -88,7 +76,6 @@ static void rx_done(const uint8_t *payload, uint16_t size, int16_t rssi, int8_t
|
|||
|
||||
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());
|
||||
|
@ -96,7 +83,6 @@ static void rx_timeout()
|
|||
|
||||
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());
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -251,6 +239,3 @@ int main()
|
|||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
||||
#endif // (MBED_CONF_LORA_RADIO)
|
||||
#endif // !defined(MBED_CONF_RTOS_PRESENT)
|
||||
|
|
Loading…
Reference in New Issue