예제 #1
0
파일: main.c 프로젝트: chinnygan/ES
void Main_task(uint_32 initial_data)
{
	int buttons[] = {HMI_BUTTON_1, HMI_BUTTON_2, HMI_BUTTON_3, HMI_BUTTON_4};
	int leds[] = {HMI_LED_1, HMI_LED_2, HMI_LED_3, HMI_LED_4};
	int i;

	hmi_client = _bsp_btnled_init();
	rtcs_init();

	_io_tfs_install("tfs:", static_data);
	
	http_server = httpd_server_init_af(http_root_dir, "\\index.html", AF_INET);
	httpd_server_run(http_server);

	
	while(1) ipcfg_task_poll();

}
예제 #2
0
파일: hmi.c 프로젝트: jewlenchow/MQX_3.8.1
void Main_task(uint_32 initial_data)
{   
    printf("HMI demo application. \nPress buttons and electrodes available on the board.\n");
    printf("Set TWRPI module with module command.\n");
    
    bsp_btnled_driver_handle = _bsp_btnled_init(); /* BTNLED initialization */ 
    if (bsp_btnled_driver_handle == NULL)  
    {
        /* error in initialization */
        printf("BTNLED initialization failed. \n");
        _task_block();
    }
    /* set LED ON */
    btnled_set_value(bsp_btnled_driver_handle, HMI_LED_1, HMI_VALUE_ON);
    btnled_set_value(bsp_btnled_driver_handle, HMI_LED_2, HMI_VALUE_ON);

    /* add callbacks for PUSH/RELEASE/ROTARY MOVEMENT */
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_1, HMI_VALUE_PUSH, callback_toggle_led, "button 1");
    /* same button, same action(push), different callback */
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_1, HMI_VALUE_PUSH, callback_print_push, "button 1");   
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_2, HMI_VALUE_PUSH, callback_toggle_led, "button 2");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_3, HMI_VALUE_PUSH, callback_toggle_led, "button 3");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_3, HMI_VALUE_RELEASE, callback_print_release, "button 3");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_4, HMI_VALUE_PUSH, callback_print_push, "button 4");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_5, HMI_VALUE_PUSH, callback_print_push, "button 5");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_6, HMI_VALUE_PUSH, callback_print_push, "button 6");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_7, HMI_VALUE_PUSH, callback_print_push, "button 7");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_8, HMI_VALUE_PUSH, callback_print_push, "button 8");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_9, HMI_VALUE_RELEASE, callback_print_release, "button 9");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_10, HMI_VALUE_PUSH, callback_print_push, "button 10");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_11, HMI_VALUE_PUSH, callback_print_push, "button 11");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_BUTTON_12, HMI_VALUE_PUSH, callback_print_push, "button 12");
    btnled_add_clb(bsp_btnled_driver_handle, HMI_ROTARY_1, HMI_VALUE_MOVEMENT, callback_rotary_movement, "rotary");
    
    while (1)
    {
        btnled_poll(bsp_btnled_driver_handle); /* polls TSS and LWGPIO buttons */
        _time_delay(5);                 /* time for shell */
    }
}