mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Fix the CI build issue
							parent
							
								
									83be3f24a5
								
							
						
					
					
						commit
						9739b565b2
					
				| 
						 | 
				
			
			@ -61,7 +61,7 @@ static volatile event_t received_event;
 | 
			
		|||
 | 
			
		||||
static void tx_done()
 | 
			
		||||
{
 | 
			
		||||
    thread_sleep_for(2);
 | 
			
		||||
    ThisThread::sleep_for(2);
 | 
			
		||||
    TEST_ASSERT_EQUAL(EV_NONE, received_event);
 | 
			
		||||
    received_event = EV_TX_DONE;
 | 
			
		||||
    TEST_ASSERT_EQUAL(osOK, event_sem.release());
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ static void tx_done()
 | 
			
		|||
 | 
			
		||||
static void tx_timeout()
 | 
			
		||||
{
 | 
			
		||||
    thread_sleep_for(2);
 | 
			
		||||
    ThisThread::sleep_for(2);
 | 
			
		||||
    TEST_ASSERT_EQUAL(EV_NONE, received_event);
 | 
			
		||||
    received_event = EV_TX_TIMEOUT;
 | 
			
		||||
    TEST_ASSERT_EQUAL(osOK, event_sem.release());
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +77,7 @@ static void tx_timeout()
 | 
			
		|||
 | 
			
		||||
static void rx_done(const uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
 | 
			
		||||
{
 | 
			
		||||
    thread_sleep_for(2);
 | 
			
		||||
    ThisThread::sleep_for(2);
 | 
			
		||||
    TEST_ASSERT_EQUAL(EV_NONE, received_event);
 | 
			
		||||
    received_event = EV_RX_DONE;
 | 
			
		||||
    TEST_ASSERT_EQUAL(osOK, event_sem.release());
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ static void rx_done(const uint8_t *payload, uint16_t size, int16_t rssi, int8_t
 | 
			
		|||
 | 
			
		||||
static void rx_timeout()
 | 
			
		||||
{
 | 
			
		||||
    thread_sleep_for(2);
 | 
			
		||||
    ThisThread::sleep_for(2);
 | 
			
		||||
    TEST_ASSERT_EQUAL(EV_NONE, received_event);
 | 
			
		||||
    received_event = EV_RX_TIMEOUT;
 | 
			
		||||
    TEST_ASSERT_EQUAL(osOK, event_sem.release());
 | 
			
		||||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ static void rx_timeout()
 | 
			
		|||
 | 
			
		||||
static void rx_error()
 | 
			
		||||
{
 | 
			
		||||
    thread_sleep_for(2);
 | 
			
		||||
    ThisThread::sleep_for(2);
 | 
			
		||||
    TEST_ASSERT_EQUAL(EV_NONE, received_event);
 | 
			
		||||
    received_event = EV_RX_ERROR;
 | 
			
		||||
    TEST_ASSERT_EQUAL(osOK, event_sem.release());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ static cmd_status_t handle_command(const char *key, const char *value)
 | 
			
		|||
 | 
			
		||||
    if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_NVIC) == 0) {
 | 
			
		||||
        greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK);
 | 
			
		||||
        thread_sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        NVIC_SystemReset();
 | 
			
		||||
        TEST_ASSERT_MESSAGE(0, "NVIC_SystemReset did not reset the device as expected.");
 | 
			
		||||
        return CMD_STATUS_ERROR;
 | 
			
		||||
| 
						 | 
				
			
			@ -112,13 +112,13 @@ static cmd_status_t handle_command(const char *key, const char *value)
 | 
			
		|||
#if DEVICE_WATCHDOG
 | 
			
		||||
    if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_WATCHDOG) == 0) {
 | 
			
		||||
        greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK);
 | 
			
		||||
        thread_sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS };
 | 
			
		||||
        if (hal_watchdog_init(&config) != WATCHDOG_STATUS_OK) {
 | 
			
		||||
            TEST_ASSERT_MESSAGE(0, "hal_watchdog_init() error.");
 | 
			
		||||
            return CMD_STATUS_ERROR;
 | 
			
		||||
        }
 | 
			
		||||
        thread_sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
        ThisThread::sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
        TEST_ASSERT_MESSAGE(0, "Watchdog did not reset the device as expected.");
 | 
			
		||||
        return CMD_STATUS_ERROR;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -451,7 +451,7 @@ void test_functional_count()
 | 
			
		|||
    set_time(CUSTOM_TIME_2);
 | 
			
		||||
 | 
			
		||||
    /* Wait 10 sec. */
 | 
			
		||||
    thread_sleep_for(DELAY_10_SEC * MS_PER_SEC);
 | 
			
		||||
    ThisThread::sleep_for(DELAY_10_SEC * MS_PER_SEC);
 | 
			
		||||
 | 
			
		||||
    /* Get time. */
 | 
			
		||||
    seconds = time(NULL);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ void test_stop()
 | 
			
		|||
    TEST_ASSERT_TRUE(watchdog.stop());
 | 
			
		||||
    TEST_ASSERT_FALSE(watchdog.is_running());
 | 
			
		||||
    // Make sure that a disabled watchdog does not reset the core.
 | 
			
		||||
    thread_sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
    ThisThread::sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
 | 
			
		||||
    TEST_ASSERT_FALSE(watchdog.stop());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +173,7 @@ utest::v1::status_t case_teardown_sync_on_reset(const Case *const source, const
 | 
			
		|||
    }
 | 
			
		||||
    greentea_send_kv(MSG_KEY_DEVICE_RESET, CASE_INDEX_START + CASE_INDEX_CURRENT);
 | 
			
		||||
    utest_printf("The device will now restart.\n");
 | 
			
		||||
    thread_sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
    ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
    NVIC_SystemReset();
 | 
			
		||||
    return status; // Reset is instant so this line won't be reached.
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -98,7 +98,7 @@ static cmd_status_t handle_command(const char *key, const char *value)
 | 
			
		|||
 | 
			
		||||
    if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_NVIC) == 0) {
 | 
			
		||||
        greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK);
 | 
			
		||||
        thread_sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        NVIC_SystemReset();
 | 
			
		||||
        TEST_ASSERT_MESSAGE(0, "NVIC_SystemReset did not reset the device as expected.");
 | 
			
		||||
        return CMD_STATUS_ERROR;
 | 
			
		||||
