diff --git a/hal b/hal deleted file mode 160000 index 86bad91ff..000000000 --- a/hal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 86bad91fff25a09fc66ccda5d5eb90aeaadf26bb diff --git a/lv_app/lv_app.c b/lv_app/lv_app.c index 6b062faaa..12f6e985c 100644 --- a/lv_app/lv_app.c +++ b/lv_app/lv_app.c @@ -36,15 +36,15 @@ static void lv_app_init_desktop(void); /*Actions*/ #if LV_APP_DESKTOP != 0 -static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * dispi); -static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_dispi_t * dispi); -static lv_action_res_t lv_app_sc_page_rel_action(lv_obj_t * sc, lv_dispi_t * dispi); +static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t lv_app_sc_page_rel_action(lv_obj_t * sc, lv_indev_proc_t * indev_proc); #endif -static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi); -static lv_action_res_t lv_app_sc_lpr_action(lv_obj_t * sc, lv_dispi_t * dispi); -static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t * dispi); -static lv_action_res_t lv_app_win_minim_action(lv_obj_t * minim_btn, lv_dispi_t * dispi); -static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * dispi); +static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_indev_proc_t * indev_proc); +static lv_action_res_t lv_app_sc_lpr_action(lv_obj_t * sc, lv_indev_proc_t * indev_proc); +static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t lv_app_win_minim_action(lv_obj_t * minim_btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_indev_proc_t * indev_proc); static lv_action_res_t lv_app_win_open_anim_create(lv_app_inst_t * app); static lv_action_res_t lv_app_win_minim_anim_create(lv_app_inst_t * app); @@ -569,10 +569,10 @@ static void lv_app_init_desktop(void) /** * Called when the "Apps" button is released to open or close the app. list * @param app_btn pointer to the "Apps" button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the "Apps" button is never deleted */ -static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * dispi) +static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_indev_proc_t * indev_proc) { /*Close the list if opened*/ if(app_list != NULL) { @@ -603,10 +603,10 @@ static lv_action_res_t lv_app_menu_rel_action(lv_obj_t * app_btn, lv_dispi_t * d /** * Called when an element of the app list is released * @param app_elem_btn pointer to an element of app list - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is dleted on release */ -static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_dispi_t * dispi) +static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_indev_proc_t * indev_proc) { lv_app_dsc_t * dsc = lv_obj_get_free_p(app_elem_btn); @@ -630,10 +630,10 @@ static lv_action_res_t lv_app_menu_elem_rel_action(lv_obj_t * app_elem_btn, lv_d * Called when the shortcut page is released to hide the app list and/or * go back from connection mode * @param page pointer to the sc page - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the sc page is not deleted */ -static lv_action_res_t lv_app_sc_page_rel_action(lv_obj_t * page, lv_dispi_t * dispi) +static lv_action_res_t lv_app_sc_page_rel_action(lv_obj_t * page, lv_indev_proc_t * indev_proc) { /*Close the list if opened*/ if(app_list != NULL) { @@ -657,10 +657,10 @@ static lv_action_res_t lv_app_sc_page_rel_action(lv_obj_t * page, lv_dispi_t * d * Called when a shortcut is released to open its window (or close app list if opened) (in normal mode) or * add/remove it to/form a connection (in connection mode) * @param sc pointer to the releases shortcut object - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the sc page is not deleted */ -static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi) +static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_indev_proc_t * indev_proc) { /*Normal mode*/ if(con_send == NULL) { @@ -707,10 +707,10 @@ static lv_action_res_t lv_app_sc_rel_action(lv_obj_t * sc, lv_dispi_t * dispi) /** * Called when a shortcut id long pressed to toggle normal and connection mode * @param sc pointer to the long presse shortcut - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the shortcut is not deleted */ -static lv_action_res_t lv_app_sc_lpr_action(lv_obj_t * sc, lv_dispi_t * dispi) +static lv_action_res_t lv_app_sc_lpr_action(lv_obj_t * sc, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app_send = lv_obj_get_free_p(sc); @@ -748,10 +748,10 @@ static lv_action_res_t lv_app_sc_lpr_action(lv_obj_t * sc, lv_dispi_t * dispi) /** * Called when the close button of window is released * @param close_btn pointer to the close button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK or LV_ACTION_RES_INC depending on LV_APP_EFFECT_... settings type */ -static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t * dispi) +static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_indev_proc_t * indev_proc) { lv_obj_t * win = lv_win_get_from_cbtn(close_btn); lv_app_inst_t * app = lv_obj_get_free_p(win); @@ -783,10 +783,10 @@ static lv_action_res_t lv_app_win_close_action(lv_obj_t * close_btn, lv_dispi_t /** * Called when the minimization button of window is released * @param minim_btn pointer to the minim. button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK or LV_ACTION_RES_INC depending on LV_APP_EFFECT_... settings type */ -static lv_action_res_t lv_app_win_minim_action(lv_obj_t * minim_btn, lv_dispi_t * dispi) +static lv_action_res_t lv_app_win_minim_action(lv_obj_t * minim_btn, lv_indev_proc_t * indev_proc) { lv_obj_t * win = lv_win_get_from_cbtn(minim_btn); lv_app_inst_t * app = lv_obj_get_free_p(win); @@ -803,10 +803,10 @@ static lv_action_res_t lv_app_win_minim_action(lv_obj_t * minim_btn, lv_dispi_t /** * Open the settings of an application in a window (use the set_open function of the application) * @param set_btn pointer to the settings button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return always LV_ACTION_RES_OK because the button is not deleted here */ -static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_dispi_t * dispi) +static lv_action_res_t lv_app_win_conf_action(lv_obj_t * set_btn, lv_indev_proc_t * indev_proc) { /*Close the app list if opened*/ if(app_list != NULL) { diff --git a/lv_app/lv_app_util/lv_app_fsel.c b/lv_app/lv_app_util/lv_app_fsel.c index e3e377072..04df807c6 100644 --- a/lv_app/lv_app_util/lv_app_fsel.c +++ b/lv_app/lv_app_util/lv_app_fsel.c @@ -24,15 +24,15 @@ * STATIC PROTOTYPES **********************/ static void fsel_refr(void); -static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi); -static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi); -static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi); -static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi); -static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi); -static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi); -static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi); -static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi); -static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi); +static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_indev_proc_t * indev_proc); +static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_indev_proc_t * indev_proc); /********************** * STATIC VARIABLES @@ -238,10 +238,10 @@ static void fsel_refr(void) /** * Called when the File selector window close button is released * @param close pointer to the close button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the window is deleted in the function */ -static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi) +static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_indev_proc_t * indev_proc) { lv_app_fsel_close(); return LV_ACTION_RES_INV; @@ -250,10 +250,10 @@ static lv_action_res_t fsel_close_action(lv_obj_t * close, lv_dispi_t * dispi) /** * Called when the Up list element is released to step one level * @param up pointer to the Up button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi) +static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_indev_proc_t * indev_proc) { fs_up(fsel_path); fsel_file_cnt = 0; @@ -264,10 +264,10 @@ static lv_action_res_t fsel_up_action(lv_obj_t * up, lv_dispi_t * dispi) /** * Called when the Next list element is released to go to the next page * @param next pointer to the Next button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi) +static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_indev_proc_t * indev_proc) { fsel_refr(); return LV_ACTION_RES_INV; @@ -276,10 +276,10 @@ static lv_action_res_t fsel_next_action(lv_obj_t * next, lv_dispi_t * dispi) /** * Called when the Prev list element is released to previous page * @param prev pointer to the Prev button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) +static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_indev_proc_t * indev_proc) { if(fsel_file_cnt <= 2 * LV_APP_FSEL_PAGE_SIZE) fsel_file_cnt = 0; else if(fsel_file_cnt % LV_APP_FSEL_PAGE_SIZE == 0) { @@ -296,10 +296,10 @@ static lv_action_res_t fsel_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) /** * Called when the Driver list element is released to step into a driver * @param drv pointer to the Driver button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) +static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_indev_proc_t * indev_proc) { sprintf(fsel_path, "%s:", lv_list_get_element_text(drv)); fsel_file_cnt = 0; @@ -310,10 +310,10 @@ static lv_action_res_t fsel_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) /** * Called when the Driver list element is long pressed to choose it * @param drv pointer to the Driver button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi) +static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_indev_proc_t * indev_proc) { sprintf(fsel_path, "%s:", lv_list_get_element_text(drv)); @@ -329,10 +329,10 @@ static lv_action_res_t fsel_drv_lpr_action(lv_obj_t * drv, lv_dispi_t * dispi) /** * Called when a folder list element is released to enter into it * @param folder pointer to a folder button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) +static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_indev_proc_t * indev_proc) { sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(folder)); fsel_file_cnt = 0; @@ -343,10 +343,10 @@ static lv_action_res_t fsel_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) /** * Called when a folder list element is long pressed to choose it * @param folder pointer to a folder button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * dispi) +static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_indev_proc_t * indev_proc) { sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(folder)); @@ -362,10 +362,10 @@ static lv_action_res_t fsel_folder_lpr_action(lv_obj_t * folder, lv_dispi_t * di /** * Called when a file list element is released to choose it * @param file pointer to a file button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_dispi_t * dispi) +static lv_action_res_t fsel_file_action(lv_obj_t * file, lv_indev_proc_t * indev_proc) { sprintf(fsel_path, "%s/%s", fsel_path, lv_list_get_element_text(file)); diff --git a/lv_appx/lv_app_benchmark.c b/lv_appx/lv_app_benchmark.c index 6873fa949..8a58e506b 100644 --- a/lv_appx/lv_app_benchmark.c +++ b/lv_appx/lv_app_benchmark.c @@ -67,12 +67,12 @@ static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); static void my_win_close(lv_app_inst_t * app); static void refr_monitor(uint32_t time_ms, uint32_t px_num); -static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t opa_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t opa_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); /********************** * STATIC VARIABLES **********************/ @@ -406,7 +406,7 @@ static void refr_monitor(uint32_t time_ms, uint32_t px_num) } } -static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_obj_inv(lv_scr_act()); caputre_next = true; @@ -414,7 +414,7 @@ static lv_action_res_t run_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); @@ -432,7 +432,7 @@ static lv_action_res_t wp_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_win_data_t * wdata = app->win_data; @@ -451,7 +451,7 @@ static lv_action_res_t recolor_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_win_data_t * wdata = app->win_data; @@ -470,7 +470,7 @@ static lv_action_res_t upscale_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_win_data_t * wdata = app->win_data; @@ -501,7 +501,7 @@ static lv_action_res_t shadow_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t opa_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t opa_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_win_data_t * wdata = app->win_data; diff --git a/lv_appx/lv_app_example.c b/lv_appx/lv_app_example.c index fb2a202dd..b96c8fb73 100644 --- a/lv_appx/lv_app_example.c +++ b/lv_appx/lv_app_example.c @@ -49,7 +49,7 @@ static void my_sc_close(lv_app_inst_t * app); static void my_win_open(lv_app_inst_t * app, lv_obj_t * win); static void my_win_close(lv_app_inst_t * app); -static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi); +static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_indev_proc_t * indev_proc); static void kb_ok_action(lv_obj_t * ta); /********************** @@ -192,10 +192,10 @@ static void my_win_close(lv_app_inst_t * app) /** * Called when the text area on the window is released to open the app. keyboard * @param ta pointer to the text area on the window - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the text area is not deleted */ -static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi) +static lv_action_res_t ta_rel_action(lv_obj_t * ta, lv_indev_proc_t * indev_proc) { lv_ta_set_text(ta, ""); /*Clear the ta*/ lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE, NULL, kb_ok_action); diff --git a/lv_appx/lv_app_files.c b/lv_appx/lv_app_files.c index 6645e9abb..a675e1359 100644 --- a/lv_appx/lv_app_files.c +++ b/lv_appx/lv_app_files.c @@ -76,17 +76,17 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win); static void win_load_file_list(lv_app_inst_t * app); static void win_create_list(lv_app_inst_t * app); -static lv_action_res_t win_up_action(lv_obj_t * up, lv_dispi_t * dispi); -static lv_action_res_t win_next_action(lv_obj_t * next, lv_dispi_t * dispi); -static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_dispi_t * dispi); -static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi); -static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi); -static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi); -static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi); -static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_dispi_t * dispi); -static lv_action_res_t win_back_action(lv_obj_t * back, lv_dispi_t * dispi); -static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_dispi_t * dispi); -static lv_action_res_t win_del_lpr_action(lv_obj_t * del, lv_dispi_t * dispi); +static lv_action_res_t win_up_action(lv_obj_t * up, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_next_action(lv_obj_t * next, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_file_action(lv_obj_t * file, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_back_action(lv_obj_t * back, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_del_lpr_action(lv_obj_t * del, lv_indev_proc_t * indev_proc); static void send_settings_kb_close_action(lv_obj_t * ta); static void send_settings_kb_ok_action(lv_obj_t * ta); static void start_send(lv_app_inst_t * app, const char * path); @@ -463,10 +463,10 @@ static void win_load_file_list(lv_app_inst_t * app) /** * Called when the Up list element is released to step one level * @param up pointer to the Up button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_up_action(lv_obj_t * up, lv_dispi_t * dispi) +static lv_action_res_t win_up_action(lv_obj_t * up, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(up); my_app_data_t * app_data = app->app_data; @@ -487,10 +487,10 @@ static lv_action_res_t win_up_action(lv_obj_t * up, lv_dispi_t * dispi) /** * Called when the Next list element is released to go to the next page * @param next pointer to the Next button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_next_action(lv_obj_t * next, lv_dispi_t * dispi) +static lv_action_res_t win_next_action(lv_obj_t * next, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(next); win_load_file_list(app); @@ -500,10 +500,10 @@ static lv_action_res_t win_next_action(lv_obj_t * next, lv_dispi_t * dispi) /** * Called when the Prev list element is released to previous page * @param prev pointer to the Prev button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) +static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(prev); my_app_data_t * app_data = app->app_data; @@ -522,10 +522,10 @@ static lv_action_res_t win_prev_action(lv_obj_t * prev, lv_dispi_t * dispi) /** * Called when the Driver list element is released to step into a driver * @param drv pointer to the Driver button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) +static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(drv); my_app_data_t * app_data = app->app_data; @@ -546,10 +546,10 @@ static lv_action_res_t win_drv_action(lv_obj_t * drv, lv_dispi_t * dispi) /** * Called when a folder list element is released to enter into it * @param folder pointer to a folder button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) +static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(folder); my_app_data_t * app_data = app->app_data; @@ -572,10 +572,10 @@ static lv_action_res_t win_folder_action(lv_obj_t * folder, lv_dispi_t * dispi) /** * Called when a file list element is released to show the list of operation on it * @param file pointer to a file button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi) +static lv_action_res_t win_file_action(lv_obj_t * file, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(file); my_app_data_t * app_data = app->app_data; @@ -606,10 +606,10 @@ static lv_action_res_t win_file_action(lv_obj_t * file, lv_dispi_t * dispi) * Called when the Back list element is released to when a file chosen to * go back to the file list from file operation * @param back pointer to the back button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_INV because the list is deleted in the function */ -static lv_action_res_t win_back_action(lv_obj_t * up, lv_dispi_t * dispi) +static lv_action_res_t win_back_action(lv_obj_t * up, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(up); my_app_data_t * app_data = app->app_data; @@ -622,10 +622,10 @@ static lv_action_res_t win_back_action(lv_obj_t * up, lv_dispi_t * dispi) /** * Called when the Send list element is released to send the file * @param sed pointer to the Up button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the list is NOT deleted in the function */ -static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi) +static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(send); my_app_data_t * app_data = app->app_data; @@ -645,10 +645,10 @@ static lv_action_res_t win_send_rel_action(lv_obj_t * send, lv_dispi_t * dispi) /** * Called when a send settings element is released * @param element pointer to a chekbox or text area - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the list is NOT deleted in the function */ -static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_dispi_t * dispi) +static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, lv_indev_proc_t * indev_proc) { send_settings_id_t id = lv_obj_get_free_num(element); lv_app_inst_t * app = lv_obj_get_free_p(element); @@ -679,10 +679,10 @@ static lv_action_res_t win_send_settings_element_rel_action(lv_obj_t * element, * Called when the Delete list element is released. * It will show a notification to long press the Delete button to remove the file * @param del pointer to the back button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the list is NOT deleted in the function */ -static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_dispi_t * dispi) +static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_indev_proc_t * indev_proc) { lv_app_notice_add("Press long the Delete button\n" "to remove the file"); @@ -692,10 +692,10 @@ static lv_action_res_t win_del_rel_action(lv_obj_t * del, lv_dispi_t * dispi) /** * Called when the Delete list element is long pressed to remove a file * @param del pointer to the Delete button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the list is NOT deleted in the function */ -static lv_action_res_t win_del_lpr_action(lv_obj_t * del, lv_dispi_t * dispi) +static lv_action_res_t win_del_lpr_action(lv_obj_t * del, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(del); my_app_data_t * app_data = app->app_data; diff --git a/lv_appx/lv_app_gsm.c b/lv_appx/lv_app_gsm.c index a60f7b8cd..a0f3cabb0 100644 --- a/lv_appx/lv_app_gsm.c +++ b/lv_appx/lv_app_gsm.c @@ -63,10 +63,10 @@ static void my_win_close(lv_app_inst_t * app); static void gsm_state_monitor_task(void * param); -static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t netw_apn_rel_action( lv_obj_t * ta, lv_dispi_t * dispi); -static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_dispi_t * dispi); -static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_dispi_t * dispi); +static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t netw_apn_rel_action( lv_obj_t * ta, lv_indev_proc_t * indev_proc); +static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_indev_proc_t * indev_proc); +static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_indev_proc_t * indev_proc); static void netw_apn_kb_ok(lv_obj_t * ta); static void netw_apn_kb_close(lv_obj_t * ta); @@ -339,7 +339,7 @@ static void gsm_state_monitor_task(void * param) state_prev = state_act; } -static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_dispi_t* dispi) +static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_indev_proc_t* indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_app_data_t * adata = app->app_data; @@ -353,19 +353,19 @@ static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_dispi_t* dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t netw_apn_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t netw_apn_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, netw_apn_kb_close ,netw_apn_kb_ok); return LV_ACTION_RES_OK; } -static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, tcp_ip_kb_close ,tcp_ip_kb_ok); return LV_ACTION_RES_OK; } -static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_NUM | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, tcp_port_kb_close ,tcp_port_kb_ok); return LV_ACTION_RES_OK; diff --git a/lv_appx/lv_app_terminal.c b/lv_appx/lv_app_terminal.c index 228feccfd..80178acae 100644 --- a/lv_appx/lv_app_terminal.c +++ b/lv_appx/lv_app_terminal.c @@ -7,8 +7,8 @@ * INCLUDES *********************/ +#include #include "lv_conf.h" -#include "../lv_obj/lv_dispi.h" #include "../lv_obj/lv_obj.h" #include "../lv_objx/lv_btn.h" #include "../lv_objx/lv_cont.h" @@ -73,10 +73,10 @@ static void my_win_close(lv_app_inst_t * app); static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win); static void add_data(lv_app_inst_t * app, const void * data, uint16_t data_len); -static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi); -static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi); -static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi); -static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc); +static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); static void win_ta_kb_ok_action(lv_obj_t * ta); /********************** @@ -329,10 +329,10 @@ static void my_conf_open(lv_app_inst_t * app, lv_obj_t * conf_win) /** * Called when the Text area is released to open the app. keybard * @param ta pointer to the text area - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the text area is not deleted */ -static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi) +static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_indev_proc_t * indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE, NULL, win_ta_kb_ok_action); @@ -342,10 +342,10 @@ static lv_action_res_t win_ta_rel_action(lv_obj_t * ta, lv_dispi_t * dispi) /** * Called when an option is chosen in the communication type drop down list on the configuration window * @param ddl pointer to the drop down list - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the list is not deleted */ -static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi) +static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(ddlist); my_app_data_t * app_data = app->app_data; @@ -358,10 +358,10 @@ static lv_action_res_t win_comtype_action(lv_obj_t * ddlist, lv_dispi_t * dispi) /** * Called when an option is chosen in the format drop down list on the configuration window * @param ddl pointer to the drop down list - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the list is not deleted */ -static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi) +static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(ddlist); my_app_data_t * app_data = app->app_data; @@ -379,10 +379,10 @@ static lv_action_res_t win_format_action(lv_obj_t * ddlist, lv_dispi_t * dispi) /** * Called when the Clear button is released to clear the text of the terminal * @param btn pointer to the clear button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK because the button is not deleted */ -static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t win_clear_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_app_data_t * app_data = app->app_data; diff --git a/lv_appx/lv_app_wifi.c b/lv_appx/lv_app_wifi.c index 497c7139b..9b1a1fcfa 100644 --- a/lv_appx/lv_app_wifi.c +++ b/lv_appx/lv_app_wifi.c @@ -68,13 +68,13 @@ static void my_win_close(lv_app_inst_t * app); static void wifi_state_monitor_task(void * param); -static lv_action_res_t netw_list_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_dispi_t* dispi); -static lv_action_res_t netw_ssid_rel_action( lv_obj_t * ta, lv_dispi_t* dispi); -static lv_action_res_t netw_pwd_rel_action( lv_obj_t * ta, lv_dispi_t* dispi); -static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_dispi_t* dispi); -static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_dispi_t* dispi); -static lv_action_res_t wifi_ap_select_action( lv_obj_t * ddlist, lv_dispi_t* dispi); +static lv_action_res_t netw_list_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_indev_proc_t* indev_proc); +static lv_action_res_t netw_ssid_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc); +static lv_action_res_t netw_pwd_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc); +static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc); +static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc); +static lv_action_res_t wifi_ap_select_action( lv_obj_t * ddlist, lv_indev_proc_t* indev_proc); static void netw_ssid_kb_ok(lv_obj_t * ta); static void netw_ssid_kb_close(lv_obj_t * ta); @@ -377,7 +377,7 @@ static void wifi_state_monitor_task(void * param) state_prev = state_act; } -static lv_action_res_t netw_list_rel_action(lv_obj_t * btn, lv_dispi_t* dispi) +static lv_action_res_t netw_list_rel_action(lv_obj_t * btn, lv_indev_proc_t* indev_proc) { wifi_state_t ret; ret = wifi_netw_list(list_cb); @@ -391,7 +391,7 @@ static lv_action_res_t netw_list_rel_action(lv_obj_t * btn, lv_dispi_t* dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_dispi_t* dispi) +static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_indev_proc_t* indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(btn); my_app_data_t * adata = app->app_data; @@ -405,31 +405,31 @@ static lv_action_res_t netw_con_rel_action(lv_obj_t * btn, lv_dispi_t* dispi) return LV_ACTION_RES_OK; } -static lv_action_res_t netw_ssid_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t netw_ssid_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, netw_ssid_kb_close ,netw_ssid_kb_ok); return LV_ACTION_RES_OK; } -static lv_action_res_t netw_pwd_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t netw_pwd_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, netw_pwd_kb_close ,netw_pwd_kb_ok); return LV_ACTION_RES_OK; } -static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t tcp_ip_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_TXT | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, tcp_ip_kb_close ,tcp_ip_kb_ok); return LV_ACTION_RES_OK; } -static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_dispi_t* dispi) +static lv_action_res_t tcp_port_rel_action( lv_obj_t * ta, lv_indev_proc_t* indev_proc) { lv_app_kb_open(ta, LV_APP_KB_MODE_NUM | LV_APP_KB_MODE_WIN_RESIZE | LV_APP_KB_MODE_CUR_MANAGE, tcp_port_kb_close ,tcp_port_kb_ok); return LV_ACTION_RES_OK; } -static lv_action_res_t wifi_ap_select_action( lv_obj_t * ddlist, lv_dispi_t* dispi) +static lv_action_res_t wifi_ap_select_action( lv_obj_t * ddlist, lv_indev_proc_t* indev_proc) { lv_app_inst_t * app = lv_obj_get_free_p(ddlist); my_app_data_t * adata = app->app_data; diff --git a/lv_conf_templ.h b/lv_conf_templ.h index a3e074cb6..d01d4458d 100644 --- a/lv_conf_templ.h +++ b/lv_conf_templ.h @@ -38,12 +38,12 @@ Misc. setting *=================*/ /*Display Input settings*/ -#define LV_DISPI_READ_PERIOD 50 /*Input device read period milliseconds*/ -#define LV_DISPI_TP_MARKER 0 /*Mark the pressed points (Value means marker point size)*/ -#define LV_DISPI_DRAG_LIMIT (10 * LV_DOWNSCALE) /*Drag threshold in pixels */ -#define LV_DISPI_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ -#define LV_DISPI_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ -#define LV_DISPI_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ +#define LV_indev_proc_READ_PERIOD 50 /*Input device read period milliseconds*/ +#define LV_indev_proc_TP_MARKER 0 /*Mark the pressed points (Value means marker point size)*/ +#define LV_indev_proc_DRAG_LIMIT (10 * LV_DOWNSCALE) /*Drag threshold in pixels */ +#define LV_indev_proc_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */ +#define LV_indev_proc_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/ +#define LV_indev_proc_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */ /*lv_obj (base object) settings*/ #define LV_OBJ_FREE_NUM 1 /*Enable the free number attribute*/ diff --git a/lv_draw/lv_draw_rbasic.c b/lv_draw/lv_draw_rbasic.c index 52c671286..8445ccbb1 100644 --- a/lv_draw/lv_draw_rbasic.c +++ b/lv_draw/lv_draw_rbasic.c @@ -6,9 +6,9 @@ /********************* * INCLUDES *********************/ +#include "../lv_hal/lv_hal_disp.h" #include "lv_draw_rbasic.h" #include "lv_conf.h" -#include "../hal/disp/hal_disp.h" #include "misc/gfx/font.h" /********************* @@ -74,10 +74,9 @@ void lv_rfill(const area_t * cords_p, const area_t * mask_p, area_set(&scr_area, 0, 0, LV_HOR_RES - 1, LV_VER_RES - 1); union_ok = area_union(&masked_area, cords_p, &scr_area); } - if(union_ok != false){ - //TODO disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color); + lv_disp_fill(masked_area.x1, masked_area.y1, masked_area.x2, masked_area.y2, color); } } @@ -192,7 +191,7 @@ void lv_rmap(const area_t * cords_p, const area_t * mask_p, cord_t row; cord_t mask_w = area_get_width(&masked_a) - 1; for(row = 0; row < area_get_height(&masked_a); row++) { - //TODO disp_map(masked_a.x1, masked_a.y1 + row, masked_a.x1 + mask_w, masked_a.y1 + row, map_p); + lv_disp_map(masked_a.x1, masked_a.y1 + row, masked_a.x1 + mask_w, masked_a.y1 + row, map_p); map_p += map_width; } diff --git a/lv_draw/lv_draw_vbasic.c b/lv_draw/lv_draw_vbasic.c index 962461a6f..d5321472f 100644 --- a/lv_draw/lv_draw_vbasic.c +++ b/lv_draw/lv_draw_vbasic.c @@ -2,15 +2,17 @@ * @file lv_vdraw.c * */ + +#include "lv_conf.h" + #include #include #include -#include "lv_conf.h" +#include "../lv_hal/lv_hal_disp.h" #include "misc/gfx/area.h" #include "misc/gfx/font.h" #include "misc/gfx/color.h" -#include "../hal/disp/hal_disp.h" #if LV_VDB_SIZE != 0 @@ -131,7 +133,7 @@ void lv_vfill(const area_t * cords_p, const area_t * mask_p, } cord_t row; for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) { - disp_color_cpy(&vdb_buf_tmp[vdb_rel_a.x1], color_map, map_width, opa); + lv_disp_color_cpy(&vdb_buf_tmp[vdb_rel_a.x1], color_map, map_width, opa); vdb_buf_tmp += vdb_width; } #endif @@ -324,7 +326,7 @@ void lv_vmap(const area_t * cords_p, const area_t * mask_p, #if DISP_HW_ACC == 0 sw_color_cpy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); #else - disp_color_cpy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); + lv_disp_color_cpy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); #endif map_p += map_width; /*Next row on the map*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ diff --git a/lv_examples/1_2_objects/lv_ex_objects.c b/lv_examples/1_2_objects/lv_ex_objects.c index 8516c8be0..5c9b32416 100644 --- a/lv_examples/1_2_objects/lv_ex_objects.c +++ b/lv_examples/1_2_objects/lv_ex_objects.c @@ -73,8 +73,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t ddlist_action(lv_obj_t * ddlist, lv_dispi_t * dispi); +static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t ddlist_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc); /********************** * STATIC VARIABLES @@ -187,10 +187,10 @@ void lv_ex_objects(void) /** * Called when a button is released * @param btn pointer to the released button - * @param dispi pointer to caller display input (e.g. touchpad) + * @param indev_proc pointer to caller display input (e.g. touchpad) * @return LV_ACTION_RES_OK because the object is not deleted in this function */ -static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { /*Increase the button width*/ cord_t width = lv_obj_get_width(btn); @@ -202,10 +202,10 @@ static lv_action_res_t btn_rel_action(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when a new option is chosen in the drop down list * @param ddlist pointer to the drop down list - * @param dispi pointer to caller display input (e.g. touchpad) + * @param indev_proc pointer to caller display input (e.g. touchpad) * @return LV_ACTION_RES_OK because the object is not deleted in this function */ -static lv_action_res_t ddlist_action(lv_obj_t * ddlist, lv_dispi_t * dispi) +static lv_action_res_t ddlist_action(lv_obj_t * ddlist, lv_indev_proc_t * indev_proc) { uint16_t opt = lv_ddlist_get_selected(ddlist); /*Get the id of selected option*/ diff --git a/lv_examples/2_2_encoder_ctrl/lv_ex_encoder_ctrl.c b/lv_examples/2_2_encoder_ctrl/lv_ex_encoder_ctrl.c index a1bfea53c..447aa0d57 100644 --- a/lv_examples/2_2_encoder_ctrl/lv_ex_encoder_ctrl.c +++ b/lv_examples/2_2_encoder_ctrl/lv_ex_encoder_ctrl.c @@ -51,13 +51,13 @@ **********************/ static void gui_create(void); static void enc_create(void); -static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t enable_action(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t enc_next(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t enc_inc(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t enc_dec(lv_obj_t * btn, lv_dispi_t * dispi); -static lv_action_res_t enc_sel(lv_obj_t * btn, lv_dispi_t * dispi); +static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t enable_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t enc_next(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t enc_inc(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t enc_dec(lv_obj_t * btn, lv_indev_proc_t * indev_proc); +static lv_action_res_t enc_sel(lv_obj_t * btn, lv_indev_proc_t * indev_proc); /********************** * STATIC VARIABLES @@ -193,10 +193,10 @@ static void enc_create(void) /** * Called when the Enable button is released. Show a message box to really enable or not? * @param btn pointer to the Enable button - * @param dispi pointer to the caller display input or NULL if the encoder used + * @param indev_proc pointer to the caller display input or NULL if the encoder used * @return LV_ACTION_RES_OK: because the button is not deleted */ -static lv_action_res_t enable_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t enable_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { /*If the butto nsi released the show message box to be sure about the Enable*/ if(lv_btn_get_state(btn) == LV_BTN_STATE_REL) { @@ -235,10 +235,10 @@ static lv_action_res_t enable_action(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when the message box's 'Yes' button is released * @param btn pointer to the 'Yes' button - * @param dispi pointer to the caller display input or NULL if the encoder used + * @param indev_proc pointer to the caller display input or NULL if the encoder used * @return LV_ACTION_RES_INV: because the button along with the message box will be deleted */ -static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_group_focus_freeze(g, false); /*Release the freeze*/ lv_obj_t * mbox = lv_mbox_get_from_btn(btn); @@ -256,10 +256,10 @@ static lv_action_res_t mbox_yes_action(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when the message box's 'No' button is released * @param btn pointer to the 'No' button - * @param dispi pointer to the caller display input or NULL if the encoder used + * @param indev_proc pointer to the caller display input or NULL if the encoder used * @return LV_ACTION_RES_INV: because the button along with the message box will be deleted */ -static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { lv_group_focus_freeze(g, false); /*Release the freeze*/ lv_obj_t * mbox = lv_mbox_get_from_btn(btn); @@ -271,10 +271,10 @@ static lv_action_res_t mbox_no_action(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when the Encoder emulator's Next button is released * @param btn pointer to the button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK: because the button is not deleted */ -static lv_action_res_t enc_next(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t enc_next(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { /*Focus on the next object in the group*/ lv_group_focus_next(g); @@ -285,10 +285,10 @@ static lv_action_res_t enc_next(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when the Encoder emulator's Increment button is released * @param btn pointer to the button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK: because the button is not deleted */ -static lv_action_res_t enc_inc(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t enc_inc(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { /* Send RIGHT key when rotate to right. * It will trigger an increment like action in the object */ @@ -299,10 +299,10 @@ static lv_action_res_t enc_inc(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when the Encoder emulator's Increment button is released * @param btn pointer to the button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK: because the button is not deleted */ -static lv_action_res_t enc_dec(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t enc_dec(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { /* Send LEFT key when rotate to left. * It will trigger a decrement like action in the object */ @@ -313,10 +313,10 @@ static lv_action_res_t enc_dec(lv_obj_t * btn, lv_dispi_t * dispi) /** * Called when the Encoder emulator's Send button is released * @param btn pointer to the button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller display input * @return LV_ACTION_RES_OK: because the button is not deleted */ -static lv_action_res_t enc_sel(lv_obj_t * btn, lv_dispi_t * dispi) +static lv_action_res_t enc_sel(lv_obj_t * btn, lv_indev_proc_t * indev_proc) { /* Send ENTER key. * It will trigger an 'OK' or 'Select' action in the object */ diff --git a/lv_hal b/lv_hal new file mode 160000 index 000000000..e6b556ed8 --- /dev/null +++ b/lv_hal @@ -0,0 +1 @@ +Subproject commit e6b556ed81a0f283c30c3af78cc0c87ea6004940 diff --git a/lv_obj/lv_dispi.c b/lv_obj/lv_dispi.c deleted file mode 100644 index 276d1d1bb..000000000 --- a/lv_obj/lv_dispi.c +++ /dev/null @@ -1,496 +0,0 @@ -/** - * @file lv_dispi.c - * - */ - -/********************* - * INCLUDES - ********************/ -#include "lv_conf.h" - -#include "misc/os/ptask.h" -#include "misc/math/math_base.h" -#include "lv_dispi.h" -#include "../lv_draw/lv_draw_rbasic.h" -#include "../hal/indev/hal_indev.h" -#include "../hal/systick/systick.h" -#include "lv_obj.h" - -/********************* - * DEFINES - *********************/ - -/********************** - * TYPEDEFS - **********************/ - -/********************** - * STATIC PROTOTYPES - **********************/ -static void dispi_task(void * param); -static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y); -static void dispi_proc_press(lv_dispi_t * dispi_p); -static void disi_proc_release(lv_dispi_t * dispi_p); -static lv_obj_t * dispi_search_obj(const lv_dispi_t * dispi_p, lv_obj_t * obj); -static void dispi_drag(lv_dispi_t * dispi_p); -static void dispi_drag_throw(lv_dispi_t * dispi_p); - -/********************** - * STATIC VARIABLES - **********************/ -static ptask_t* dispi_task_p; -static bool lv_dispi_reset_qry; -static bool lv_dispi_reset_now; -static lv_dispi_t dispi_array[2]; - -/********************** - * MACROS - **********************/ - -/********************** - * GLOBAL FUNCTIONS - **********************/ - -/** - * Initialize the display input subsystem - */ -void lv_dispi_init(void) -{ - lv_dispi_reset_qry = false; - lv_dispi_reset_now = false; - -#if LV_DISPI_READ_PERIOD != 0 - dispi_task_p = ptask_create(dispi_task, LV_DISPI_READ_PERIOD, PTASK_PRIO_MID, NULL); -#else - dispi_task_p = ptask_create(dispi_task, 1, PTASK_PRIO_OFF); /*Not use lv_dispi*/ -#endif -} - -/** - * Get an array with all the display inputs. Contains (INDEV_NUM elements) - * @return pointer to a an lv_dispi_t array. - */ -lv_dispi_t * lv_dispi_get_array(void) -{ - return dispi_array; -} - -/** - * Reset all display inputs - */ -void lv_dispi_reset(void) -{ - lv_dispi_reset_qry = true; -} - -/** - * Reset the long press state of a display input - * @param dispi pointer to a display input - */ -void lv_dispi_reset_lpr(lv_dispi_t * dispi) -{ - dispi->long_press_sent = 0; - dispi->lpr_rep_time_stamp = lv_hal_tick_get(); - dispi->press_time_stamp = lv_hal_tick_get(); -} - -/** - * Get the last point on display input - * @param dispi pointer to a display input - * @param point pointer to a point to store the result - */ -void lv_dispi_get_point(lv_dispi_t * dispi, point_t * point) -{ - point->x = dispi->act_point.x; - point->y = dispi->act_point.y; -} - -/** - * Check if there is dragging on display input or not - * @param dispi pointer to a display input - * @return true: drag is in progress - */ -bool lv_dispi_is_dragging(lv_dispi_t * dispi) -{ - return dispi->drag_in_prog == 0 ? false : true; -} - -/** - * Get the vector of dragging on a display input - * @param dispi pointer to a display input - * @param point pointer to a point to store the vector - */ -void lv_dispi_get_vect(lv_dispi_t * dispi, point_t * point) -{ - point->x = dispi->vect.x; - point->y = dispi->vect.y; -} - -/** - * Do nothing until the next release - * @param dispi pointer to a display input - */ -void lv_dispi_wait_release(lv_dispi_t * dispi) -{ - dispi->wait_release = 1; -} - -/********************** - * STATIC FUNCTIONS - **********************/ - -/** - * Called periodically to handle the display inputs - * @param param unused - */ -static void dispi_task(void * param) -{ - lv_hal_indev_data_t data; - lv_indev_t * drv; - drv = lv_hal_indev_next(NULL); - - while(drv) { - drv->drv.get_data(&data); - drv->dispi.pressed = data.state; - dispi_proc_point(&drv->dispi,data.point.x , data.point.y); - drv = lv_hal_indev_next(drv); - } - - /*If reset query occurred in this round then set a flag to - * ask the dispis to reset themself in the next round */ - if(lv_dispi_reset_qry != false) { - lv_dispi_reset_qry = false; - lv_dispi_reset_now = true; - } - /*If now a reset occurred then clear the flag*/ - else if (lv_dispi_reset_now != false){ - lv_dispi_reset_now = false; - } -} - -/** - * Process new points by a display input. dispi_p->pressed has to be set - * @param dispi_p pointer to a display input - * @param x x coordinate of the next point - * @param y y coordinate of the next point - */ -static void dispi_proc_point(lv_dispi_t * dispi_p, cord_t x, cord_t y) -{ -#if LV_ANTIALIAS != 0 && LV_VDB_SIZE != 0 - dispi_p->act_point.x = x * LV_DOWNSCALE; - dispi_p->act_point.y = y * LV_DOWNSCALE; -#else - dispi_p->act_point.x = x; - dispi_p->act_point.y = y; -#endif - /*Handle the reset query*/ - if(lv_dispi_reset_now != false) { - dispi_p->act_obj = NULL; - dispi_p->last_obj = NULL; - dispi_p->drag_range_out = 0; - dispi_p->drag_in_prog = 0; - dispi_p->long_press_sent = 0; - dispi_p->press_time_stamp = 0; - dispi_p->lpr_rep_time_stamp = 0; - dispi_p->vect_sum.x = 0; - dispi_p->vect_sum.y = 0; - } - - if(dispi_p->pressed != false){ -#if LV_DISPI_TP_MARKER != 0 - area_t area; - area.x1 = x - (LV_DISPI_TP_MARKER >> 1); - area.y1 = y - (LV_DISPI_TP_MARKER >> 1); - area.x2 = x + ((LV_DISPI_TP_MARKER >> 1) | 0x1); - area.y2 = y + ((LV_DISPI_TP_MARKER >> 1) | 0x1); - lv_rfill(&area, NULL, COLOR_MAKE(0xFF, 0, 0), OPA_COVER); -#endif - dispi_proc_press(dispi_p); - } else { - disi_proc_release(dispi_p); - } - - - dispi_p->last_point.x = dispi_p->act_point.x; - dispi_p->last_point.y = dispi_p->act_point.y; -} - -/** - * Process the pressed state - * @param dispi_p pointer to a display input - */ -static void dispi_proc_press(lv_dispi_t * dispi_p) -{ - lv_obj_t * pr_obj = dispi_p->act_obj; - - if(dispi_p->wait_release != 0) return; - - /*If there is no last object then search*/ - if(dispi_p->act_obj == NULL) { - pr_obj = dispi_search_obj(dispi_p, lv_scr_act()); - } - /*If there is last object but it is not dragged also search*/ - else if(dispi_p->drag_in_prog == 0) {/*Now act_obj != NULL*/ - pr_obj = dispi_search_obj(dispi_p, lv_scr_act()); - } - /*If a dragable object was the last then keep it*/ - else { - - } - - /*If a new object was found reset some variables and send a pressed signal*/ - if(pr_obj != dispi_p->act_obj) { - - dispi_p->last_point.x = dispi_p->act_point.x; - dispi_p->last_point.y = dispi_p->act_point.y; - - /*If a new object found the previous was lost, so send a signal*/ - if(dispi_p->act_obj != NULL) { - dispi_p->act_obj->signal_f(dispi_p->act_obj, - LV_SIGNAL_PRESS_LOST, dispi_p); - } - - if(pr_obj != NULL) { - /* Save the time when the obj pressed. - * It is necessary to count the long press time.*/ - dispi_p->press_time_stamp = lv_hal_tick_get(); - dispi_p->long_press_sent = 0; - dispi_p->drag_range_out = 0; - dispi_p->drag_in_prog = 0; - dispi_p->vect_sum.x = 0; - dispi_p->vect_sum.y = 0; - - /*Search for 'top' attribute*/ - lv_obj_t * i = pr_obj; - lv_obj_t * last_top = NULL; - while(i != NULL){ - if(i->top_en != 0) last_top = i; - i = lv_obj_get_parent(i); - } - - if(last_top != NULL) { - /*Move the last_top object to the foreground*/ - lv_obj_t * par =lv_obj_get_parent(last_top); - /*After list change it will be the new head*/ - ll_chg_list(&par->child_ll, &par->child_ll, last_top); - lv_obj_inv(last_top); - } - - /*Send a signal about the press*/ - pr_obj->signal_f(pr_obj, LV_SIGNAL_PRESSED, dispi_p); - } - } - - /* The reset can be set in the signal function. - * In case of reset query ignore the remaining parts.*/ - if(lv_dispi_reset_qry == false) { - dispi_p->act_obj = pr_obj; /*Save the pressed object*/ - dispi_p->last_obj = dispi_p->act_obj; /*Refresh the last_obj*/ - - /*Calculate the vector*/ - dispi_p->vect.x = dispi_p->act_point.x - dispi_p->last_point.x; - dispi_p->vect.y = dispi_p->act_point.y - dispi_p->last_point.y; - - /*If there is active object and it can be dragged run the drag*/ - if(dispi_p->act_obj != NULL) { - dispi_p->act_obj->signal_f(dispi_p->act_obj, LV_SIGNAL_PRESSING, dispi_p); - - dispi_drag(dispi_p); - - /*If there is no drag then check for long press time*/ - if(dispi_p->drag_in_prog == 0 && dispi_p->long_press_sent == 0) { - /*Send a signal about the long press if enough time elapsed*/ - if(lv_hal_tick_elaps(dispi_p->press_time_stamp) > LV_DISPI_LONG_PRESS_TIME) { - pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS, dispi_p); - - /*Mark the signal sending to do not send it again*/ - dispi_p->long_press_sent = 1; - - /*Save the long press time stamp for the long press repeat handler*/ - dispi_p->lpr_rep_time_stamp = lv_hal_tick_get(); - } - } - /*Send long press repeated signal*/ - if(dispi_p->drag_in_prog == 0 && dispi_p->long_press_sent == 1) { - /*Send a signal about the long press repeate if enough time elapsed*/ - if(lv_hal_tick_elaps(dispi_p->lpr_rep_time_stamp) > LV_DISPI_LONG_PRESS_REP_TIME) { - pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS_REP, dispi_p); - dispi_p->lpr_rep_time_stamp = lv_hal_tick_get(); - - } - } - } - } -} - -/** - * Process the released state - * @param dispi_p pointer to a display input - */ -static void disi_proc_release(lv_dispi_t * dispi_p) -{ - if(dispi_p->wait_release != 0) { - dispi_p->act_obj = NULL; - dispi_p->last_obj = NULL; - dispi_p->press_time_stamp = 0; - dispi_p->lpr_rep_time_stamp = 0; - dispi_p->wait_release = 0; - } - - /*Forgot the act obj and send a released signal */ - if(dispi_p->act_obj != NULL) { - dispi_p->act_obj->signal_f(dispi_p->act_obj, - LV_SIGNAL_RELEASED, dispi_p); - dispi_p->act_obj = NULL; - dispi_p->press_time_stamp = 0; - dispi_p->lpr_rep_time_stamp = 0; - } - - /*The reset can be set in the signal function. - * In case of reset query ignore the remaining parts.*/ - if(dispi_p->last_obj != NULL && lv_dispi_reset_qry == false) { - dispi_drag_throw(dispi_p); - } - -} - -/** - * Search the most top, clickable object on the last point of a display input - * @param dispi_p pointer to a display input - * @param obj pointer to a start object, typically the screen - * @return pointer to the found object or NULL if there was no suitable object - */ -static lv_obj_t * dispi_search_obj(const lv_dispi_t * dispi_p, lv_obj_t * obj) -{ - lv_obj_t * found_p = NULL; - - /*If the point is on this object*/ - /*Check its children too*/ - if(area_is_point_on(&obj->cords, &dispi_p->act_point)) { - lv_obj_t * i; - - LL_READ(obj->child_ll, i) { - found_p = dispi_search_obj(dispi_p, i); - - /*If a child was found then break*/ - if(found_p != NULL) { - break; - } - } - - /*If then the children was not ok, but this obj is clickable - * and it or its parent is not hidden then save this object*/ - if(found_p == NULL && lv_obj_get_click(obj) != false) { - lv_obj_t * i = obj; - while(i != NULL) { - if(lv_obj_get_hidden(i) == true) break; - i = lv_obj_get_parent(i); - } - /*No parent found with hidden == true*/ - if(i == NULL) found_p = obj; - } - - } - - return found_p; -} - -/** - * Handle the dragging of dispi_p->act_obj - * @param dispi_p pointer to a display input - */ -static void dispi_drag(lv_dispi_t * dispi_p) -{ - lv_obj_t * drag_obj = dispi_p->act_obj; - - /*If drag parent is active check recursively the drag_parent attribute*/ - while(lv_obj_get_drag_parent(drag_obj) != false && - drag_obj != NULL) { - drag_obj = lv_obj_get_parent(drag_obj); - } - - if(drag_obj == NULL) return; - - if(lv_obj_get_drag(drag_obj) == false) return; - - /*If still there is no drag then count the movement*/ - if(dispi_p->drag_range_out == 0) { - dispi_p->vect_sum.x += dispi_p->vect.x; - dispi_p->vect_sum.y += dispi_p->vect.y; - - /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ - if(MATH_ABS(dispi_p->vect_sum.x) >= LV_DISPI_DRAG_LIMIT || - MATH_ABS(dispi_p->vect_sum.y) >= LV_DISPI_DRAG_LIMIT) - { - dispi_p->drag_range_out = 1; - } - } - - /*If the drag limit is stepped over then handle the dragging*/ - if(dispi_p->drag_range_out != 0) { - /*Set new position if the vector is not zero*/ - if(dispi_p->vect.x != 0 || - dispi_p->vect.y != 0) { - /*Get the coordinates of the object end modify them*/ - cord_t act_x = lv_obj_get_x(drag_obj); - cord_t act_y = lv_obj_get_y(drag_obj); - - lv_obj_set_pos(drag_obj, act_x + dispi_p->vect.x, act_y + dispi_p->vect.y); - - /*Set the drag in progress flag if the object is really moved*/ - if(lv_obj_get_x(drag_obj) != act_x || lv_obj_get_y(drag_obj) != act_y) { - if(dispi_p->drag_range_out != 0) { /*Send the drag begin signal on first move*/ - drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_BEGIN, dispi_p); - } - dispi_p->drag_in_prog = 1; - } - - } - } -} - -/** - * Handle throwing by drag if the drag is ended - * @param dispi_p pointer to a display input - */ -static void dispi_drag_throw(lv_dispi_t * dispi_p) -{ - if(dispi_p->drag_in_prog == 0) return; - - /*Set new position if the vector is not zero*/ - lv_obj_t * drag_obj = dispi_p->last_obj; - - /*If drag parent is active check recursively the drag_parent attribute*/ - - while(lv_obj_get_drag_parent(drag_obj) != false && - drag_obj != NULL) { - drag_obj = lv_obj_get_parent(drag_obj); - } - - if(drag_obj == NULL) return; - - /*Return if the drag throw is not enabled*/ - if(lv_obj_get_drag_throw(drag_obj) == false ){ - dispi_p->drag_in_prog = 0; - drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_END, dispi_p); - return; - } - - /*Reduce the vectors*/ - dispi_p->vect.x = dispi_p->vect.x * (100 -LV_DISPI_DRAG_THROW) / 100; - dispi_p->vect.y = dispi_p->vect.y * (100 -LV_DISPI_DRAG_THROW) / 100; - - if(dispi_p->vect.x != 0 || - dispi_p->vect.y != 0) - { - /*Get the coordinates and modify them*/ - cord_t act_x = lv_obj_get_x(drag_obj) + dispi_p->vect.x; - cord_t act_y = lv_obj_get_y(drag_obj) + dispi_p->vect.y; - lv_obj_set_pos(drag_obj, act_x, act_y); - } - /*If the vectors become 0 -> drag_in_prog = 0 and send a drag end signal*/ - else { - dispi_p->drag_in_prog = 0; - drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_END, dispi_p); - } -} diff --git a/lv_obj/lv_indev.c b/lv_obj/lv_indev.c new file mode 100644 index 000000000..871df2904 --- /dev/null +++ b/lv_obj/lv_indev.c @@ -0,0 +1,509 @@ +/** + * @file lv_indev_proc.c + * + */ + +/********************* + * INCLUDES + ********************/ +#include +#include "lv_conf.h" + +#include "../lv_hal/lv_hal_tick.h" +#include "misc/os/ptask.h" +#include "misc/math/math_base.h" +#include "../lv_draw/lv_draw_rbasic.h" +#include "lv_obj.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void indev_proc_task(void * param); +static void indev_proc_point(lv_indev_state_t * indev, cord_t x, cord_t y); +static void indev_proc_press(lv_indev_state_t * state); +static void disi_proc_release(lv_indev_state_t * state); +static lv_obj_t * indev_search_obj(const lv_indev_state_t * indev, lv_obj_t * obj); +static void indev_drag(lv_indev_state_t * state); +static void indev_drag_throw(lv_indev_state_t * state); + +/********************** + * STATIC VARIABLES + **********************/ +static ptask_t *indev_proc_task_p; +static lv_indev_t *indev_act; + +/********************** + * MACROS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the display input device subsystem + */ +void lv_indev_proc_init(void) +{ +#if LV_indev_proc_READ_PERIOD != 0 + indev_proc_task_p = ptask_create(indev_proc_task, LV_indev_proc_READ_PERIOD, PTASK_PRIO_MID, NULL); +#else + indev_proc_task_p = ptask_create(indev_proc_task, 1, PTASK_PRIO_OFF); /*Not use lv_indev_proc*/ +#endif + + lv_indev_reset(NULL); /*Reset all input devices*/ +} + +/** + * Enable input devices device by type + * @param type Input device type + * @param enable true: enable this type; false: disable this type + */ +void lv_indev_enable(lv_hal_indev_type_t type, bool enable) +{ + lv_indev_t *i = lv_indev_next(NULL); + + while (i) { + if (i->drv.type == type) i->state.disable = enable == false ? 1 : 0; + i = lv_indev_next(i); + } +} + +/** + * Get the currently processed input device. Can be used in action functions too. + * @return pointer to the currently processed input device or NULL if no input device processing right now + */ +lv_indev_t * lv_indev_get_act(void) +{ + return indev_act; +} + +/** + * Reset one or all input devices + * @param indev + */ +void lv_indev_reset(lv_indev_t * indev) +{ + if(indev) indev->state.reset_qry = 1; + else { + lv_indev_t * i = lv_indev_next(NULL); + while(i) { + i->state.reset_qry = 1; + i = lv_indev_next(i); + } + } +} + +/** + * Reset the long press state of an input device + * @param indev_proc pointer to an input device + */ +void lv_indev_reset_lpr(lv_indev_t * indev_proc) +{ + indev_proc->state.long_press_sent = 0; + indev_proc->state.lpr_rep_time_stamp = lv_tick_get(); + indev_proc->state.press_time_stamp = lv_tick_get(); +} + +/** + * Get the last point of an input device + * @param indev pointer to an input device + * @param point pointer to a point to store the result + */ +void lv_indev_get_point(lv_indev_t * indev, point_t * point) +{ + point->x = indev->state.act_point.x; + point->y = indev->state.act_point.y; +} + +/** + * Check if there is dragging with an input device or not + * @param indev pointer to an input device + * @return true: drag is in progress + */ +bool lv_indev_is_dragging(lv_indev_t * indev) +{ + return indev->state.drag_in_prog == 0 ? false : true; +} + +/** + * Get the vector of dragging of an input device + * @param indev pointer to an input device + * @param point pointer to a point to store the vector + */ +void lv_indev_get_vect(lv_indev_t * indev, point_t * point) +{ + point->x = indev->state.vect.x; + point->y = indev->state.vect.y; +} + +/** + * Do nothing until the next release + * @param indev pointer to an input device + */ +void lv_indev_wait_release(lv_indev_t * indev) +{ + indev->state.wait_release = 1; +} + +/********************** + * STATIC FUNCTIONS + **********************/ + +/** + * Called periodically to handle the input devices + * @param param unused + */ +static void indev_proc_task(void * param) +{ + lv_hal_indev_data_t data; + lv_indev_t * i; + i = lv_indev_next(NULL); + + while(i) { + indev_act = i; + + if(i->state.reset_qry) { + i->state.act_obj = NULL; + i->state.last_obj = NULL; + i->state.drag_range_out = 0; + i->state.drag_in_prog = 0; + i->state.long_press_sent = 0; + i->state.press_time_stamp = 0; + i->state.lpr_rep_time_stamp = 0; + i->state.vect_sum.x = 0; + i->state.vect_sum.y = 0; + i->state.reset_qry = 0; + } + + lv_indev_get(i, &data); + i->state.pressed = data.state; + indev_proc_point(&i->state, data.point.x , data.point.y); + + + + i = lv_indev_next(i); + } + + indev_act = NULL; +} + +/** + * Process new points from a input device. indev->state.pressed has to be set + * @param indev pointer to an input device state + * @param x x coordinate of the next point + * @param y y coordinate of the next point + */ +static void indev_proc_point(lv_indev_state_t * indev, cord_t x, cord_t y) +{ +#if LV_ANTIALIAS != 0 && LV_VDB_SIZE != 0 + indev->act_point.x = x * LV_DOWNSCALE; + indev->act_point.y = y * LV_DOWNSCALE; +#else + indev->act_point.x = x; + indev->act_point.y = y; +#endif + + if(indev->pressed != false){ +#if LV_indev_proc_TP_MARKER != 0 + area_t area; + area.x1 = x - (LV_indev_proc_TP_MARKER >> 1); + area.y1 = y - (LV_indev_proc_TP_MARKER >> 1); + area.x2 = x + ((LV_indev_proc_TP_MARKER >> 1) | 0x1); + area.y2 = y + ((LV_indev_proc_TP_MARKER >> 1) | 0x1); + lv_rfill(&area, NULL, COLOR_MAKE(0xFF, 0, 0), OPA_COVER); +#endif + indev_proc_press(indev); + } else { + disi_proc_release(indev); + } + + + indev->last_point.x = indev->act_point.x; + indev->last_point.y = indev->act_point.y; +} + +/** + * Process the pressed state + * @param indev pointer to an input device state + */ +static void indev_proc_press(lv_indev_state_t * state) +{ + lv_obj_t * pr_obj = state->act_obj; + + if(state->wait_release != 0) return; + + /*If there is no last object then search*/ + if(state->act_obj == NULL) { + pr_obj = indev_search_obj(state, lv_scr_act()); + } + /*If there is last object but it is not dragged also search*/ + else if(state->drag_in_prog == 0) {/*Now act_obj != NULL*/ + pr_obj = indev_search_obj(state, lv_scr_act()); + } + /*If a dragable object was the last then keep it*/ + else { + + } + + /*If a new object was found reset some variables and send a pressed signal*/ + if(pr_obj != state->act_obj) { + + state->last_point.x = state->act_point.x; + state->last_point.y = state->act_point.y; + + /*If a new object found the previous was lost, so send a signal*/ + if(state->act_obj != NULL) { + state->act_obj->signal_f(state->act_obj, LV_SIGNAL_PRESS_LOST, indev_act); + } + + if(pr_obj != NULL) { + /* Save the time when the obj pressed. + * It is necessary to count the long press time.*/ + state->press_time_stamp = lv_tick_get(); + state->long_press_sent = 0; + state->drag_range_out = 0; + state->drag_in_prog = 0; + state->vect_sum.x = 0; + state->vect_sum.y = 0; + + /*Search for 'top' attribute*/ + lv_obj_t * i = pr_obj; + lv_obj_t * last_top = NULL; + while(i != NULL){ + if(i->top_en != 0) last_top = i; + i = lv_obj_get_parent(i); + } + + if(last_top != NULL) { + /*Move the last_top object to the foreground*/ + lv_obj_t * par =lv_obj_get_parent(last_top); + /*After list change it will be the new head*/ + ll_chg_list(&par->child_ll, &par->child_ll, last_top); + lv_obj_inv(last_top); + } + + /*Send a signal about the press*/ + pr_obj->signal_f(pr_obj, LV_SIGNAL_PRESSED, indev_act); + } + } + + /* The reset can be set in the signal function. + * In case of reset query ignore the remaining parts.*/ + if(state->reset_qry == 0) { + state->act_obj = pr_obj; /*Save the pressed object*/ + state->last_obj = state->act_obj; /*Refresh the last_obj*/ + + /*Calculate the vector*/ + state->vect.x = state->act_point.x - state->last_point.x; + state->vect.y = state->act_point.y - state->last_point.y; + + /*If there is active object and it can be dragged run the drag*/ + if(state->act_obj != NULL) { + state->act_obj->signal_f(state->act_obj, LV_SIGNAL_PRESSING, indev_act); + + indev_drag(state); + + /*If there is no drag then check for long press time*/ + if(state->drag_in_prog == 0 && state->long_press_sent == 0) { + /*Send a signal about the long press if enough time elapsed*/ + if(lv_tick_elaps(state->press_time_stamp) > LV_indev_proc_LONG_PRESS_TIME) { + pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS, indev_act); + + /*Mark the signal sending to do not send it again*/ + state->long_press_sent = 1; + + /*Save the long press time stamp for the long press repeat handler*/ + state->lpr_rep_time_stamp = lv_tick_get(); + } + } + /*Send long press repeated signal*/ + if(state->drag_in_prog == 0 && state->long_press_sent == 1) { + /*Send a signal about the long press repeate if enough time elapsed*/ + if(lv_tick_elaps(state->lpr_rep_time_stamp) > LV_indev_proc_LONG_PRESS_REP_TIME) { + pr_obj->signal_f(pr_obj, LV_SIGNAL_LONG_PRESS_REP, indev_act); + state->lpr_rep_time_stamp = lv_tick_get(); + + } + } + } + } +} + +/** + * Process the released state + * @param indev_proc_p pointer to an input device state + */ +static void disi_proc_release(lv_indev_state_t * state) +{ + if(state->wait_release != 0) { + state->act_obj = NULL; + state->last_obj = NULL; + state->press_time_stamp = 0; + state->lpr_rep_time_stamp = 0; + state->wait_release = 0; + } + + /*Forgot the act obj and send a released signal */ + if(state->act_obj != NULL) { + state->act_obj->signal_f(state->act_obj, LV_SIGNAL_RELEASED, indev_act); + state->act_obj = NULL; + state->press_time_stamp = 0; + state->lpr_rep_time_stamp = 0; + } + + /*The reset can be set in the signal function. + * In case of reset query ignore the remaining parts.*/ + if(state->last_obj != NULL && state->reset_qry == 0) { + indev_drag_throw(state); + } +} + +/** + * Search the most top, clickable object on the last point of an input device + * @param indev pointer to an input device + * @param obj pointer to a start object, typically the screen + * @return pointer to the found object or NULL if there was no suitable object + */ +static lv_obj_t * indev_search_obj(const lv_indev_state_t * indev, lv_obj_t * obj) +{ + lv_obj_t * found_p = NULL; + + /*If the point is on this object*/ + /*Check its children too*/ + if(area_is_point_on(&obj->cords, &indev->act_point)) { + lv_obj_t * i; + + LL_READ(obj->child_ll, i) { + found_p = indev_search_obj(indev, i); + + /*If a child was found then break*/ + if(found_p != NULL) { + break; + } + } + + /*If then the children was not ok, but this obj is clickable + * and it or its parent is not hidden then save this object*/ + if(found_p == NULL && lv_obj_get_click(obj) != false) { + lv_obj_t * i = obj; + while(i != NULL) { + if(lv_obj_get_hidden(i) == true) break; + i = lv_obj_get_parent(i); + } + /*No parent found with hidden == true*/ + if(i == NULL) found_p = obj; + } + + } + + return found_p; +} + +/** + * Handle the dragging of indev_proc_p->act_obj + * @param indev pointer to a input device state + */ +static void indev_drag(lv_indev_state_t * state) +{ + lv_obj_t * drag_obj = state->act_obj; + + /*If drag parent is active check recursively the drag_parent attribute*/ + while(lv_obj_get_drag_parent(drag_obj) != false && + drag_obj != NULL) { + drag_obj = lv_obj_get_parent(drag_obj); + } + + if(drag_obj == NULL) return; + + if(lv_obj_get_drag(drag_obj) == false) return; + + /*If still there is no drag then count the movement*/ + if(state->drag_range_out == 0) { + state->vect_sum.x += state->vect.x; + state->vect_sum.y += state->vect.y; + + /*If a move is greater then LV_DRAG_LIMIT then begin the drag*/ + if(MATH_ABS(state->vect_sum.x) >= LV_indev_proc_DRAG_LIMIT || + MATH_ABS(state->vect_sum.y) >= LV_indev_proc_DRAG_LIMIT) + { + state->drag_range_out = 1; + } + } + + /*If the drag limit is stepped over then handle the dragging*/ + if(state->drag_range_out != 0) { + /*Set new position if the vector is not zero*/ + if(state->vect.x != 0 || + state->vect.y != 0) { + /*Get the coordinates of the object end modify them*/ + cord_t act_x = lv_obj_get_x(drag_obj); + cord_t act_y = lv_obj_get_y(drag_obj); + + lv_obj_set_pos(drag_obj, act_x + state->vect.x, act_y + state->vect.y); + + /*Set the drag in progress flag if the object is really moved*/ + if(lv_obj_get_x(drag_obj) != act_x || lv_obj_get_y(drag_obj) != act_y) { + if(state->drag_range_out != 0) { /*Send the drag begin signal on first move*/ + drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_BEGIN, indev_act); + } + state->drag_in_prog = 1; + } + + } + } +} + +/** + * Handle throwing by drag if the drag is ended + * @param indev pointer to an input device state + */ +static void indev_drag_throw(lv_indev_state_t * state) +{ + if(state->drag_in_prog == 0) return; + + /*Set new position if the vector is not zero*/ + lv_obj_t * drag_obj = state->last_obj; + + /*If drag parent is active check recursively the drag_parent attribute*/ + + while(lv_obj_get_drag_parent(drag_obj) != false && + drag_obj != NULL) { + drag_obj = lv_obj_get_parent(drag_obj); + } + + if(drag_obj == NULL) return; + + /*Return if the drag throw is not enabled*/ + if(lv_obj_get_drag_throw(drag_obj) == false ){ + state->drag_in_prog = 0; + drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_END, indev_act); + return; + } + + /*Reduce the vectors*/ + state->vect.x = state->vect.x * (100 -LV_indev_proc_DRAG_THROW) / 100; + state->vect.y = state->vect.y * (100 -LV_indev_proc_DRAG_THROW) / 100; + + if(state->vect.x != 0 || + state->vect.y != 0) + { + /*Get the coordinates and modify them*/ + cord_t act_x = lv_obj_get_x(drag_obj) + state->vect.x; + cord_t act_y = lv_obj_get_y(drag_obj) + state->vect.y; + lv_obj_set_pos(drag_obj, act_x, act_y); + } + /*If the vectors become 0 -> drag_in_prog = 0 and send a drag end signal*/ + else { + state->drag_in_prog = 0; + drag_obj->signal_f(drag_obj, LV_SIGNAL_DRAG_END, indev_act); + } +} diff --git a/lv_obj/lv_dispi.h b/lv_obj/lv_indev.h similarity index 51% rename from lv_obj/lv_dispi.h rename to lv_obj/lv_indev.h index f9efc0b0d..0ad044a73 100644 --- a/lv_obj/lv_dispi.h +++ b/lv_obj/lv_indev.h @@ -1,10 +1,10 @@ /** - * @file lv_dispi.h + * @file lv_indev_proc.h * */ -#ifndef LV_DISPI_H -#define LV_DISPI_H +#ifndef LV_indev_proc_H +#define LV_indev_proc_H #ifdef __cplusplus extern "C" { @@ -14,6 +14,7 @@ extern "C" { * INCLUDES *********************/ #include "lv_obj.h" +#include "../lv_hal/lv_hal_indev.h" /********************* * DEFINES @@ -22,25 +23,6 @@ extern "C" { /********************** * TYPEDEFS **********************/ -typedef struct -{ - bool pressed; - point_t act_point; - point_t last_point; - point_t vect; - point_t vect_sum; - lv_obj_t * act_obj; - lv_obj_t * last_obj; - uint32_t press_time_stamp; - uint32_t lpr_rep_time_stamp; - - /*Flags*/ - uint8_t drag_range_out :1; - uint8_t drag_in_prog :1; - uint8_t long_press_sent :1; - uint8_t wait_release :1; -}lv_dispi_t; - typedef enum { @@ -48,7 +30,7 @@ typedef enum LV_ACTION_RES_OK, /*The object is valid (no deleted) after the action*/ }lv_action_res_t; -typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj, lv_dispi_t * dispi); +typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj); /********************** * GLOBAL PROTOTYPES @@ -57,51 +39,51 @@ typedef lv_action_res_t ( * lv_action_t) (struct __LV_OBJ_T * obj, lv_dispi_t * /** * Initialize the display input subsystem */ -void lv_dispi_init(void); +void lv_indev_proc_init(void); /** - * Get an array with all the display inputs. Contains (INDEV_NUM elements) - * @return pointer to a an lv_dispi_t array. + * Get the currently processed input device. Can be used in action functions too. + * @return pointer to the currently processed input device or NULL if no input device processing right now */ -lv_dispi_t * lv_dispi_get_array(void); +lv_indev_t * lv_indev_get_act(void); /** * Reset all display inputs */ -void lv_dispi_reset(void); +void lv_indev_reset(lv_indev_t * indev); /** * Reset the long press state of a display input - * @param dispi pointer to a display input + * @param indev_proc pointer to a display input */ -void lv_dispi_reset_lpr(lv_dispi_t * dispi); +void lv_indev_reset_lpr(lv_indev_t * indev_proc); /** * Get the last point on display input - * @param dispi pointer to a display input + * @param indev_proc pointer to a display input * @param point pointer to a point to store the result */ -void lv_dispi_get_point(lv_dispi_t * dispi, point_t * point); +void lv_indev_get_point(lv_indev_t * indev_proc, point_t * point); /** * Check if there is dragging on display input or not - * @param dispi pointer to a display input + * @param indev_proc pointer to a display input * @return true: drag is in progress */ -bool lv_dispi_is_dragging(lv_dispi_t * dispi); +bool lv_indev_is_dragging(lv_indev_t * indev_proc); /** * Get the vector of dragging on a display input - * @param dispi pointer to a display input + * @param indev_proc pointer to a display input * @param point pointer to a point to store the vector */ -void lv_dispi_get_vect(lv_dispi_t * dispi, point_t * point); +void lv_indev_get_vect(lv_indev_t * indev_proc, point_t * point); /** * Do nothing until the next release - * @param dispi pointer to a display input + * @param indev_proc pointer to a display input */ -void lv_dispi_wait_release(lv_dispi_t * dispi); +void lv_indev_wait_release(lv_indev_t * indev_proc); /********************** * MACROS @@ -112,4 +94,4 @@ void lv_dispi_wait_release(lv_dispi_t * dispi); } /* extern "C" */ #endif -#endif /*LV_DISPI_H*/ +#endif /*LV_indev_proc_H*/ diff --git a/lv_obj/lv_obj.c b/lv_obj/lv_obj.c index 76172205b..9ac843def 100644 --- a/lv_obj/lv_obj.c +++ b/lv_obj/lv_obj.c @@ -7,16 +7,15 @@ * INCLUDES *********************/ +#include #include "lv_conf.h" +#include "lv_obj.h" #include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw_rbasic.h" -#include "lv_dispi.h" -#include "lv_obj.h" #include "lv_refr.h" #include "lv_group.h" #include "../lv_app/lv_app.h" #include "misc/gfx/anim.h" -#include "../hal/indev/hal_indev.h" #include #include @@ -91,9 +90,9 @@ void lv_init(void) /*Refresh the screen*/ lv_obj_inv(act_scr); -#if LV_DISPI_READ_PERIOD != 0 - /*Init the display input handling*/ - lv_dispi_init(); +#if LV_indev_proc_READ_PERIOD != 0 + /*Init the input device handling*/ + lv_indev_proc_init(); #endif /*Initialize the application level*/ @@ -294,24 +293,23 @@ void lv_obj_del(lv_obj_t * obj) if(obj->ext != NULL) dm_free(obj->ext); dm_free(obj); /*Free the object itself*/ -// TODO Update with the new HAL -// /* Reset all display input (dispi) if -// * the currently pressed object is deleted too*/ -// lv_dispi_t * dispi_array = lv_dispi_get_array(); -// lv_obj_t * dpar; -// uint8_t d; -// for(d = 0; d < INDEV_NUM; d++) { -// dpar = obj; -// while(dpar != NULL) { -// if(dispi_array[d].act_obj == dpar || -// dispi_array[d].last_obj == dpar) { -// lv_dispi_reset(); -// break; -// } else { -// dpar = lv_obj_get_parent(dpar); -// } -// } -// } + /* Reset all display input (indev_proc) if + * the currently pressed object is deleted*/ + lv_indev_t * indev = lv_indev_next(NULL); + lv_obj_t * dpar; + while(indev) { + dpar = obj; + while(dpar != NULL) { + if(indev->state.act_obj == dpar || + indev->state.last_obj == dpar) { + lv_indev_reset(indev); + break; + } else { + dpar = lv_obj_get_parent(dpar); + } + } + indev = lv_indev_next(NULL); + } /*Send a signal to the parent to notify it about the child delete*/ if(par != NULL) { diff --git a/lv_obj/lv_obj.h b/lv_obj/lv_obj.h index af4ea2b1e..5e6b868fd 100644 --- a/lv_obj/lv_obj.h +++ b/lv_obj/lv_obj.h @@ -79,7 +79,7 @@ typedef enum LV_SIGNAL_STYLE_CHG, LV_SIGNAL_REFR_EXT_SIZE, - /*Display input related*/ + /*Input device related*/ LV_SIGNAL_PRESSED, LV_SIGNAL_PRESSING, LV_SIGNAL_PRESS_LOST, @@ -117,7 +117,7 @@ typedef struct __LV_OBJ_T void * group_p; /*Pointer to the group of the object*/ /*Attributes and states*/ - uint8_t click_en :1; /*1: Can be pressed by a display input device*/ + uint8_t click_en :1; /*1: Can be pressed by an input device*/ uint8_t drag_en :1; /*1: Enable the dragging*/ uint8_t drag_throw_en:1; /*1: Enable throwing with drag*/ uint8_t drag_parent :1; /*1: Parent will be dragged instead*/ diff --git a/lv_obj/lv_refr.c b/lv_obj/lv_refr.c index 369ee95ee..5347e24a9 100644 --- a/lv_obj/lv_refr.c +++ b/lv_obj/lv_refr.c @@ -6,13 +6,13 @@ /********************* * INCLUDES *********************/ -#include +#include #include "lv_conf.h" -#include "misc/os/ptask.h" -#include "misc/mem/fifo.h" +#include #include "lv_refr.h" #include "lv_vdb.h" -#include "../hal/systick/systick.h" +#include "misc/os/ptask.h" +#include "misc/mem/fifo.h" /********************* * DEFINES @@ -147,7 +147,7 @@ void lv_refr_set_monitor_cb(void (*cb)(uint32_t, uint32_t)) static void lv_refr_task(void * param) { - uint32_t start = lv_hal_tick_get(); + uint32_t start = lv_tick_get(); lv_refr_join_area(); @@ -162,7 +162,7 @@ static void lv_refr_task(void * param) * therefore be sure the inv_buf is cleared prior to it*/ if(refr_done != false) { if(monitor_cb != NULL) { - monitor_cb(lv_hal_tick_elaps(start), px_num); + monitor_cb(lv_tick_elaps(start), px_num); } } } diff --git a/lv_obj/lv_vdb.c b/lv_obj/lv_vdb.c index cf3700eac..c8265b9ee 100644 --- a/lv_obj/lv_vdb.c +++ b/lv_obj/lv_vdb.c @@ -5,7 +5,7 @@ #include "lv_conf.h" #if LV_VDB_SIZE != 0 -#include "../hal/disp/hal_disp.h" +#include "../lv_hal/lv_hal_disp.h" #include #include "lv_vdb.h" @@ -146,7 +146,7 @@ void lv_vdb_flush(void) /* Now the full the VDB is filtered and the result is stored in the first quarter of it * Write out the filtered map to the display*/ - hal_disp_map(vdb_act->area.x1 >> 1, vdb_act->area.y1 >> 1, vdb_act->area.x2 >> 1, vdb_act->area.y2 >> 1, vdb_act->buf); + lv_disp_map(vdb_act->area.x1 >> 1, vdb_act->area.y1 >> 1, vdb_act->area.x2 >> 1, vdb_act->area.y2 >> 1, vdb_act->buf); #endif } diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index ddfb22be7..557b6e782 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -131,9 +131,9 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) } ext->lpr_exec = 0; - /*Call the press action, 'param' is the caller dispi*/ + /*Call the press action, 'param' is the caller indev_proc*/ if(ext->pr_action != NULL && state != LV_BTN_STATE_INA) { - valid = ext->pr_action(btn, param); + valid = ext->pr_action(btn); } } else if(sign == LV_SIGNAL_PRESS_LOST) { @@ -143,7 +143,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) } else if(sign == LV_SIGNAL_PRESSING) { /*When the button begins to drag revert pressed states to released*/ - if(lv_dispi_is_dragging(param) != false) { + if(lv_indev_is_dragging(param) != false) { if(ext->state == LV_BTN_STATE_PR) lv_btn_set_state(btn, LV_BTN_STATE_REL); else if(ext->state == LV_BTN_STATE_TPR) lv_btn_set_state(btn, LV_BTN_STATE_TREL); } @@ -151,7 +151,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) else if(sign == LV_SIGNAL_RELEASED) { /*If not dragged and it was not long press action then *change state and run the action*/ - if(lv_dispi_is_dragging(param) == false && ext->lpr_exec == 0) { + if(lv_indev_is_dragging(param) == false && ext->lpr_exec == 0) { if(ext->state == LV_BTN_STATE_PR && tgl == false) { lv_btn_set_state(btn, LV_BTN_STATE_REL); } else if(ext->state == LV_BTN_STATE_TPR && tgl == false) { @@ -163,7 +163,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) } if(ext->rel_action != NULL && state != LV_BTN_STATE_INA) { - valid = ext->rel_action(btn, param); + valid = ext->rel_action(btn); } } else { /*If dragged change back the state*/ if(ext->state == LV_BTN_STATE_PR) { @@ -174,16 +174,14 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) } } else if(sign == LV_SIGNAL_LONG_PRESS) { - /*Call the long press action, 'param' is the caller dispi*/ if(ext->lpr_action != NULL && state != LV_BTN_STATE_INA) { ext->lpr_exec = 1; - valid = ext->lpr_action(btn, param); + valid = ext->lpr_action(btn); } } else if(sign == LV_SIGNAL_LONG_PRESS_REP) { - /*Call the release action, 'param' is the caller dispi*/ if(ext->lpr_rep_action != NULL && state != LV_BTN_STATE_INA) { - valid = ext->lpr_rep_action(btn, param); + valid = ext->lpr_rep_action(btn); } } else if(sign == LV_SIGNAL_CONTROLL) { lv_btn_ext_t * ext = lv_obj_get_ext(btn); @@ -191,12 +189,12 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_UP) { if(lv_btn_get_tgl(btn) != false) lv_btn_set_state(btn, LV_BTN_STATE_TREL); if(ext->rel_action != NULL && lv_btn_get_state(btn) != LV_BTN_STATE_INA) { - valid = ext->rel_action(btn, param); + valid = ext->rel_action(btn); } } else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_DOWN) { if(lv_btn_get_tgl(btn) != false) lv_btn_set_state(btn, LV_BTN_STATE_REL); if(ext->rel_action != NULL && lv_btn_get_state(btn) != LV_BTN_STATE_INA) { - valid = ext->rel_action(btn, param); + valid = ext->rel_action(btn); } } else if(c == LV_GROUP_KEY_ENTER) { if(lv_btn_get_tgl(btn) != false) { @@ -207,7 +205,7 @@ bool lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param) else if(state == LV_BTN_STATE_TPR) lv_btn_set_state(btn, LV_BTN_STATE_PR); } if(ext->rel_action != NULL && lv_btn_get_state(btn) != LV_BTN_STATE_INA) { - valid = ext->rel_action(btn, param); + valid = ext->rel_action(btn); } } } diff --git a/lv_objx/lv_btn.h b/lv_objx/lv_btn.h index 6d1cd0abc..0d51babb6 100644 --- a/lv_objx/lv_btn.h +++ b/lv_objx/lv_btn.h @@ -22,7 +22,7 @@ extern "C" { #endif #include "lv_cont.h" -#include "../lv_obj/lv_dispi.h" +#include /********************* * DEFINES diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index 4ec1ef5ee..986830e69 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -133,12 +133,12 @@ bool lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) else if(sign == LV_SIGNAL_PRESSING) { uint16_t btn_pr; /*Search the pressed area*/ - lv_dispi_get_point(param, &p); + lv_indev_get_point(param, &p); btn_pr = lv_btnm_get_btn_from_point(btnm, &p); /*Invalidate to old and the new areas*/; lv_obj_get_cords(btnm, &btnm_area); if(btn_pr != ext->btn_pr) { - lv_dispi_reset_lpr(param); + lv_indev_reset_lpr(param); if(ext->btn_pr != LV_BTNM_PR_NONE) { area_cpy(&btn_area, &ext->btn_areas[ext->btn_pr]); btn_area.x1 += btnm_area.x1; diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 2da5f30c5..5845427f3 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -13,7 +13,7 @@ #include "lv_ddlist.h" #include "../lv_draw/lv_draw.h" #include "../lv_obj/lv_group.h" -#include "../lv_obj/lv_dispi.h" +#include "../lv_obj/lv_indev.h" #include "misc/gfx/anim.h" /********************* @@ -29,7 +29,7 @@ * STATIC PROTOTYPES **********************/ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_mode_t mode); -static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist, lv_dispi_t * dispi); +static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist); static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time); static void lv_ddlist_pos_act_option(lv_obj_t * ddlist); @@ -152,7 +152,7 @@ bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param) ext->sel_opt ++; lv_obj_inv(ddlist); if(ext->cb != NULL) { - ext->cb(ddlist, NULL); + ext->cb(ddlist); } } } else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) { @@ -160,7 +160,7 @@ bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param) ext->sel_opt --; lv_obj_inv(ddlist); if(ext->cb != NULL) { - ext->cb(ddlist, NULL); + ext->cb(ddlist); } } } else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ESC) { @@ -442,10 +442,9 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m /** * Called when a drop down list is released to open it or set new option * @param ddlist pointer to a drop down list object - * @param dispi pointer to the called display input * @return LV_ACTION_RES_INV if the ddlist it deleted in the user callback else LV_ACTION_RES_OK */ -static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist, lv_dispi_t * dispi) +static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist) { lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist); @@ -457,8 +456,9 @@ static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist, lv_dispi_t * disp lv_obj_set_drag(lv_page_get_scrl(ddlist), false); /*Search the clicked option*/ + lv_indev_t *indev = lv_indev_get_act(); point_t p; - lv_dispi_get_point(dispi, &p); + lv_indev_get_point(indev, &p); p.x -= ext->opt_label->cords.x1; p.y -= ext->opt_label->cords.y1; uint16_t letter_i; @@ -474,7 +474,7 @@ static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist, lv_dispi_t * disp ext->sel_opt = new_opt; if(ext->cb != NULL) { - ext->cb(ddlist, dispi); + ext->cb(ddlist); } } lv_ddlist_refr_size(ddlist, ext->anim_time); diff --git a/lv_objx/lv_kb.c b/lv_objx/lv_kb.c index bfff724c4..0dbf68829 100644 --- a/lv_objx/lv_kb.c +++ b/lv_objx/lv_kb.c @@ -362,10 +362,10 @@ static lv_action_res_t lv_app_kb_action(lv_obj_t * kb, uint16_t i) lv_ta_set_cursor_pos(ext->ta, cur + 1); } } else if(strcmp(txt, "Hide") == 0) { - if(ext->close_action) ext->close_action(kb, NULL); + if(ext->close_action) ext->close_action(kb); return LV_ACTION_RES_INV; } else if(strcmp(txt, "Ok") == 0) { - if(ext->ok_action) ext->ok_action(kb, NULL); + if(ext->ok_action) ext->ok_action(kb); return LV_ACTION_RES_INV; } else { lv_ta_add_text(ext->ta, txt); diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 644f8219c..04c4d6df9 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -189,7 +189,7 @@ bool lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) if(btn != NULL) { lv_action_t rel_action; rel_action = lv_btn_get_rel_action(btn); - if(rel_action != NULL) rel_action(btn, NULL); + if(rel_action != NULL) rel_action(btn); } } } diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index a414c6b7b..79d7ee089 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -135,7 +135,7 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) } } else if(sign == LV_SIGNAL_LONG_PRESS) { lv_mbox_start_auto_close(mbox, 0); - lv_dispi_wait_release(param); + lv_indev_wait_release(param); valid = false; } else if(sign == LV_SIGNAL_STYLE_CHG) { /*Refresh all the buttons*/ @@ -229,7 +229,7 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) if(btn != NULL) { lv_action_t rel_action; rel_action = lv_btn_get_rel_action(btn); - if(rel_action != NULL) rel_action(btn, NULL); + if(rel_action != NULL) rel_action(btn); } } } @@ -242,10 +242,9 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) /** * A release action which can be assigned to a message box button to close it * @param btn pointer to the released button - * @param dispi pointer to the caller display input * @return always lv_action_res_t because the button is deleted with the mesage box */ -lv_action_res_t lv_mbox_close_action(lv_obj_t * btn, lv_dispi_t * dispi) +lv_action_res_t lv_mbox_close_action(lv_obj_t * btn) { lv_obj_t * mbox = lv_mbox_get_from_btn(btn); diff --git a/lv_objx/lv_mbox.h b/lv_objx/lv_mbox.h index 261a5611a..b814d11a0 100644 --- a/lv_objx/lv_mbox.h +++ b/lv_objx/lv_mbox.h @@ -79,10 +79,9 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param); /** * A release action which can be assigned to a message box button to close it * @param btn pointer to the released button - * @param dispi pointer to the caller display input * @return always lv_action_res_t because the button is deleted with the mesage box */ -lv_action_res_t lv_mbox_close_action(lv_obj_t * btn, lv_dispi_t * dispi); +lv_action_res_t lv_mbox_close_action(lv_obj_t * btn); /** * Add a button to the message box diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index fa95a22c0..e28a44d9e 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -188,12 +188,12 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } } else if(sign == LV_SIGNAL_PRESSED) { if(ext->pr_action != NULL) { - ext->pr_action(page, param); + ext->pr_action(page); } } else if(sign == LV_SIGNAL_RELEASED) { - if(lv_dispi_is_dragging(param) == false) { + if(lv_indev_is_dragging(param) == false) { if(ext->rel_action != NULL) { - ext->rel_action(page, param); + ext->rel_action(page); } } } @@ -317,12 +317,12 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param) } }else if(sign == LV_SIGNAL_PRESSED) { if(page_ext->pr_action != NULL) { - page_ext->pr_action(page, param); + page_ext->pr_action(page); } } else if(sign == LV_SIGNAL_RELEASED) { - if(lv_dispi_is_dragging(param) == false) { + if(lv_indev_is_dragging(param) == false) { if(page_ext->rel_action != NULL) { - page_ext->rel_action(page, param); + page_ext->rel_action(page); } } } diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index d3f20e011..eb39f570e 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -22,7 +22,7 @@ extern "C" { #endif #include "lv_cont.h" -#include "../lv_obj/lv_dispi.h" +#include "../lv_obj/lv_indev.h" /********************* * DEFINES diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 53c5458cc..d7a6a4d5c 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -24,7 +24,7 @@ * STATIC PROTOTYPES **********************/ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_mode_t mode); -static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param); +static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * indev); /********************** * STATIC VARIABLES @@ -223,6 +223,7 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * /* The object can be deleted so check its validity and then * make the object specific signal handling */ if(valid != false) { + lv_indev_t * indev = lv_indev_get_act(); int32_t id = -1; lv_obj_t * roller = lv_obj_get_parent(roller_scrl); lv_roller_ext_t * ext = lv_obj_get_ext(roller); @@ -241,9 +242,9 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * } else if(sign == LV_SIGNAL_RELEASED) { /*If picked an option by clicking then set it*/ - if(!lv_dispi_is_dragging(param)) { + if(!lv_indev_is_dragging(indev)) { point_t p; - lv_dispi_get_point(param, &p); + lv_indev_get_point(indev, &p); p.y = p.y - ext->ddlist.opt_label->cords.y1; id = p.y / (font_h + style_label->line_space); if(id < 0) id = 0; diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index b50f5d4b8..a425d2963 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -120,7 +120,7 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param) ext->tmp_value = lv_bar_get_value(slider); } else if(sign == LV_SIGNAL_PRESSING) { - lv_dispi_get_point(param, &p); + lv_indev_get_point(param, &p); if(w > h) { cord_t knob_w = h; p.x -= slider->cords.x1 + h / 2; /*Modify the point to shift with half knob (important on the start and end)*/ @@ -140,7 +140,7 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param) else if (sign == LV_SIGNAL_RELEASED) { ext->tmp_value = lv_bar_get_value(slider); lv_bar_set_value(slider, ext->tmp_value); - if(ext->cb != NULL) ext->cb(slider, param); + if(ext->cb != NULL) ext->cb(slider); } else if(sign == LV_SIGNAL_CORD_CHG) { /* The knob size depends on slider size. @@ -167,10 +167,10 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param) char c = *((char*)param); if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_UP) { lv_bar_set_value(slider, lv_bar_get_value(slider) + 1); - if(ext->cb != NULL) ext->cb(slider, NULL); + if(ext->cb != NULL) ext->cb(slider); } else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_DOWN) { lv_bar_set_value(slider, lv_bar_get_value(slider) - 1); - if(ext->cb != NULL) ext->cb(slider, NULL); + if(ext->cb != NULL) ext->cb(slider); } } } diff --git a/lv_objx/lv_sw.c b/lv_objx/lv_sw.c index 85572117c..b7e860047 100644 --- a/lv_objx/lv_sw.c +++ b/lv_objx/lv_sw.c @@ -119,7 +119,7 @@ bool lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) if(v == 0) lv_bar_set_value(sw, 1); else lv_bar_set_value(sw, 0); } - if(slider_cb != NULL) slider_cb(sw, param); + if(slider_cb != NULL) slider_cb(sw); ext->changed = 0; } diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index aee40ab07..1f7334987 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -31,9 +31,9 @@ static bool lv_tab_design(lv_obj_t * tab, const area_t * mask, lv_design_mode_t static bool tabpage_signal(lv_obj_t * tab_page, lv_signal_t sign, void * param); static bool tabscrl_signal(lv_obj_t * tab_scrl, lv_signal_t sign, void * param); -static void tabpage_pressed_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_dispi_t * dispi); -static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_dispi_t * dispi); -static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_dispi_t * dispi); +static void tabpage_pressed_hadler(lv_obj_t * tabview, lv_obj_t * tabpage); +static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage); +static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage); static lv_action_res_t tab_btnm_action(lv_obj_t * tab_btnm, uint16_t id); /********************** @@ -439,13 +439,13 @@ static bool tabpage_signal(lv_obj_t * tab_page, lv_signal_t sign, void * param) lv_obj_t * cont = lv_obj_get_parent(tab_page); lv_obj_t * tab = lv_obj_get_parent(cont); if(sign == LV_SIGNAL_PRESSED) { - tabpage_pressed_hadler(tab, tab_page, param); + tabpage_pressed_hadler(tab, tab_page); } else if(sign == LV_SIGNAL_PRESSING) { - tabpage_pressing_hadler(tab, tab_page, param); + tabpage_pressing_hadler(tab, tab_page); } else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) { - tabpage_press_lost_hadler(tab, tab_page, param); + tabpage_press_lost_hadler(tab, tab_page); } } @@ -473,13 +473,13 @@ static bool tabscrl_signal(lv_obj_t * tab_scrl, lv_signal_t sign, void * param) lv_obj_t * cont = lv_obj_get_parent(tab_page); lv_obj_t * tab = lv_obj_get_parent(cont); if(sign == LV_SIGNAL_PRESSED) { - tabpage_pressed_hadler(tab, tab_page, param); + tabpage_pressed_hadler(tab, tab_page); } else if(sign == LV_SIGNAL_PRESSING) { - tabpage_pressing_hadler(tab, tab_page, param); + tabpage_pressing_hadler(tab, tab_page); } else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) { - tabpage_press_lost_hadler(tab, tab_page, param); + tabpage_press_lost_hadler(tab, tab_page); } } @@ -491,34 +491,34 @@ static bool tabscrl_signal(lv_obj_t * tab_scrl, lv_signal_t sign, void * param) * Called when a tab's page or scrollable object is pressed * @param tabview pointer to the tab view object * @param tabpage pointer to the page of a tab - * @param dispi pointer to the caller dispi */ -static void tabpage_pressed_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_dispi_t * dispi) +static void tabpage_pressed_hadler(lv_obj_t * tabview, lv_obj_t * tabpage) { lv_tabview_ext_t * ext = lv_obj_get_ext(tabview); - lv_dispi_get_point(dispi, &ext->point_last); + lv_indev_t * indev = lv_indev_get_act(); + lv_indev_get_point(indev, &ext->point_last); } /** * Called when a tab's page or scrollable object is being pressed * @param tabview pointer to the tab view object * @param tabpage pointer to the page of a tab - * @param dispi pointer to the caller dispi */ -static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_dispi_t * dispi) +static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage) { lv_tabview_ext_t * ext = lv_obj_get_ext(tabview); + lv_indev_t * indev = lv_indev_get_act(); point_t point_act; - lv_dispi_get_point(dispi, &point_act); + lv_indev_get_point(indev, &point_act); cord_t x_diff = point_act.x - ext->point_last.x; cord_t y_diff = point_act.y - ext->point_last.y; if(ext->draging == 0) { - if(x_diff >= LV_DISPI_DRAG_LIMIT || x_diff<= -LV_DISPI_DRAG_LIMIT) { + if(x_diff >= LV_indev_proc_DRAG_LIMIT || x_diff<= -LV_indev_proc_DRAG_LIMIT) { ext->drag_h = 1; ext->draging = 1; lv_obj_set_drag(lv_page_get_scrl(tabpage), false); - } else if(y_diff >= LV_DISPI_DRAG_LIMIT || y_diff <= -LV_DISPI_DRAG_LIMIT) { + } else if(y_diff >= LV_indev_proc_DRAG_LIMIT || y_diff <= -LV_indev_proc_DRAG_LIMIT) { ext->drag_h = 0; ext->draging = 1; } @@ -542,9 +542,8 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_d * Called when a tab's page or scrollable object is released or the press id lost * @param tabview pointer to the tab view object * @param tabpage pointer to the page of a tab - * @param dispi pointer to the caller dispi */ -static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv_dispi_t * dispi) +static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage) { lv_tabview_ext_t * ext = lv_obj_get_ext(tabview); ext->drag_h = 0; @@ -552,14 +551,15 @@ static void tabpage_press_lost_hadler(lv_obj_t * tabview, lv_obj_t * tabpage, lv lv_obj_set_drag(lv_page_get_scrl(tabpage), true); + lv_indev_t * indev = lv_indev_get_act(); point_t point_act; - lv_dispi_get_point(dispi, &point_act); + lv_indev_get_point(indev, &point_act); cord_t x_diff = point_act.x - ext->point_last.x; cord_t x_predict = 0; while(x_diff != 0) { x_predict += x_diff; - x_diff = x_diff * (100 - LV_DISPI_DRAG_THROW) / 100; + x_diff = x_diff * (100 - LV_indev_proc_DRAG_THROW) / 100; } diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 5a9fb34e3..8ce1a697a 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -226,10 +226,9 @@ lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t re /** * A release action which can be assigned to a window control button to close it * @param btn pointer to the released button - * @param dispi pointer to the caller display input * @return always LV_ACTION_RES_INV because the button is deleted with the window */ -lv_action_res_t lv_win_close_action(lv_obj_t * btn, lv_dispi_t * dispi) +lv_action_res_t lv_win_close_action(lv_obj_t * btn) { lv_obj_t * win = lv_win_get_from_cbtn(btn); diff --git a/lv_objx/lv_win.h b/lv_objx/lv_win.h index 9ea051359..d4b651c65 100644 --- a/lv_objx/lv_win.h +++ b/lv_objx/lv_win.h @@ -97,10 +97,10 @@ lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t re /** * A release action which can be assigned to a window control button to close it * @param btn pointer to the released button - * @param dispi pointer to the caller display input + * @param indev_proc pointer to the caller input device * @return always LV_ACTION_RES_INV because the button is deleted with the window */ -lv_action_res_t lv_win_close_action(lv_obj_t * btn, lv_dispi_t * dispi); +lv_action_res_t lv_win_close_action(lv_obj_t * btn); /** * Set the title of a window diff --git a/lvgl.h b/lvgl.h index ef7144498..3902b6b30 100644 --- a/lvgl.h +++ b/lvgl.h @@ -16,6 +16,7 @@ extern "C" { /*Test misc. module version*/ #include "misc/misc.h" +#include "lv_hal/lv_hal.h" #include "lv_obj/lv_obj.h" #include "lv_obj/lv_group.h" #include "lv_objx/lv_btn.h"