summaryrefslogtreecommitdiff
path: root/firmware/2lib/include
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/2lib/include')
-rw-r--r--firmware/2lib/include/2api.h12
-rw-r--r--firmware/2lib/include/2ui.h16
2 files changed, 24 insertions, 4 deletions
diff --git a/firmware/2lib/include/2api.h b/firmware/2lib/include/2api.h
index 67b5074a..b4dfadf8 100644
--- a/firmware/2lib/include/2api.h
+++ b/firmware/2lib/include/2api.h
@@ -1293,6 +1293,11 @@ vb2_error_t vb2ex_ec_battery_cutoff(void);
/*****************************************************************************/
/* Functions for UI display. */
+/* Helpers for bitmask operations */
+#define VB2_SET_BIT(mask, index) ((mask) |= ((uint32_t)1 << (index)))
+#define VB2_CLR_BIT(mask, index) ((mask) &= ~((uint32_t)1 << (index)))
+#define VB2_GET_BIT(mask, index) ((mask) & ((uint32_t)1 << (index)))
+
/* Screens. */
enum vb2_screen {
/* Blank screen */
@@ -1375,6 +1380,12 @@ enum vb2_ui_error {
* doesn't have a menu, this value will be ignored.
* @param disabled_item_mask Mask for disabled menu items. Bit (1 << idx)
* indicates whether item 'idx' is disabled.
+ * A disabled menu item is visible and selectable,
+ * with a different button style.
+ * @param hidden_item_mask Mask for hidden menu items. Bit (1 << idx)
+ * indicates whether item 'idx' is hidden.
+ * A hidden menu item is neither visible nor
+ * selectable.
* @param timer_disabled Whether timer is disabled or not. Some screen
* descriptions will depend on this value.
* @param current_page Current page number for a log screen. If the
@@ -1387,6 +1398,7 @@ vb2_error_t vb2ex_display_ui(enum vb2_screen screen,
uint32_t locale_id,
uint32_t selected_item,
uint32_t disabled_item_mask,
+ uint32_t hidden_item_mask,
int timer_disabled,
uint32_t current_page,
enum vb2_ui_error error_code);
diff --git a/firmware/2lib/include/2ui.h b/firmware/2lib/include/2ui.h
index 2fefaf32..d8c38470 100644
--- a/firmware/2lib/include/2ui.h
+++ b/firmware/2lib/include/2ui.h
@@ -59,12 +59,20 @@ struct vb2_screen_info {
* will be ignored.
*/
const struct vb2_menu *(*get_menu)(struct vb2_ui_context *ui);
+ /*
+ * Indices of menu items;
+ * used by log_page_* functions in 2ui_screens.c.
+ */
+ uint32_t page_up_item;
+ uint32_t page_down_item;
+ uint32_t back_item;
};
struct vb2_screen_state {
const struct vb2_screen_info *screen;
uint32_t selected_item;
uint32_t disabled_item_mask;
+ uint32_t hidden_item_mask;
/* For log screen. */
uint32_t page_count;
@@ -139,8 +147,8 @@ const struct vb2_screen_info *vb2_get_screen_info(enum vb2_screen id);
/**
* Move selection to the previous menu item.
*
- * Update selected_item, taking into account disabled indices (from
- * disabled_item_mask). The selection does not wrap, meaning that we block
+ * Update selected_item, taking into account hidden indices (from
+ * hidden_item_mask). The selection does not wrap, meaning that we block
* on 0 when we hit the start of the menu.
*
* @param ui UI context pointer
@@ -151,8 +159,8 @@ vb2_error_t vb2_ui_menu_prev(struct vb2_ui_context *ui);
/**
* Move selection to the next menu item.
*
- * Update selected_item, taking into account disabled indices (from
- * disabled_item_mask). The selection does not wrap, meaning that we block
+ * Update selected_item, taking into account hidden indices (from
+ * hidden_item_mask). The selection does not wrap, meaning that we block
* on the max index when we hit the end of the menu.
*
* @param ui UI context pointer