예제 #1
0
파일: console.c 프로젝트: wuwx/simba
int console_start(void)
{
    usb_device_start(&module.console.usb);

#if CONFIG_START_CONSOLE_USB_CDC_WAIT_FOR_CONNETION == 1

    /* Wait for the host to connect. */
    while (usb_device_class_cdc_is_connected(&module.console.cdc) == 0) {
        thrd_sleep_us(100000);
    }

    thrd_sleep_us(100000);

#endif

    return (0);
}
예제 #2
0
파일: main.c 프로젝트: wuwx/simba
int test_sleep(struct harness_t *harness_p)
{
    BTASSERT(thrd_sleep(0.001) == 0);
    BTASSERT(thrd_sleep_ms(1) == 0);
    BTASSERT(thrd_sleep_us(1000) == 0);

    return (0);
}
예제 #3
0
파일: main.c 프로젝트: eerimoq/simba
static int test_get_set(struct harness_t *harness)
{
    struct time_t time1;
    struct time_t time2;

    /* Start by getting the current time. */
    BTASSERT(time_get(&time1) == 0);

    std_printf(FSTR("time1: seconds = %lu, nanoseconds = %lu\r\n"),
               time1.seconds, time1.nanoseconds);

    /* Wait a while and verify that the time has changed. */
    thrd_sleep_us(100000);
    BTASSERT(time_get(&time2) == 0);

    std_printf(FSTR("time2: seconds = %lu, nanoseconds = %lu\r\n"),
               time2.seconds, time2.nanoseconds);

    BTASSERT((time2.seconds > time1.seconds)
             || (time2.nanoseconds > time1.nanoseconds));

    /* Set the time to a high value. */
    time1.seconds = 100;
    time1.nanoseconds = 350000000;
    BTASSERT(time_set(&time1) == 0);

    /* Get the new time. */
    BTASSERT(time_get(&time1) == 0);

    std_printf(FSTR("time1: seconds = %lu, nanoseconds = %lu\r\n"),
               time1.seconds, time1.nanoseconds);

    /* Wait a while and verify that the time has changed. */
    thrd_sleep_us(100000);
    BTASSERT(time_get(&time2) == 0);

    std_printf(FSTR("time2: seconds = %lu, nanoseconds = %lu\r\n"),
               time2.seconds, time2.nanoseconds);

    BTASSERT((time2.seconds > time1.seconds)
             || (time2.nanoseconds > time1.nanoseconds));

    return (0);
}
예제 #4
0
파일: main.c 프로젝트: RitterRBC/Arduino
int main()
{
    struct pin_driver_t led;

    /* Start the system. */
    sys_start();

    /* Initialize the LED pin as output and set its value to 1. */
    pin_init(&led, &pin_led_dev, PIN_OUTPUT);
    pin_write(&led, 1);

    while (1) {
        /* Wait half a second. */
        thrd_sleep_us(500000);

        /* Toggle the LED on/off. */
        pin_toggle(&led);
    }

    return (0);
}