void handle_sysevt(VMINT message, VMINT param) { switch (message) { case VM_EVENT_CREATE: /* delay for catch logs */ vm_thread_sleep(8000); vm_log_info("Sample of FS list file - Start."); fs_demo_find_files(); break; case VM_EVENT_QUIT: vm_log_info("Sample of FS list file - End."); break; } }
static VMBOOL wait_result(hx711_task* task) { vm_dcl_gpio_control_level_status_t pin_status; int timeout_counter = 8; vm_dcl_control(task->scl_handle, VM_DCL_GPIO_COMMAND_WRITE_LOW, NULL); vm_dcl_control(task->sda_handle, VM_DCL_GPIO_COMMAND_READ, &pin_status); while (timeout_counter > 0 && pin_status.level_status == VM_DCL_GPIO_IO_HIGH) { vm_thread_sleep(100); vm_dcl_control(task->sda_handle, VM_DCL_GPIO_COMMAND_READ, &pin_status); timeout_counter--; } if (pin_status.level_status == VM_DCL_GPIO_IO_LOW) { return TRUE; } else { return FALSE; } }
static int msleep_c(lua_State* L) { long ms = lua_tointeger(L, -1); vm_thread_sleep(ms); return 0; }
void delay( uint32_t ms ) { vm_thread_sleep(ms); }
static void enter_standby(hx711_task* task) { vm_dcl_control(task->scl_handle, VM_DCL_GPIO_COMMAND_WRITE_HIGH, NULL); vm_thread_sleep(task->delay+1); }