| 
						 | 
				
			
			@ -107,13 +107,13 @@ static cmd_status_t handle_command(const char *key, const char *value)
 | 
			
		|||
#if DEVICE_WATCHDOG
 | 
			
		||||
    if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_WATCHDOG) == 0) {
 | 
			
		||||
        greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK);
 | 
			
		||||
        thread_sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
        watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS };
 | 
			
		||||
        if (hal_watchdog_init(&config) != WATCHDOG_STATUS_OK) {
 | 
			
		||||
            TEST_ASSERT_MESSAGE(0, "hal_watchdog_init() error.");
 | 
			
		||||
            return CMD_STATUS_ERROR;
 | 
			
		||||
        }
 | 
			
		||||
        thread_sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
        ThisThread::sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
        TEST_ASSERT_MESSAGE(0, "Watchdog did not reset the device as expected.");
 | 
			
		||||
        return CMD_STATUS_ERROR;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,9 +61,9 @@ void rtc_sleep_test_support(bool deepsleep_mode)
 | 
			
		|||
     * to allow for hardware serial buffers to completely flush.
 | 
			
		||||
     * 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 thread_sleep_for() function for now.
 | 
			
		||||
     * so we'll use the ThisThread::sleep_for() function for now.
 | 
			
		||||
     */
 | 
			
		||||
    thread_sleep_for(10);
 | 
			
		||||
    ThisThread::sleep_for(10);
 | 
			
		||||
 | 
			
		||||
    rtc_init();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -187,7 +187,7 @@ void test_set_time_twice()
 | 
			
		|||
    TEST_ASSERT_EQUAL(true, (current_time == NEW_TIME));
 | 
			
		||||
 | 
			
		||||
    /* Wait 2 seconds */
 | 
			
		||||
    thread_sleep_for(2000);
 | 
			
		||||
    ThisThread::sleep_for(2000);
 | 
			
		||||
 | 
			
		||||
    /* set the time to NEW_TIME again and check it */
 | 
			
		||||
    set_time(NEW_TIME);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -100,7 +100,7 @@ void test_stop()
 | 
			
		|||
    TEST_ASSERT_EQUAL(WATCHDOG_STATUS_OK, hal_watchdog_init(&WDG_CONFIG_DEFAULT));
 | 
			
		||||
    TEST_ASSERT_EQUAL(WATCHDOG_STATUS_OK, hal_watchdog_stop());
 | 
			
		||||
    // Make sure that a disabled watchdog does not reset the core.
 | 
			
		||||
    thread_sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
    ThisThread::sleep_for(2 * WDG_TIMEOUT_MS); // Watchdog should fire before twice the timeout value.
 | 
			
		||||
 | 
			
		||||
    TEST_ASSERT_EQUAL(WATCHDOG_STATUS_OK, hal_watchdog_stop());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -170,7 +170,7 @@ utest::v1::status_t case_teardown_sync_on_reset(const Case *const source, const
 | 
			
		|||
    }
 | 
			
		||||
    greentea_send_kv(MSG_KEY_DEVICE_RESET, CASE_INDEX_START + CASE_INDEX_CURRENT);
 | 
			
		||||
    utest_printf("The device will now restart.\n");
 | 
			
		||||
    thread_sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
    ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush.
 | 
			
		||||
    NVIC_SystemReset();
 | 
			
		||||
    return status; // Reset is instant so this line won't be reached.
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,11 +127,11 @@ void fpga_pwm_period_fill_test(PinName pin, uint32_t period_ms, uint32_t fill_pr
 | 
			
		|||
            break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    thread_sleep_for(period_ms);
 | 
			
		||||
    ThisThread::sleep_for(period_ms);
 | 
			
		||||
 | 
			
		||||
    tester.io_metrics_start();
 | 
			
		||||
 | 
			
		||||
    thread_sleep_for(NUM_OF_PERIODS * period_ms);
 | 
			
		||||
    ThisThread::sleep_for(NUM_OF_PERIODS * period_ms);
 | 
			
		||||
 | 
			
		||||
    tester.io_metrics_stop();
 | 
			
		||||
    core_util_critical_section_exit();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -233,7 +233,7 @@ void ep_test_data_correctness()
 | 
			
		|||
        // Wait for host before terminating
 | 
			
		||||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
#if EP_DBG
 | 
			
		||||
        thread_sleep_for(100);
 | 
			
		||||
        ThisThread::sleep_for(100);
 | 
			
		||||
        printf("cnt_cb_set_conf = %lu\r\n", serial.get_cnt_cb_set_conf());
 | 
			
		||||
        printf("cnt_cb_set_intf = %lu\r\n", serial.get_cnt_cb_set_intf());
 | 
			
		||||
        printf("cnt_cb_bulk_out = %lu\r\n", serial.get_cnt_cb_bulk_out());
 | 
			
		||||
| 
						 | 
				
			
			@ -270,7 +270,7 @@ void ep_test_halt()
 | 
			
		|||
        // Wait for host before terminating
 | 
			
		||||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
#if EP_DBG
 | 
			
		||||
        thread_sleep_for(100);
 | 
			
		||||
        ThisThread::sleep_for(100);
 | 
			
		||||
        printf("cnt_cb_set_conf = %lu\r\n", serial.get_cnt_cb_set_conf());
 | 
			
		||||
        printf("cnt_cb_set_intf = %lu\r\n", serial.get_cnt_cb_set_intf());
 | 
			
		||||
        printf("cnt_cb_bulk_out = %lu\r\n", serial.get_cnt_cb_bulk_out());
 | 
			
		||||
| 
						 | 
				
			
			@ -307,7 +307,7 @@ void ep_test_parallel_transfers()
 | 
			
		|||
        // Wait for host before terminating
 | 
			
		||||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
#if EP_DBG
 | 
			
		||||
        thread_sleep_for(100);
 | 
			
		||||
        ThisThread::sleep_for(100);
 | 
			
		||||
        printf("cnt_cb_set_conf = %lu\r\n", serial.get_cnt_cb_set_conf());
 | 
			
		||||
        printf("cnt_cb_set_intf = %lu\r\n", serial.get_cnt_cb_set_intf());
 | 
			
		||||
        printf("cnt_cb_bulk_out = %lu\r\n", serial.get_cnt_cb_bulk_out());
 | 
			
		||||
| 
						 | 
				
			
			@ -345,7 +345,7 @@ void ep_test_parallel_transfers_ctrl()
 | 
			
		|||
        // Wait for host before terminating
 | 
			
		||||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
#if EP_DBG
 | 
			
		||||
        thread_sleep_for(100);
 | 
			
		||||
        ThisThread::sleep_for(100);
 | 
			
		||||
        printf("cnt_cb_set_conf = %lu\r\n", serial.get_cnt_cb_set_conf());
 | 
			
		||||
        printf("cnt_cb_set_intf = %lu\r\n", serial.get_cnt_cb_set_intf());
 | 
			
		||||
        printf("cnt_cb_bulk_out = %lu\r\n", serial.get_cnt_cb_bulk_out());
 | 
			
		||||
| 
						 | 
				
			
			@ -381,7 +381,7 @@ void ep_test_abort()
 | 
			
		|||
        greentea_send_kv("ep_test_abort", serial.get_serial_desc_string());
 | 
			
		||||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
#if EP_DBG
 | 
			
		||||
        thread_sleep_for(100);
 | 
			
		||||
        ThisThread::sleep_for(100);
 | 
			
		||||
        printf("cnt_cb_set_conf = %lu\r\n", serial.get_cnt_cb_set_conf());
 | 
			
		||||
        printf("cnt_cb_set_intf = %lu\r\n", serial.get_cnt_cb_set_intf());
 | 
			
		||||
        printf("cnt_cb_bulk_out = %lu\r\n", serial.get_cnt_cb_bulk_out());
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +420,7 @@ void ep_test_data_toggle()
 | 
			
		|||
        greentea_send_kv("ep_test_data_toggle", serial.get_serial_desc_string());
 | 
			
		||||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
#if EP_DBG
 | 
			
		||||
        thread_sleep_for(100);
 | 
			
		||||
        ThisThread::sleep_for(100);
 | 
			
		||||
        printf("cnt_cb_set_conf = %lu\r\n", serial.get_cnt_cb_set_conf());
 | 
			
		||||
        printf("cnt_cb_set_intf = %lu\r\n", serial.get_cnt_cb_set_intf());
 | 
			
		||||
        printf("cnt_cb_bulk_out = %lu\r\n", serial.get_cnt_cb_bulk_out());
 | 
			
		||||
| 
						 | 
				
			
			@ -566,7 +566,7 @@ void device_suspend_resume_test()
 | 
			
		|||
        greentea_parse_kv(_key, _value, sizeof(_key), sizeof(_value));
 | 
			
		||||
        printf("[2] suspend_count: %d  resume_count: %d\n", serial.get_suspend_count(), serial.get_resume_count());
 | 
			
		||||
        TEST_ASSERT_EQUAL_STRING("pass", _key);
 | 
			
		||||
        thread_sleep_for(5000);
 | 
			
		||||
        ThisThread::sleep_for(5000);
 | 
			
		||||
        printf("[3] suspend_count: %d  resume_count: %d\n", serial.get_suspend_count(), serial.get_resume_count());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -440,7 +440,7 @@ void mount_unmount_and_data_test(BlockDevice *bd, FileSystem *fs)
 | 
			
		|||
    TEST_ASSERT_EQUAL_STRING("passed", _key);
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    } while (test_files_exist(fs_root));
 | 
			
		||||
    TEST_ASSERT_EQUAL(false, test_files_exist(fs_root));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -296,7 +296,7 @@ void test_cdc_usb_reconnect()
 | 
			
		|||
    usb_cdc.connect();
 | 
			
		||||
    // Wait for the USB enumeration to complete.
 | 
			
		||||
    while (!usb_cdc.configured()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_cdc.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_cdc.ready());
 | 
			
		||||
