/***************************************************************************** * FUNCTION * vm_main * DESCRIPTION * This function is main function which is invoked in start up * ie entry function. * PARAMETERS * none * RETURNS * none *****************************************************************************/ void vm_main(void) { VMINT drv; /* Define logging */ #ifdef MRE_LOG_ON /* if loging is on */ VMCHAR log_file[MRE_STR_SIZE_MAX] = {0}; /* finding drive for saving log information in "sample1.log" file name */ if ((drv = vm_get_removable_driver()) < 0) { /* if no removable drive then get system drive*/ drv = mre_get_drv(); } sprintf(log_file, "%c:\\mre.log", drv); vm_log_init(log_file, VM_DEBUG_LEVEL); #endif //Setting the workable drive here at once (May reduce checks in the future // by storing it to a global variable . May change as removable media exists) mre_set_drv(); vm_log_debug ("vm_main function starts"); /*Initialising the layer handle*/ layer_hdl[0] = -1; /*Setting Global data for Graphics*/ mre_set_global_data(); /* Set lang */ vm_mul_lang_set_lang (VM_LANG_ENG); /* Event Mapping: The reason why below we have two seperate events is cause once we attach an event handler, we can not change it. I could mix them both into one event handler but we already tested the API's. Now its time to test nuklear and make the application, its views around this. */ ///* // For Nuklear Testing: vm_reg_sysevt_callback (nk_mre_handle_sys_event); //looks at implementation event handler (does thesame thing) vm_reg_keyboard_callback (nk_mre_handle_key_event); //Keyboard callback vm_reg_pen_callback (handle_penevt); //Pen callback - not really needed //initiate_nuklear_gui(); //Disabling, the method: nk_mre_handle_sys_event will call it. //*/ /* //For API Testing: vm_mul_lang_set_lang (VM_LANG_ENG); vm_reg_sysevt_callback (handle_sysevt); vm_reg_keyboard_callback (handle_keyevt); vm_reg_pen_callback (handle_penevt); */ }
/* * \brief Main entry point of Arduino application */ void vm_main( void ) { VM_THREAD_HANDLE handle; spi_w_data = (unsigned char*)vm_malloc_nc(2); spi_r_data = (unsigned char*)vm_malloc_nc(2); srand(0); rand(); spi_data_memory = (unsigned char*)vm_malloc_nc(64*1024); memset(spi_data_memory,0, 64*1024); vm_reg_sysevt_callback(__handle_sysevt); vm_call_reg_listener(__call_listener_func); handle = vm_thread_create(__arduino_thread, NULL, 0); vm_thread_change_priority(handle, 245); }
void vaf_core_init(int enable_log, int enable_mem) { vm_reg_sysevt_callback(vaf_handle_sysevt); vm_reg_keyboard_callback(vaf_handle_keyevt); vm_reg_pen_callback(vaf_handle_penevt); vaf_app_entry = NULL; vaf_app_unload = NULL; vaf_usr_handle_sysevt = NULL; vaf_usr_handle_keyevt = NULL; vaf_usr_handle_penevt = NULL; WindowsMgr::Init(enable_mem); UiTimer::Init(); vaf_winmgr_init(); vaf_font_init(); vaf_debug_init(enable_log); }