btnm: introduce lv_btnm_set_pressed API
This commit is contained in:
@@ -303,6 +303,25 @@ void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_action_t action)
|
|||||||
ext->action = action;
|
ext->action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the pressed button
|
||||||
|
* @param btnm pointer to button matrix object
|
||||||
|
* @param id index of the currently pressed button (`LV_BTNM_PR_NONE` to unpress)
|
||||||
|
*/
|
||||||
|
void lv_btnm_set_pressed(const lv_obj_t * btnm, uint16_t id)
|
||||||
|
{
|
||||||
|
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||||
|
|
||||||
|
if (id >= ext->btn_cnt && id != LV_BTNM_PR_NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (id == ext->btn_id_pr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ext->btn_id_pr = id;
|
||||||
|
lv_obj_invalidate(btnm);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable button toggling
|
* Enable or disable button toggling
|
||||||
* @param btnm pointer to button matrix object
|
* @param btnm pointer to button matrix object
|
||||||
|
|||||||
@@ -141,6 +141,13 @@ void lv_btnm_set_ctrl_map(const lv_obj_t * btnm, const lv_btnm_ctrl_t * ctrl_map
|
|||||||
*/
|
*/
|
||||||
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_action_t action);
|
void lv_btnm_set_action(lv_obj_t * btnm, lv_btnm_action_t action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the pressed button
|
||||||
|
* @param btnm pointer to button matrix object
|
||||||
|
* @param id index of the currently pressed button (`LV_BTNM_PR_NONE` to unpress)
|
||||||
|
*/
|
||||||
|
void lv_btnm_set_pressed(const lv_obj_t * btnm, uint16_t id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable button toggling
|
* Enable or disable button toggling
|
||||||
* @param btnm pointer to button matrix object
|
* @param btnm pointer to button matrix object
|
||||||
|
|||||||
Reference in New Issue
Block a user