| 
						 | 
				
			
			@ -305,7 +305,7 @@ void test_cdc_usb_reconnect()
 | 
			
		|||
    // Wait for the host to open the port.
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_cdc.configured());
 | 
			
		||||
| 
						 | 
				
			
			@ -316,12 +316,12 @@ void test_cdc_usb_reconnect()
 | 
			
		|||
    TEST_ASSERT_FALSE(usb_cdc.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_cdc.ready());
 | 
			
		||||
 | 
			
		||||
    thread_sleep_for(USB_RECONNECT_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(USB_RECONNECT_DELAY_MS);
 | 
			
		||||
    // Connect the USB device again.
 | 
			
		||||
    usb_cdc.connect();
 | 
			
		||||
    // Wait for the USB enumeration to complete.
 | 
			
		||||
    while (!usb_cdc.configured()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_cdc.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_cdc.ready());
 | 
			
		||||
| 
						 | 
				
			
			@ -330,7 +330,7 @@ void test_cdc_usb_reconnect()
 | 
			
		|||
    // Wait for the host to open the port again.
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_cdc.configured());
 | 
			
		||||
| 
						 | 
				
			
			@ -355,7 +355,7 @@ void test_cdc_rx_single_bytes()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_SEND_BYTES_SINGLE, MSG_VALUE_DUMMY);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    uint8_t buff = 0x01;
 | 
			
		||||
