Exemplo n.º 1
0
Arquivo: main.cpp Projeto: betzw/mbed
static void init_to_sim_state()
{
    cellular.set_serial(&cellular_serial);
    TEST_ASSERT(cellular.init() == NSAPI_ERROR_OK);
#if defined (MDMRTS) && defined (MDMCTS)
    cellular_serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
#endif
    cellular.set_callback(&fsm_callback);
    TEST_ASSERT(cellular.start_dispatch() == NSAPI_ERROR_OK);
    cellular_target_state = CellularConnectionFSM::STATE_SIM_PIN;
    TEST_ASSERT(cellular.continue_to_state(cellular_target_state) == NSAPI_ERROR_OK);
    TEST_ASSERT(fsm_semaphore.wait(SIM_TIMEOUT) == 1);
}
Exemplo n.º 2
0
Arquivo: main.cpp Projeto: sg-/mbed-os
void test_set_tx_config()
{
    uint8_t buffer[] = {0};

    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->send(buffer, sizeof(buffer));

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

    TEST_ASSERT_EQUAL(1, event_sem.wait(1000));
    TEST_ASSERT_EQUAL(EV_TX_DONE, received_event);
    received_event = EV_NONE;
}
Exemplo n.º 3
0
Arquivo: main.cpp Projeto: sg-/mbed-os
void test_set_rx_config()
{
    TEST_ASSERT_EQUAL(RF_IDLE, radio->get_status());

    radio->set_rx_config(MODEM_LORA, 0,     // modem, bandwidth,
                         7, 1,              // datarate, coderate,
                         0, 8,              // bandwidth_afc, preamble_len,
                         24, false,         // symb_timeout, fix_len,
                         0,                 // payload_len,
                         false, false, 0,   // crc_on, freq_hop_on, hop_period,
                         true, false);      // iq_inverted, rx_continuous
    radio->receive(100);

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

    TEST_ASSERT_EQUAL(1, event_sem.wait(1000));

    // Nobody was sending to us so timeout is expected.
    TEST_ASSERT_EQUAL(EV_RX_TIMEOUT, received_event);
    received_event = EV_NONE;
}