mirror of https://github.com/ARMmbed/mbed-os.git
Replace deprecated wait calls
parent
fc8e8f67c6
commit
a522dcfa0a
|
@ -313,9 +313,9 @@ void test_deepsleep(void)
|
|||
|
||||
* This should be replaced with a better function that checks if the
|
||||
* hardware buffers are empty. However, such an API does not exist now,
|
||||
* so we'll use the wait_ms() function for now.
|
||||
* so we'll use the ThisThread::sleep_for() function for now.
|
||||
*/
|
||||
wait_ms(20);
|
||||
ThisThread::sleep_for(20);
|
||||
|
||||
timer.start();
|
||||
timeout.attach_callback(mbed::callback(sem_callback, &sem), delay_us);
|
||||
|
|
|
@ -125,7 +125,7 @@ void rtc_persist_test()
|
|||
rtc_write(start);
|
||||
rtc_free();
|
||||
|
||||
wait(WAIT_TIME);
|
||||
ThisThread::sleep_for(WAIT_TIME * 1000);
|
||||
|
||||
rtc_init();
|
||||
const uint32_t stop = rtc_read();
|
||||
|
@ -167,7 +167,7 @@ void rtc_range_test()
|
|||
for (uint32_t i = 0; i < sizeof(starts) / sizeof(starts[0]); i++) {
|
||||
const uint32_t start = starts[i];
|
||||
rtc_write(start);
|
||||
wait(WAIT_TIME);
|
||||
ThisThread::sleep_for(WAIT_TIME * 1000);
|
||||
const uint32_t stop = rtc_read();
|
||||
TEST_ASSERT_UINT32_WITHIN(WAIT_TOLERANCE, WAIT_TIME, stop - start);
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ void test_error_logging_multithread()
|
|||
errThread[i] = new Thread(osPriorityNormal1, THREAD_STACK_SIZE, NULL, NULL);
|
||||
errThread[i]->start(callback(err_thread_func, &error_status[i]));
|
||||
}
|
||||
wait(2.0);
|
||||
ThisThread::sleep_for(2000);
|
||||
for (i = 0; i < NUM_TEST_THREADS; i++) {
|
||||
errThread[i]->join();
|
||||
}
|
||||
|
|
|
@ -81,5 +81,5 @@ void ASYNCHRONOUS_DNS_CANCEL()
|
|||
|
||||
delete[] data;
|
||||
|
||||
wait(5.0);
|
||||
ThisThread::sleep_for(5000);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ void ASYNCHRONOUS_DNS_EXTERNAL_EVENT_QUEUE()
|
|||
TEST_ASSERT_EQUAL(0, result_exp_timeout);
|
||||
|
||||
// Give event queue time to finalise before destructors
|
||||
wait(2.0);
|
||||
ThisThread::sleep_for(2000);
|
||||
|
||||
nsapi_dns_call_in_set(0);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ void ASYNCHRONOUS_DNS_TIMEOUTS()
|
|||
TEST_ASSERT(result_exp_timeout > 0);
|
||||
|
||||
// Give event queue time to finalise before destructors
|
||||
wait(2.0);
|
||||
ThisThread::sleep_for(2000);
|
||||
|
||||
nsapi_dns_call_in_set(0);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void UDPSOCKET_ECHOTEST_BURST()
|
|||
} else if (recvd < 0) {
|
||||
pkg_fail += BURST_PKTS - j; // Assume all the following packets of the burst to be lost
|
||||
printf("[%02d] network error %d\n", i, recvd);
|
||||
wait(recv_timeout);
|
||||
ThisThread::sleep_for(recv_timeout * 1000);
|
||||
recv_timeout *= 2; // Back off,
|
||||
break;
|
||||
} else if (temp_addr != udp_addr) {
|
||||
|
|
|
@ -45,7 +45,7 @@ void UDPSOCKET_SENDTO_REPEAT()
|
|||
break;
|
||||
}
|
||||
oom_earlier = true;
|
||||
wait(1);
|
||||
ThisThread::sleep_for(1000);
|
||||
continue;
|
||||
}
|
||||
oom_earlier = false;
|
||||
|
|
|
@ -153,7 +153,7 @@ void NETWORKINTERFACE_STATUS_GET()
|
|||
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
|
||||
|
||||
while (net->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) {
|
||||
wait(0.5);
|
||||
ThisThread::sleep_for(500);
|
||||
}
|
||||
|
||||
err = net->disconnect();
|
||||
|
|
|
@ -944,7 +944,7 @@ static void bg_traffic_thread(SInfo *info)
|
|||
tr_err("Background sent: \"%s\"", sbuffer);
|
||||
tr_err("Background received: \"%s\"", rbuffer);
|
||||
}
|
||||
wait_ms(10);
|
||||
ThisThread::sleep_for(10);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -525,14 +525,14 @@ static void rf_if_reset_radio(void)
|
|||
#endif
|
||||
rf->IRQ.rise(0);
|
||||
rf->RST = 1;
|
||||
wait_ms(1);
|
||||
ThisThread::sleep_for(2);
|
||||
rf->RST = 0;
|
||||
wait_ms(10);
|
||||
ThisThread::sleep_for(10);
|
||||
CS_RELEASE();
|
||||
rf->SLP_TR = 0;
|
||||
wait_ms(10);
|
||||
ThisThread::sleep_for(10);
|
||||
rf->RST = 1;
|
||||
wait_ms(10);
|
||||
ThisThread::sleep_for(10);
|
||||
|
||||
rf->IRQ.rise(&rf_if_interrupt_handler);
|
||||
}
|
||||
|
@ -883,15 +883,16 @@ static uint8_t rf_if_read_rnd(void)
|
|||
rf_if_write_register(TRX_RPC, RX_RPC_CTRL | TRX_RPC_RSVD_1);
|
||||
}
|
||||
|
||||
wait_ms(1);
|
||||
|
||||
wait_ns(1000);
|
||||
temp = ((rf_if_read_register(PHY_RSSI) >> 5) << 6);
|
||||
wait_ms(1);
|
||||
wait_ns(1000);
|
||||
temp |= ((rf_if_read_register(PHY_RSSI) >> 5) << 4);
|
||||
wait_ms(1);
|
||||
wait_ns(1000);
|
||||
temp |= ((rf_if_read_register(PHY_RSSI) >> 5) << 2);
|
||||
wait_ms(1);
|
||||
wait_ns(1000);
|
||||
temp |= ((rf_if_read_register(PHY_RSSI) >> 5));
|
||||
wait_ms(1);
|
||||
wait_ns(1000);
|
||||
if (rf_part_num == PART_AT86RF233) {
|
||||
rf_if_write_register(TRX_RPC, tmp_rpc_val);
|
||||
}
|
||||
|
|
|
@ -1083,10 +1083,10 @@ static void rf_reset(void)
|
|||
{
|
||||
// Shutdown
|
||||
rf->SDN = 1;
|
||||
wait_ms(10);
|
||||
ThisThread::sleep_for(10);
|
||||
// Wake up
|
||||
rf->SDN = 0;
|
||||
wait_ms(10);
|
||||
ThisThread::sleep_for(10);
|
||||
}
|
||||
|
||||
static void rf_init(void)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
#include "STModCellular.h"
|
||||
#include "mbed_wait_api.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
#include "mbed_trace.h"
|
||||
|
||||
#define TRACE_GROUP "CELL"
|
||||
|
@ -38,14 +38,14 @@ STModCellular::STModCellular(FileHandle *fh) : STMOD_CELLULAR_MODEM(fh),
|
|||
// start with modem disabled
|
||||
m_powerkey.write(0);
|
||||
m_reset.write(1);
|
||||
wait_ms(200);
|
||||
rtos::ThisThread::sleep_for(200);
|
||||
m_reset.write(0);
|
||||
wait_ms(150);
|
||||
rtos::ThisThread::sleep_for(150);
|
||||
|
||||
wait_ms(50);
|
||||
rtos::ThisThread::sleep_for(50);
|
||||
m_simsel0.write(MBED_CONF_STMOD_CELLULAR_SIM_SELECTION & 0x01);
|
||||
m_simsel1.write(MBED_CONF_STMOD_CELLULAR_SIM_SELECTION & 0x02);
|
||||
wait_ms(50);
|
||||
rtos::ThisThread::sleep_for(50);
|
||||
}
|
||||
|
||||
STModCellular::~STModCellular()
|
||||
|
@ -59,28 +59,28 @@ nsapi_error_t STModCellular::soft_power_on()
|
|||
#if (MBED_CONF_STMOD_CELLULAR_TYPE == STMOD_UG96)
|
||||
tr_debug("Booting UG96\r\n");
|
||||
m_reset.write(1);
|
||||
wait_ms(200);
|
||||
rtos::ThisThread::sleep_for(200);
|
||||
m_reset.write(0);
|
||||
wait_ms(150);
|
||||
rtos::ThisThread::sleep_for(150);
|
||||
m_powerkey.write(1);
|
||||
wait_ms(150);
|
||||
rtos::ThisThread::sleep_for(150);
|
||||
m_powerkey.write(0);
|
||||
/* Because modem status is not available on STMOD+ connector,
|
||||
* let's wait for Modem complete boot */
|
||||
wait_ms(2300);
|
||||
rtos::ThisThread::sleep_for(2300);
|
||||
#endif
|
||||
#if (MBED_CONF_STMOD_CELLULAR_TYPE == STMOD_BG96)
|
||||
tr_debug("Booting BG96\r\n");
|
||||
m_powerkey.write(1);
|
||||
m_reset.write(1);
|
||||
wait_ms(150);
|
||||
rtos::ThisThread::sleep_for(150);
|
||||
m_powerkey.write(0);
|
||||
m_reset.write(0);
|
||||
wait_ms(100);
|
||||
rtos::ThisThread::sleep_for(100);
|
||||
m_powerkey.write(1);
|
||||
wait_ms(200);
|
||||
rtos::ThisThread::sleep_for(200);
|
||||
m_powerkey.write(0);
|
||||
wait_ms(5000);
|
||||
rtos::ThisThread::sleep_for(5000);
|
||||
#endif
|
||||
|
||||
nsapi_error_t err = STMOD_CELLULAR_MODEM::soft_power_on();
|
||||
|
@ -133,7 +133,7 @@ nsapi_error_t STModCellular::soft_power_on()
|
|||
}
|
||||
#endif
|
||||
|
||||
wait_ms(500);
|
||||
rtos::ThisThread::sleep_for(500);
|
||||
|
||||
#if MBED_CONF_CELLULAR_DEBUG_AT
|
||||
_at->lock();
|
||||
|
@ -150,7 +150,7 @@ nsapi_error_t STModCellular::soft_power_off()
|
|||
{
|
||||
_at->cmd_start("AT+QPOWD");
|
||||
_at->cmd_stop();
|
||||
wait_ms(1000);
|
||||
rtos::ThisThread::sleep_for(1000);
|
||||
// should wait for POWERED DOWN with a time out up to 65 second according to the manual.
|
||||
// we cannot afford such a long wait though.
|
||||
return STMOD_CELLULAR_MODEM::soft_power_off();
|
||||
|
|
|
@ -661,8 +661,8 @@ int DataFlashBlockDevice::_sync(void)
|
|||
break;
|
||||
/* wait the typical write period before trying again */
|
||||
} else {
|
||||
DEBUG_PRINTF("wait_ms: %d\r\n", DATAFLASH_TIMING_ERASE_PROGRAM_PAGE);
|
||||
wait_ms(DATAFLASH_TIMING_ERASE_PROGRAM_PAGE);
|
||||
DEBUG_PRINTF("sleep_for: %d\r\n", DATAFLASH_TIMING_ERASE_PROGRAM_PAGE);
|
||||
rtos::ThisThread::sleep_for(DATAFLASH_TIMING_ERASE_PROGRAM_PAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "QSPIFBlockDevice.h"
|
||||
#include <string.h>
|
||||
#include "mbed_wait_api.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
|
||||
#ifndef MBED_CONF_MBED_TRACE_ENABLE
|
||||
#define MBED_CONF_MBED_TRACE_ENABLE 0
|
||||
|
@ -1146,7 +1146,7 @@ bool QSPIFBlockDevice::_is_mem_ready()
|
|||
bool mem_ready = true;
|
||||
|
||||
do {
|
||||
wait_ms(1);
|
||||
rtos::ThisThread::sleep_for(1);
|
||||
retries++;
|
||||
//Read the Status Register from device
|
||||
memset(status_value, 0xFF, QSPI_MAX_STATUS_REGISTER_SIZE);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "SPIFReducedBlockDevice.h"
|
||||
#include "mbed_wait_api.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
|
||||
using namespace mbed;
|
||||
|
||||
|
@ -224,7 +224,7 @@ int SPIFReducedBlockDevice::_sync()
|
|||
return 0;
|
||||
}
|
||||
|
||||
wait_ms(1);
|
||||
rtos::ThisThread::sleep_for(1);
|
||||
}
|
||||
|
||||
return BD_ERROR_DEVICE_ERROR;
|
||||
|
@ -244,7 +244,7 @@ int SPIFReducedBlockDevice::_wren()
|
|||
return 0;
|
||||
}
|
||||
|
||||
wait_ms(1);
|
||||
rtos::ThisThread::sleep_for(1);
|
||||
}
|
||||
|
||||
return BD_ERROR_DEVICE_ERROR;
|
||||
|
@ -278,7 +278,7 @@ int SPIFReducedBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_
|
|||
addr += chunk;
|
||||
size -= chunk;
|
||||
|
||||
wait_ms(1);
|
||||
rtos::ThisThread::sleep_for(1);
|
||||
|
||||
err = _sync();
|
||||
if (err) {
|
||||
|
|
|
@ -139,8 +139,8 @@
|
|||
#if DEVICE_SPI
|
||||
|
||||
#include "SDBlockDevice.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
#include "platform/mbed_debug.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
|
@ -872,7 +872,7 @@ uint32_t SDBlockDevice::_go_idle_state()
|
|||
if (R1_IDLE_STATE == response) {
|
||||
break;
|
||||
}
|
||||
wait_ms(1);
|
||||
rtos::ThisThread::sleep_for(1);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "MbedTester.h"
|
||||
#include "fpga_config.h"
|
||||
#include "BlockDevice.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_error.h"
|
||||
#include "drivers/MbedCRC.h"
|
||||
|
@ -1733,7 +1734,7 @@ uint8_t MbedTester::get_pwm_cycles_high()
|
|||
|
||||
uint16_t MbedTester::get_analogmuxin_measurement()
|
||||
{
|
||||
wait_ms(1);//wait for value to stabalize
|
||||
rtos::ThisThread::sleep_for(1);//wait for value to stabalize
|
||||
//take snapshot of conversion value to make safe for reading
|
||||
set_snapshot();
|
||||
uint16_t an_mux_analogin_measurement = 0;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "platform/Callback.h"
|
||||
#include "platform/mbed_atomic.h"
|
||||
#include "platform/mbed_debug.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
|
||||
#ifndef MBED_CONF_ESP8266_DEBUG
|
||||
#define MBED_CONF_ESP8266_DEBUG false
|
||||
|
@ -49,6 +49,7 @@
|
|||
#define TRACE_GROUP "ESPI" // ESP8266 Interface
|
||||
|
||||
using namespace mbed;
|
||||
using namespace rtos;
|
||||
|
||||
#if defined MBED_CONF_ESP8266_TX && defined MBED_CONF_ESP8266_RX
|
||||
ESP8266Interface::ESP8266Interface()
|
||||
|
@ -459,7 +460,7 @@ nsapi_error_t ESP8266Interface::_reset()
|
|||
_rst_pin.rst_assert();
|
||||
// If you happen to use Pin7 CH_EN as reset pin, not needed otherwise
|
||||
// https://www.espressif.com/sites/default/files/documentation/esp8266_hardware_design_guidelines_en.pdf
|
||||
wait_ms(2); // Documentation says 200 us should have been enough, but experimentation shows that 1ms was not enough
|
||||
ThisThread::sleep_for(2); // Documentation says 200 us; need 2 ticks to get minimum 1 ms.
|
||||
_esp.flush();
|
||||
_rst_pin.rst_deassert();
|
||||
} else {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)
|
||||
#include "UARTSerial.h"
|
||||
#endif // #if DEVICE_SERIAL
|
||||
#include "mbed_wait_api.h"
|
||||
#include "ThisThread.h"
|
||||
|
||||
#define NETWORK_TIMEOUT 30 * 60 * 1000 // 30 minutes
|
||||
#define DEVICE_TIMEOUT 5 * 60 * 1000 // 5 minutes
|
||||
|
@ -45,6 +45,7 @@
|
|||
|
||||
using namespace mbed_cellular_util;
|
||||
using namespace mbed;
|
||||
using namespace rtos;
|
||||
|
||||
AT_CellularContext::AT_CellularContext(ATHandler &at, CellularDevice *device, const char *apn, bool cp_req, bool nonip_req) :
|
||||
AT_CellularBase(at), _is_connected(false), _current_op(OP_INVALID), _fh(0), _cp_req(cp_req),
|
||||
|
@ -891,7 +892,7 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
|
|||
_cb_data.error == NSAPI_ERROR_OK) {
|
||||
if (!_apn) {
|
||||
char imsi[MAX_IMSI_LENGTH + 1];
|
||||
wait(1); // need to wait to access SIM in some modems
|
||||
ThisThread::sleep_for(1000); // need to wait to access SIM in some modems
|
||||
_cb_data.error = _device->open_information()->get_imsi(imsi, sizeof(imsi));
|
||||
if (_cb_data.error == NSAPI_ERROR_OK) {
|
||||
const char *apn_config = apnconfig(imsi);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "mbed_wait_api.h"
|
||||
#include "ThisThread.h"
|
||||
#include "AT_CellularSMS.h"
|
||||
#include "CellularUtil.h"
|
||||
#include "CellularLog.h"
|
||||
|
@ -26,6 +26,7 @@
|
|||
using namespace mbed_cellular_util;
|
||||
using namespace mbed;
|
||||
using namespace std;
|
||||
using namespace rtos;
|
||||
|
||||
#define CTRL_Z "\x1a"
|
||||
#define ESC "\x1b"
|
||||
|
@ -406,12 +407,12 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
|
|||
int write_size = 0;
|
||||
int remove_plus_sign = (phone_number[0] == '+') ? 1 : 0;
|
||||
|
||||
wait_ms(_sim_wait_time);
|
||||
ThisThread::sleep_for(_sim_wait_time);
|
||||
|
||||
if (_mode == CellularSMSMmodeText) {
|
||||
_at.cmd_start_stop("+CMGS", "=", "%s", phone_number + remove_plus_sign);
|
||||
|
||||
wait_ms(_sim_wait_time);
|
||||
ThisThread::sleep_for(_sim_wait_time);
|
||||
_at.resp_start("> ", true);
|
||||
|
||||
if (_at.get_last_error() == NSAPI_ERROR_OK) {
|
||||
|
@ -474,7 +475,7 @@ nsapi_size_or_error_t AT_CellularSMS::send_sms(const char *phone_number, const c
|
|||
|
||||
_at.cmd_start_stop("+CMGS", "=", "%d", (pdu_len - 2) / 2);
|
||||
|
||||
wait_ms(_sim_wait_time);
|
||||
ThisThread::sleep_for(_sim_wait_time);
|
||||
_at.resp_start("> ", true);
|
||||
|
||||
if (_at.get_last_error() == NSAPI_ERROR_OK) {
|
||||
|
@ -564,7 +565,7 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms_from_index(int msg_index, char *b
|
|||
/*
|
||||
* +CMGR: <stat>,<oa>,<alpha>,<scts>[,<tooa>,<fo>,<pid>,<dcs>,<sca>,<tosca>,<length>]<CR><LF><data><CR><LF>OK<CR><LF>
|
||||
*/
|
||||
wait_ms(_sim_wait_time);
|
||||
ThisThread::sleep_for(_sim_wait_time);
|
||||
_at.cmd_start_stop("+CMGR", "=", "%d", msg_index);
|
||||
|
||||
// TODO: NOTE: If the selected <mem1> can contain different types of SMs (e.g. SMS-DELIVERs, SMS-SUBMITs, SMS-STATUS-REPORTs and SMS-COMMANDs),
|
||||
|
@ -621,7 +622,7 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms(sms_info_t *sms, char *buf, char
|
|||
int pduSize;
|
||||
|
||||
for (int i = 0; i < sms->parts; i++) {
|
||||
wait_ms(_sim_wait_time);
|
||||
ThisThread::sleep_for(_sim_wait_time);
|
||||
_at.cmd_start_stop("+CMGR", "=", "%d", sms->msg_index[i]);
|
||||
_at.resp_start("+CMGR:");
|
||||
|
||||
|
@ -744,7 +745,7 @@ nsapi_size_or_error_t AT_CellularSMS::get_data_from_pdu(const char *pdu, sms_inf
|
|||
// read first the lower part of first octet as there is message type
|
||||
index++;
|
||||
tmp = hex_str_to_int(pdu + index, 1);
|
||||
//wait_ms(200);
|
||||
//ThisThread::sleep_for(200);
|
||||
if ((tmp & 0x03) == 0) {// SMS-DELIVER type, last two bits should be zero
|
||||
// UDH present? Check from first octets higher part
|
||||
tmp = hex_str_to_int(pdu + (--index), 1);
|
||||
|
@ -1071,7 +1072,7 @@ AT_CellularSMS::sms_info_t *AT_CellularSMS::get_oldest_sms_index()
|
|||
nsapi_size_or_error_t err = 0;
|
||||
while (current) {
|
||||
if (_mode == CellularSMSMmodeText) {
|
||||
wait_ms(_sim_wait_time);
|
||||
ThisThread::sleep_for(_sim_wait_time);
|
||||
err = read_sms_from_index(current->msg_index[0], NULL, 0, NULL, current->date);
|
||||
if (err != 0) {
|
||||
return NULL;
|
||||
|
|
|
@ -211,7 +211,7 @@ bool UBLOX_AT_CellularContext::activate_profile(const char *apn,
|
|||
if (activated) { //If context is activated, exit while loop and return status
|
||||
break;
|
||||
}
|
||||
wait_ms(5000); //Wait for 5 seconds and then try again
|
||||
rtos::ThisThread::sleep_for(5000); //Wait for 5 seconds and then try again
|
||||
}
|
||||
t1.stop();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "AT_CellularStack.h"
|
||||
#include "CellularUtil.h"
|
||||
#include "mbed_wait_api.h"
|
||||
#include "rtos/ThisThread.h"
|
||||
#include "drivers/Timer.h"
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "mbed_atomic.h"
|
||||
#include "mbed_assert.h"
|
||||
#include "mbed_error.h"
|
||||
#include "mbed_wait_api.h"
|
||||
#include "ThisThread.h"
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -836,7 +836,7 @@ int NVStore::init()
|
|||
init_attempts_val = core_util_atomic_incr_u32(&_init_attempts, 1);
|
||||
if (init_attempts_val != 1) {
|
||||
while (!_init_done) {
|
||||
wait_ms(1);
|
||||
rtos::ThisThread::sleep_for(1);
|
||||
}
|
||||
return NVSTORE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace rtos {
|
|||
RtosTimer timer(&blink);
|
||||
int main() {
|
||||
timer.start(1000); // call blink every 1s
|
||||
wait_ms(5000);
|
||||
ThisThread::sleep_for(5000);
|
||||
timer.stop(); // stop after 5s
|
||||
}
|
||||
@endcode
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "cellular/onboard_modem_api.h"
|
||||
#include "ublox_low_level_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#if MODEM_ON_BOARD
|
||||
|
@ -29,7 +29,7 @@ static void press_power_button(int time_ms)
|
|||
gpio_t gpio;
|
||||
|
||||
gpio_init_out_ex(&gpio, MDMPWRON, 0);
|
||||
wait_ms(time_ms);
|
||||
thread_sleep_for(time_ms);
|
||||
gpio_write(&gpio, 1);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void onboard_modem_power_up()
|
|||
/* keep the power line low for 150 milisecond */
|
||||
press_power_button(150);
|
||||
/* give modem a little time to respond */
|
||||
wait_ms(100);
|
||||
thread_sleep_for(100);
|
||||
}
|
||||
|
||||
void onboard_modem_power_down()
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <stdbool.h>
|
||||
#include "hal/us_ticker_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "gpio_api.h"
|
||||
#include "ublox_low_level_api.h"
|
||||
|
||||
|
@ -39,12 +40,10 @@ void ublox_mdm_init(void)
|
|||
// led should be off
|
||||
gpio_init_out_ex(&gpio, LED, 0);
|
||||
|
||||
// Can't use wait_ms() as RTOS isn't initialised yet
|
||||
//wait_ms(50); // when USB cable is inserted the interface chip issues
|
||||
// Can't use thread_sleep_for() as RTOS isn't initialised yet
|
||||
//thread_sleep_for(50); // when USB cable is inserted the interface chip issues
|
||||
// Here's the code from the non-RTOS version
|
||||
us_ticker_init();
|
||||
uint32_t start = us_ticker_read();
|
||||
while ((us_ticker_read() - start) < 50000);
|
||||
wait_us(50000);
|
||||
}
|
||||
|
||||
// For forwards compatibility
|
||||
|
@ -61,7 +60,7 @@ void ublox_mdm_powerOn(int usb)
|
|||
if (!modemOn) { // enable modem
|
||||
modemOn = true;
|
||||
gpio_init_out_ex(&gpio, MDMEN, 1); // LDOEN: 1=on
|
||||
wait_ms(1); // wait until supply switched off
|
||||
thread_sleep_for(1); // wait until supply switched off
|
||||
// now we can safely enable the level shifters
|
||||
gpio_init_out_ex(&gpio, MDMLVLOE, 0); // LVLEN: 0=enabled (uart/gpio)
|
||||
if (gpsOn) {
|
||||
|
@ -97,7 +96,7 @@ void ublox_gps_powerOn(void)
|
|||
gpsOn = true;
|
||||
// switch on power supply
|
||||
gpio_init_out_ex(&gpio, GPSEN, 1); // LDOEN: 1=on
|
||||
wait_ms(1); // wait until supply switched off
|
||||
thread_sleep_for(1); // wait until supply switched off
|
||||
if (modemOn) {
|
||||
gpio_init_out_ex(&gpio, MDMILVLOE, 1); // ILVLEN: 1=enabled (i2c)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <stdio.h>
|
||||
#include "mbed_assert.h"
|
||||
#include "mbed_events.h"
|
||||
#include "mbed_wait_api.h"
|
||||
|
||||
#include "rtw_emac.h"
|
||||
#include "EMACMemoryManager.h"
|
||||
|
@ -123,7 +122,7 @@ bool RTW_EMAC::link_out(emac_mem_buf_t *buf)
|
|||
bool RTW_EMAC::power_up()
|
||||
{
|
||||
wifi_on(RTW_MODE_STA);
|
||||
wait_ms(1000);
|
||||
rtos::ThisThread::sleep_for(1000);
|
||||
wlan_emac_link_change(true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#if MODEM_ON_BOARD
|
||||
|
@ -29,7 +29,7 @@ static void press_power_button(int time_ms)
|
|||
|
||||
gpio_init_out_ex(&gpio, MDMPWRON, 1);
|
||||
gpio_write(&gpio, 0);
|
||||
wait_ms(time_ms);
|
||||
thread_sleep_for(time_ms);
|
||||
gpio_write(&gpio, 1);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void onboard_modem_power_up()
|
|||
/* keep the power line low for 200 milisecond */
|
||||
press_power_button(200);
|
||||
/* give modem a little time to respond */
|
||||
wait_ms(100);
|
||||
thread_sleep_for(100);
|
||||
}
|
||||
|
||||
void onboard_modem_power_down()
|
||||
|
@ -59,7 +59,7 @@ void onboard_modem_power_down()
|
|||
* If 3G_ON_OFF pin is kept low for more than a second, a controlled disconnect and shutdown takes
|
||||
* place, Due to the network disconnect, shut-off can take up to 30 seconds. However, we wait for 10
|
||||
* seconds only */
|
||||
wait_ms(10 * 1000);
|
||||
thread_sleep_for(10 * 1000);
|
||||
}
|
||||
#endif //MODEM_ON_BOARD
|
||||
#endif //MBED_CONF_NSAPI_PRESENT
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#if MODEM_ON_BOARD
|
||||
|
@ -29,7 +29,7 @@ static void press_power_button(int time_ms)
|
|||
|
||||
gpio_init_out_ex(&gpio, MDMPWRON, 1);
|
||||
gpio_write(&gpio, 0);
|
||||
wait_ms(time_ms);
|
||||
thread_sleep_for(time_ms);
|
||||
gpio_write(&gpio, 1);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void onboard_modem_power_up()
|
|||
/* keep the power line low for 200 milisecond */
|
||||
press_power_button(200);
|
||||
/* give modem a little time to respond */
|
||||
wait_ms(100);
|
||||
thread_sleep_for(100);
|
||||
}
|
||||
|
||||
void onboard_modem_power_down()
|
||||
|
@ -59,7 +59,7 @@ void onboard_modem_power_down()
|
|||
* If 3G_ON_OFF pin is kept low for more than a second, a controlled disconnect and shutdown takes
|
||||
* place, Due to the network disconnect, shut-off can take up to 30 seconds. However, we wait for 10
|
||||
* seconds only */
|
||||
wait_ms(10 * 1000);
|
||||
thread_sleep_for(10 * 1000);
|
||||
}
|
||||
#endif //MODEM_ON_BOARD
|
||||
#endif //MBED_CONF_NSAPI_PRESENT
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "onboard_modem_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#if MODEM_ON_BOARD
|
||||
|
@ -71,7 +72,7 @@ void onboard_modem_power_up()
|
|||
#endif
|
||||
|
||||
/* give modem a little time to respond */
|
||||
wait_ms(100);
|
||||
thread_sleep_for(100);
|
||||
}
|
||||
|
||||
void onboard_modem_power_down()
|
||||
|
|
|
@ -1081,7 +1081,7 @@ void OdinWiFiInterface::handle_user_scan(user_scan_s *user_scan)
|
|||
cbRTSL_Status status = cbSTATUS_ERROR;
|
||||
for(int i = 0; (i < 10) && (status != cbSTATUS_OK); i++) {
|
||||
if(i > 0) {
|
||||
wait_ms(500);
|
||||
rtos::ThisThread::sleep_for(500);
|
||||
}
|
||||
|
||||
cbMAIN_driverLock();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#define WAIT_AFTER_POWR_CHANGED (1000) // [msec.]
|
||||
|
@ -32,7 +32,7 @@ static void press_power_button(int time_ms)
|
|||
gpio_t gpio;
|
||||
|
||||
gpio_init_out_ex(&gpio, PWRKEY, 1);
|
||||
wait_ms(time_ms);
|
||||
thread_sleep_for(time_ms);
|
||||
gpio_write(&gpio, 0);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void onboard_modem_init()
|
|||
// Main UART Interface
|
||||
gpio_init_out_ex(&gpio, MDMDTR, 0);
|
||||
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
}
|
||||
|
||||
void onboard_modem_deinit()
|
||||
|
@ -59,7 +59,7 @@ void onboard_modem_deinit()
|
|||
|
||||
// Power supply OFF
|
||||
gpio_init_out_ex(&gpio, M_POWR, 0);
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
}
|
||||
|
||||
void onboard_modem_power_up()
|
||||
|
@ -68,10 +68,10 @@ void onboard_modem_power_up()
|
|||
|
||||
// Power supply ON
|
||||
gpio_init_out_ex(&gpio, M_POWR, 1);
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
|
||||
// Turn on
|
||||
wait_ms(100);
|
||||
thread_sleep_for(100);
|
||||
press_power_button(200);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void onboard_modem_power_down()
|
|||
|
||||
// Power supply OFF
|
||||
gpio_init_out_ex(&gpio, M_POWR, 0);
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
}
|
||||
#endif //MODEM_ON_BOARD
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#define WAIT_AFTER_POWR_CHANGED (1000) // [msec.]
|
||||
|
@ -32,7 +32,7 @@ static void press_power_button(int time_ms)
|
|||
gpio_t gpio;
|
||||
|
||||
gpio_init_out_ex(&gpio, PWRKEY, 1);
|
||||
wait_ms(time_ms);
|
||||
thread_sleep_for(time_ms);
|
||||
gpio_write(&gpio, 0);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void onboard_modem_init()
|
|||
// Main UART Interface
|
||||
gpio_init_out_ex(&gpio, MDMDTR, 0);
|
||||
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
}
|
||||
|
||||
void onboard_modem_deinit()
|
||||
|
@ -64,10 +64,10 @@ void onboard_modem_power_up()
|
|||
|
||||
// Power supply ON
|
||||
gpio_init_out_ex(&gpio, M_POWR, 1);
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
|
||||
// Turn on
|
||||
wait_ms(100);
|
||||
thread_sleep_for(100);
|
||||
press_power_button(200);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ void onboard_modem_power_down()
|
|||
|
||||
// Power supply OFF
|
||||
gpio_init_out_ex(&gpio, M_POWR, 0);
|
||||
wait_ms(WAIT_AFTER_POWR_CHANGED);
|
||||
thread_sleep_for(WAIT_AFTER_POWR_CHANGED);
|
||||
}
|
||||
#endif //MODEM_ON_BOARD
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "onboard_modem_api.h"
|
||||
#include "gpio_api.h"
|
||||
#include "platform/mbed_wait_api.h"
|
||||
#include "platform/mbed_thread.h"
|
||||
#include "PinNames.h"
|
||||
|
||||
#if MODEM_ON_BOARD
|
||||
|
@ -69,7 +69,7 @@ void onboard_modem_power_up()
|
|||
while(i < 3)
|
||||
{
|
||||
press_power_button(150000);
|
||||
wait_ms(250);
|
||||
thread_sleep_for(250);
|
||||
|
||||
if(gpio_read(&gpio))
|
||||
{
|
||||
|
|
|
@ -17,9 +17,8 @@
|
|||
|
||||
#include "stdint.h"
|
||||
#include "USBMouse.h"
|
||||
#include "PlatformMutex.h"
|
||||
#include "ThisThread.h"
|
||||
#include "usb_phy_api.h"
|
||||
#include "mbed_wait_api.h"
|
||||
|
||||
|
||||
USBMouse::USBMouse(bool connect_blocking, MOUSE_TYPE mouse_type, uint16_t vendor_id, uint16_t product_id, uint16_t product_release):
|
||||
|
@ -157,7 +156,7 @@ bool USBMouse::double_click()
|
|||
_mutex.unlock();
|
||||
return false;
|
||||
}
|
||||
wait(0.1);
|
||||
rtos::ThisThread::sleep_for(100);
|
||||
bool ret = click(MOUSE_LEFT);
|
||||
|
||||
_mutex.unlock();
|
||||
|
@ -172,7 +171,7 @@ bool USBMouse::click(uint8_t button)
|
|||
_mutex.unlock();
|
||||
return false;
|
||||
}
|
||||
wait(0.01);
|
||||
rtos::ThisThread::sleep_for(10);
|
||||
bool ret = update(0, 0, 0, 0);
|
||||
|
||||
_mutex.unlock();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "stdint.h"
|
||||
#include "USBMouseKeyboard.h"
|
||||
#include "usb_phy_api.h"
|
||||
#include "mbed_wait_api.h"
|
||||
#include "ThisThread.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned char usage;
|
||||
|
@ -709,7 +709,7 @@ bool USBMouseKeyboard::doubleClick()
|
|||
_mutex.unlock();
|
||||
return false;
|
||||
}
|
||||
wait(0.1);
|
||||
rtos::ThisThread::sleep_for(100);
|
||||
bool ret = click(MOUSE_LEFT);
|
||||
|
||||
_mutex.unlock();
|
||||
|
@ -724,7 +724,7 @@ bool USBMouseKeyboard::click(uint8_t button)
|
|||
_mutex.unlock();
|
||||
return false;
|
||||
}
|
||||
wait(0.01);
|
||||
rtos::ThisThread::sleep_for(10);
|
||||
bool ret = update(0, 0, 0, 0);
|
||||
|
||||
_mutex.unlock();
|
||||
|
|
Loading…
Reference in New Issue