| 
						 | 
				
			
			@ -369,7 +369,7 @@ void test_cdc_rx_single_bytes()
 | 
			
		|||
    }
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_cdc.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_cdc.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -380,7 +380,7 @@ void tx_thread_fun(USBCDC *usb_cdc)
 | 
			
		|||
    uint8_t buff[TX_BUFF_SIZE] = { 0 };
 | 
			
		||||
    while (event_flags.get() & EF_SEND) {
 | 
			
		||||
        if (!usb_cdc->send(buff, TX_BUFF_SIZE)) {
 | 
			
		||||
            thread_sleep_for(1);
 | 
			
		||||
            ThisThread::sleep_for(1);
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        buff_val++;
 | 
			
		||||
| 
						 | 
				
			
			@ -402,7 +402,7 @@ void test_cdc_rx_single_bytes_concurrent()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_SEND_BYTES_SINGLE, MSG_VALUE_DUMMY);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    Thread tx_thread;
 | 
			
		||||
| 
						 | 
				
			
			@ -421,7 +421,7 @@ void test_cdc_rx_single_bytes_concurrent()
 | 
			
		|||
    tx_thread.join();
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_cdc.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_cdc.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -439,7 +439,7 @@ void test_cdc_rx_multiple_bytes()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_SEND_BYTES_MULTIPLE, HOST_RX_BUFF_SIZE_RATIO);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    uint8_t buff[RX_BUFF_SIZE] = { 0 };
 | 
			
		||||
| 
						 | 
				
			
			@ -460,7 +460,7 @@ void test_cdc_rx_multiple_bytes()
 | 
			
		|||
    }
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_cdc.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_cdc.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -479,7 +479,7 @@ void test_cdc_rx_multiple_bytes_concurrent()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_SEND_BYTES_MULTIPLE, HOST_RX_BUFF_SIZE_RATIO);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    Thread tx_thread;
 | 
			
		||||
| 
						 | 
				
			
			@ -505,7 +505,7 @@ void test_cdc_rx_multiple_bytes_concurrent()
 | 
			
		|||
    tx_thread.join();
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_cdc.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_cdc.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -524,7 +524,7 @@ void test_cdc_loopback()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_LOOPBACK, MSG_VALUE_DUMMY);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_cdc.wait_ready();
 | 
			
		||||
    uint8_t rx_buff, tx_buff;
 | 
			
		||||
| 
						 | 
				
			
			@ -537,7 +537,7 @@ void test_cdc_loopback()
 | 
			
		|||
    }
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_cdc.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_cdc.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -559,7 +559,7 @@ void test_serial_usb_reconnect()
 | 
			
		|||
    usb_serial.connect();
 | 
			
		||||
    // Wait for the USB enumeration to complete.
 | 
			
		||||
    while (!usb_serial.configured()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_serial.connected());
 | 
			
		||||
| 
						 | 
				
			
			@ -569,10 +569,10 @@ void test_serial_usb_reconnect()
 | 
			
		|||
    // Wait for the host to open the port.
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    while (!usb_serial.connected()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.connected());
 | 
			
		||||
| 
						 | 
				
			
			@ -584,12 +584,12 @@ void test_serial_usb_reconnect()
 | 
			
		|||
    TEST_ASSERT_FALSE(usb_serial.connected());
 | 
			
		||||
    TEST_ASSERT_EQUAL_INT(0, usb_serial.readable());
 | 
			
		||||
 | 
			
		||||
    thread_sleep_for(USB_RECONNECT_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(USB_RECONNECT_DELAY_MS);
 | 
			
		||||
    // Connect the USB device again.
 | 
			
		||||
    usb_serial.connect();
 | 
			
		||||
    // Wait for the USB enumeration to complete.
 | 
			
		||||
    while (!usb_serial.configured()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_serial.connected());
 | 
			
		||||
| 
						 | 
				
			
			@ -599,10 +599,10 @@ void test_serial_usb_reconnect()
 | 
			
		|||
    // Wait for the host to open the port again.
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    while (!usb_serial.connected()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.connected());
 | 
			
		||||
| 
						 | 
				
			
			@ -629,10 +629,10 @@ void test_serial_term_reopen()
 | 
			
		|||
    // Wait for the host to open the terminal.
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    while (!usb_serial.connected()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.ready());
 | 
			
		||||
| 
						 | 
				
			
			@ -641,7 +641,7 @@ void test_serial_term_reopen()
 | 
			
		|||
 | 
			
		||||
    // Wait for the host to close the terminal.
 | 
			
		||||
    while (usb_serial.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_serial.ready());
 | 
			
		||||
| 
						 | 
				
			
			@ -652,10 +652,10 @@ void test_serial_term_reopen()
 | 
			
		|||
    // Wait for the host to open the terminal again.
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    while (!usb_serial.connected()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.ready());
 | 
			
		||||
| 
						 | 
				
			
			@ -664,7 +664,7 @@ void test_serial_term_reopen()
 | 
			
		|||
 | 
			
		||||
    // Wait for the host to close the terminal again.
 | 
			
		||||
    while (usb_serial.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    TEST_ASSERT_TRUE(usb_serial.configured());
 | 
			
		||||
    TEST_ASSERT_FALSE(usb_serial.ready());
 | 
			
		||||
| 
						 | 
				
			
			@ -687,7 +687,7 @@ void test_serial_getc()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_SEND_BYTES_SINGLE, MSG_VALUE_DUMMY);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    for (int expected = 0xff; expected >= 0; expected--) {
 | 
			
		||||
| 
						 | 
				
			
			@ -698,7 +698,7 @@ void test_serial_getc()
 | 
			
		|||
    }
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_serial.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_serial.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -719,7 +719,7 @@ void test_serial_printf_scanf()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_LOOPBACK, MSG_VALUE_DUMMY);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    static const char fmt[] = "Formatted\nstring %i.";
 | 
			
		||||
| 
						 | 
				
			
			@ -735,7 +735,7 @@ void test_serial_printf_scanf()
 | 
			
		|||
    }
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_serial.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_serial.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -764,7 +764,7 @@ void test_serial_line_coding_change()
 | 
			
		|||
    greentea_send_kv(MSG_KEY_CHANGE_LINE_CODING, MSG_VALUE_DUMMY);
 | 
			
		||||
#if LINUX_HOST_DTR_FIX
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    thread_sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
    ThisThread::sleep_for(LINUX_HOST_DTR_FIX_DELAY_MS);
 | 
			
		||||
#endif
 | 
			
		||||
    usb_serial.wait_ready();
 | 
			
		||||
    usb_serial.attach(line_coding_changed_cb);
 | 
			
		||||
| 
						 | 
				
			
			@ -805,7 +805,7 @@ void test_serial_line_coding_change()
 | 
			
		|||
    }
 | 
			
		||||
    // Wait for the host to close its port.
 | 
			
		||||
    while (usb_serial.ready()) {
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        ThisThread::sleep_for(1);
 | 
			
		||||
    }
 | 
			
		||||
    usb_serial.disconnect();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,7 +59,7 @@
 | 
			
		|||
 *     int toggle = 0;
 | 
			
		||||
 *     while (1) {
 | 
			
		||||
 *         tester.gpio_write(MbedTester::LogicalPinGPIO0, toggle, true);
 | 
			
		||||
 *         thread_sleep_for(500);
 | 
			
		||||
 *         ThisThread::sleep_for(500);
 | 
			
		||||
 *         toggle = !toggle;
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -154,7 +154,7 @@ public:
 | 
			
		|||
     *             printf("Message received: %d\n\n", msg.data[0]);
 | 
			
		||||
     *             led2 = !led2;
 | 
			
		||||
     *         }
 | 
			
		||||
     *         thread_sleep_for(200);
 | 
			
		||||
     *         ThisThread::sleep_for(200);
 | 
			
		||||
     *     }
 | 
			
		||||
     * }
 | 
			
		||||
     *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ namespace mbed {
 | 
			
		|||
 *         if(enable) {
 | 
			
		||||
 *             led = !led;
 | 
			
		||||
 *         }
 | 
			
		||||
 *         thread_sleep_for(250);
 | 
			
		||||
 *         ThisThread::sleep_for(250);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ namespace mbed {
 | 
			
		|||
 * int main() {
 | 
			
		||||
 *     while(1) {
 | 
			
		||||
 *         led = !led;
 | 
			
		||||
 *         thread_sleep_for(200);
 | 
			
		||||
 *         ThisThread::sleep_for(200);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ namespace mbed {
 | 
			
		|||
 *         // set up configuration register (at 0x01)
 | 
			
		||||
 *         i2c.write(addr8bit, cmd, 2);
 | 
			
		||||
 *
 | 
			
		||||
 *         thread_sleep_for(500);
 | 
			
		||||
 *         ThisThread::sleep_for(500);
 | 
			
		||||
 *
 | 
			
		||||
 *         // read temperature register
 | 
			
		||||
 *         cmd[0] = 0x00;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ namespace mbed {
 | 
			
		|||
 *     event.rise(&trigger);
 | 
			
		||||
 *     while(1) {
 | 
			
		||||
 *         led = !led;
 | 
			
		||||
 *         thread_sleep_for(250);
 | 
			
		||||
 *         ThisThread::sleep_for(250);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,9 +48,9 @@ namespace mbed {
 | 
			
		|||
 * int main() {
 | 
			
		||||
 *     while(1) {
 | 
			
		||||
 *         ledport = LED_MASK;
 | 
			
		||||
 *         thread_sleep_for(1000);
 | 
			
		||||
 *         ThisThread::sleep_for(1000);
 | 
			
		||||
 *         ledport = 0;
 | 
			
		||||
 *         thread_sleep_for(1000);
 | 
			
		||||
 *         ThisThread::sleep_for(1000);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ namespace mbed {
 | 
			
		|||
 * int main() {
 | 
			
		||||
 *     while(1) {
 | 
			
		||||
 *         led = led + 0.01;
 | 
			
		||||
 *         thread_sleep_for(200);
 | 
			
		||||
 *         ThisThread::sleep_for(200);
 | 
			
		||||
 *         if(led == 1.0) {
 | 
			
		||||
 *             led = 0;
 | 
			
		||||
 *         }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,7 +61,7 @@ namespace mbed {
 | 
			
		|||
 *         } else {
 | 
			
		||||
 *             led2 = !led2;
 | 
			
		||||
 *         }
 | 
			
		||||
 *         thread_sleep_for(200);
 | 
			
		||||
 *         ThisThread::sleep_for(200);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,7 @@ namespace mbed {
 | 
			
		|||
 *     timeout.attach(&attimeout, 5);
 | 
			
		||||
 *     while(on) {
 | 
			
		||||
 *         led = !led;
 | 
			
		||||
 *         thread_sleep_for(200);
 | 
			
		||||
 *         ThisThread::sleep_for(200);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -93,7 +93,7 @@ enum FUNCTION_KEY {
 | 
			
		|||
 * {
 | 
			
		||||
 *   while (1) {
 | 
			
		||||
 *       key.printf("Hello World\r\n");
 | 
			
		||||
 *       thread_sleep_for(1000);
 | 
			
		||||
 *       ThisThread::sleep_for(1000);
 | 
			
		||||
 *   }
 | 
			
		||||
 * }
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,9 +49,9 @@
 | 
			
		|||
*    while (1) {
 | 
			
		||||
*        for(int i=48; i<83; i++) {     // send some messages!
 | 
			
		||||
*            midi.write(MIDIMessage::NoteOn(i));
 | 
			
		||||
*            thread_sleep_for(250);
 | 
			
		||||
*            ThisThread::sleep_for(250);
 | 
			
		||||
*            midi.write(MIDIMessage::NoteOff(i));
 | 
			
		||||
*            thread_sleep_for(500);
 | 
			
		||||
*            ThisThread::sleep_for(500);
 | 
			
		||||
*        }
 | 
			
		||||
*    }
 | 
			
		||||
* }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,7 +69,7 @@ enum MOUSE_TYPE {
 | 
			
		|||
 *   while (1)
 | 
			
		||||
 *   {
 | 
			
		||||
 *      mouse.move(20, 0);
 | 
			
		||||
 *      thread_sleep_for(500);
 | 
			
		||||
 *      ThisThread::sleep_for(500);
 | 
			
		||||
 *   }
 | 
			
		||||
 * }
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ enum MOUSE_TYPE {
 | 
			
		|||
 *
 | 
			
		||||
 *       mouse.move(x_screen, y_screen);
 | 
			
		||||
 *       angle += 3;
 | 
			
		||||
 *       thread_sleep_for(10);
 | 
			
		||||
 *       ThisThread::sleep_for(10);
 | 
			
		||||
 *   }
 | 
			
		||||
 * }
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,7 @@
 | 
			
		|||
 *   {
 | 
			
		||||
 *       key_mouse.move(20, 0);
 | 
			
		||||
 *       key_mouse.printf("Hello From MBED\r\n");
 | 
			
		||||
 *       thread_sleep_for(1000);
 | 
			
		||||
 *       ThisThread::sleep_for(1000);
 | 
			
		||||
 *   }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +68,7 @@
 | 
			
		|||
 *   {
 | 
			
		||||
 *       key_mouse.move(X_MAX_ABS/2, Y_MAX_ABS/2);
 | 
			
		||||
 *       key_mouse.printf("Hello from MBED\r\n");
 | 
			
		||||
 *       thread_sleep_for(1000);
 | 
			
		||||
 *       ThisThread::sleep_for(1000);
 | 
			
		||||
 *   }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@
 | 
			
		|||
*    while(1)
 | 
			
		||||
*    {
 | 
			
		||||
*        serial.printf("I am a virtual serial port\n");
 | 
			
		||||
*        thread_sleep_for(1000);
 | 
			
		||||
*        ThisThread::sleep_for(1000);
 | 
			
		||||
*    }
 | 
			
		||||
* }
 | 
			
		||||
* @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -150,9 +150,9 @@ void ble::vendor::odin_w2::HCIDriver::do_initialize()
 | 
			
		|||
    hci_rts = 1;            // Flow Control is OFF
 | 
			
		||||
 | 
			
		||||
    shutdown = 0;           // BT Power is OFF
 | 
			
		||||
    thread_sleep_for(20);
 | 
			
		||||
    ThisThread::sleep_for(20);
 | 
			
		||||
    shutdown = 1;           // BT Power is ON
 | 
			
		||||
    thread_sleep_for(500);
 | 
			
		||||
    ThisThread::sleep_for(500);
 | 
			
		||||
 | 
			
		||||
    hci_rts = 0;            // Flow Control is ON
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -96,13 +96,13 @@ public:
 | 
			
		|||
        output_mode(bt_device_wake_name, 0);
 | 
			
		||||
        output_mode(bt_power_name, 1);
 | 
			
		||||
 | 
			
		||||
        thread_sleep_for(500);
 | 
			
		||||
        ThisThread::sleep_for(500);
 | 
			
		||||
 | 
			
		||||
        bt_device_wake = 0;
 | 
			
		||||
        thread_sleep_for(500);
 | 
			
		||||
        ThisThread::sleep_for(500);
 | 
			
		||||
 | 
			
		||||
        bt_power = 1;
 | 
			
		||||
        thread_sleep_for(500);
 | 
			
		||||
        ThisThread::sleep_for(500);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void do_terminate() { }
 | 
			
		||||
| 
						 | 
				
			
			@ -312,7 +312,7 @@ private:
 | 
			
		|||
        service_pack_next = NULL;
 | 
			
		||||
        service_pack_index = 0;
 | 
			
		||||
        service_pack_transfered = true;
 | 
			
		||||
        thread_sleep_for(1000);
 | 
			
		||||
        ThisThread::sleep_for(1000);
 | 
			
		||||
        set_sleep_mode();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -210,7 +210,7 @@ bool SMSC9220_EMAC::power_up()
 | 
			
		|||
                                   this));
 | 
			
		||||
 | 
			
		||||
    /* Initialize the hardware */
 | 
			
		||||
    enum smsc9220_error_t init_successful = smsc9220_init(dev, &wait_ms);
 | 
			
		||||
    enum smsc9220_error_t init_successful = smsc9220_init(dev, &ThisThread::sleep_for);
 | 
			
		||||
    if (init_successful != SMSC9220_ERROR_NONE) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -236,7 +236,7 @@ bool SMSC9220_EMAC::power_up()
 | 
			
		|||
                                             &SMSC9220_EMAC::link_status_task));
 | 
			
		||||
 | 
			
		||||
    /* Allow the Link Status task to detect the initial link state */
 | 
			
		||||
    wait_ms(10);
 | 
			
		||||
    ThisThread::sleep_for(10);
 | 
			
		||||
    _link_status_task_handle = mbed::mbed_event_queue()->call_every(
 | 
			
		||||
                              LINK_STATUS_TASK_PERIOD_MS,
 | 
			
		||||
                              mbed::callback(this,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ struct timeval {
 | 
			
		|||
 *         strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
 | 
			
		||||
 *         printf("Time as a custom formatted string = %s", buffer);
 | 
			
		||||
 *
 | 
			
		||||
 *         thread_sleep_for(1000);
 | 
			
		||||
 *         ThisThread::sleep_for(1000);
 | 
			
		||||
 *     }
 | 
			
		||||
 * }
 | 
			
		||||
 * @endcode
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -140,7 +140,7 @@ struct Waiter;
 | 
			
		|||
 *     // Mutex must be unlocked before the worker thread can acquire it.
 | 
			
		||||
 *     mutex.unlock();
 | 
			
		||||
 *
 | 
			
		||||
 *     thread_sleep_for(1000);
 | 
			
		||||
 *     ThisThread::sleep_for(1000);
 | 
			
		||||
 *   }
 | 
			
		||||
 *
 | 
			
		||||
 *   // Change done and notify waiters of this.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ unsigned int smsc9220_mac_regread(unsigned char regoffset, unsigned int *data)
 | 
			
		|||
        timedout = 50;
 | 
			
		||||
        do {
 | 
			
		||||
            val = SMSC9220->BYTE_TEST;  // A no-op read.
 | 
			
		||||
            wait_ms(1);
 | 
			
		||||
            thread_sleep_for(1);
 | 
			
		||||
            timedout--;
 | 
			
		||||
        } while(timedout && (SMSC9220->MAC_CSR_CMD & ((unsigned int)1 << 31)));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -91,7 +91,7 @@ unsigned int smsc9220_mac_regwrite(unsigned char regoffset, unsigned int data)
 | 
			
		|||
        timedout = 50;
 | 
			
		||||
        do {
 | 
			
		||||
            read = SMSC9220->BYTE_TEST;     // A no-op read.
 | 
			
		||||
            wait_ms(1);
 | 
			
		||||
            thread_sleep_for(1);
 | 
			
		||||
            timedout--;
 | 
			
		||||
        } while(timedout && (SMSC9220->MAC_CSR_CMD & ((unsigned int)1 << 31)));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ unsigned int smsc9220_phy_regread(unsigned char regoffset, unsigned short *data)
 | 
			
		|||
        val = 0;
 | 
			
		||||
        timedout = 50;
 | 
			
		||||
        do {
 | 
			
		||||
            wait_ms(1);
 | 
			
		||||
            thread_sleep_for(1);
 | 
			
		||||
            timedout--;
 | 
			
		||||
            smsc9220_mac_regread(SMSC9220_MAC_MII_ACC,&val);
 | 
			
		||||
        } while(timedout && (val & ((unsigned int)1 << 0)));
 | 
			
		||||
| 
						 | 
				
			
			@ -165,7 +165,7 @@ unsigned int smsc9220_phy_regwrite(unsigned char regoffset, unsigned short data)
 | 
			
		|||
 | 
			
		||||
        do {
 | 
			
		||||
 | 
			
		||||
            wait_ms(1);
 | 
			
		||||
            thread_sleep_for(1);
 | 
			
		||||
            timedout--;
 | 
			
		||||
            smsc9220_mac_regread(SMSC9220_MAC_MII_ACC, &phycmd);
 | 
			
		||||
        } while(timedout && (phycmd & (1 << 0)));
 | 
			
		||||
| 
						 | 
				
			
			@ -196,7 +196,7 @@ unsigned int smsc9220_soft_reset(void)
 | 
			
		|||
    SMSC9220->HW_CFG |= 1;
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        wait_ms(1);
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        timedout--;
 | 
			
		||||
    } while(timedout && (SMSC9220->HW_CFG & 1));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +223,7 @@ unsigned int smsc9220_wait_eeprom(void)
 | 
			
		|||
    timedout = 50;
 | 
			
		||||
 | 
			
		||||
    do {
 | 
			
		||||
        wait_ms(1);
 | 
			
		||||
        thread_sleep_for(1);
 | 
			
		||||
        timedout--;
 | 
			
		||||
 | 
			
		||||
    } while(timedout && (SMSC9220->E2P_CMD & ((unsigned int) 1 << 31)));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -411,7 +411,7 @@ void USBPhyHw::init(USBPhyEvents *events)
 | 
			
		|||
    LPC_PINCON->PINSEL4 |= 0x00040000;
 | 
			
		||||
 | 
			
		||||
    // Connect must be low for at least 2.5uS
 | 
			
		||||
    wait(0.3);
 | 
			
		||||
    ThisThread::sleep_for(300);
 | 
			
		||||
 | 
			
		||||
    // Disable control endpoints
 | 
			
		||||
    SIEsetEndpointStatus(EP0IN, SIE_SES_DA);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -47,7 +47,7 @@ extern "C" void trng_init_esp32(void)
 | 
			
		|||
        GPIOPM3  &= ~0x4000;         /* Output mode */
 | 
			
		||||
 | 
			
		||||
        GPIOP3   |=  0x4000;         /* Outputs hi level */
 | 
			
		||||
        wait_ms(5);
 | 
			
		||||
        ThisThread::sleep_for(5);
 | 
			
		||||
        GPIOP5   |=  0x0008;         /* Outputs hi level */
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -84,7 +84,7 @@ extern "C" int trng_get_bytes_esp32(uint8_t *output, size_t length, size_t *outp
 | 
			
		|||
        }
 | 
			
		||||
        if (ret != 0) {
 | 
			
		||||
            retry_cnt++;
 | 
			
		||||
            wait_ms(100);
 | 
			
		||||
            ThisThread::sleep_for(100);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (retry_cnt >= RETRY_CNT_MAX) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ nsapi_error_t ONBOARD_TELIT_HE910::soft_power_on()
 | 
			
		|||
    /* keep the power line low for 200 milisecond */
 | 
			
		||||
    press_power_button(200);
 | 
			
		||||
    /* give modem a little time to respond */
 | 
			
		||||
    wait_ms(100);
 | 
			
		||||
    ThisThread::sleep_for(100);
 | 
			
		||||
    // From Telit_xE910 Global form factor App note: It is mandatory to avoid sending data to the serial ports during the first 200ms of the module start-up.
 | 
			
		||||
    rtos::ThisThread::sleep_for(200);
 | 
			
		||||
    return NSAPI_ERROR_OK;
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ nsapi_error_t ONBOARD_TELIT_HE910::soft_power_off()
 | 
			
		|||
     * 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);
 | 
			
		||||
    ThisThread::sleep_for(10 * 1000);
 | 
			
		||||
    return NSAPI_ERROR_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ void ONBOARD_TELIT_HE910::press_power_button(int time_ms)
 | 
			
		|||
 | 
			
		||||
    gpio_init_out_ex(&gpio, MDMPWRON, 1);
 | 
			
		||||
    gpio_write(&gpio, 0);
 | 
			
		||||
    wait_ms(time_ms);
 | 
			
		||||
    ThisThread::sleep_for(time_ms);
 | 
			
		||||
    gpio_write(&gpio, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue