This commit is contained in:
kraus 2023-06-11 13:55:13 +02:00
parent 9e39e9c9ab
commit 8c484eb824
1 changed files with 10 additions and 34 deletions

View File

@ -130,17 +130,26 @@ struct mui_u8g2_u8_min_max_step_struct
uint8_t max;
uint8_t step;
uint8_t flags;
uint8_t width; // added with issue 2200, might not be used by all bar graph functions
} MUI_PROGMEM;
typedef const struct mui_u8g2_u8_min_max_step_struct mui_u8g2_u8_min_max_step_t;
/* list of bit values for the "flags" variable */
#define MUI_MMS_2X_BAR 0x01
#define MUI_MMS_4X_BAR 0x02
#define MUI_MMS_SHOW_VALUE 0x04
#define MUI_MMS_NO_WRAP 0x08
#if defined(__GNUC__) && defined(__AVR__)
# define mui_u8g2_u8mms_get_width(u8mm) mui_pgm_read(&((u8mm)->width))
# define mui_u8g2_u8mms_get_step(u8mm) mui_pgm_read(&((u8mm)->step))
# define mui_u8g2_u8mms_get_flags(u8mm) mui_pgm_read(&((u8mm)->flags))
# define mui_u8g2_u8mms_get_min(u8mm) mui_pgm_read(&((u8mm)->min))
# define mui_u8g2_u8mms_get_max(u8mm) mui_pgm_read(&((u8mm)->max))
# define mui_u8g2_u8mms_get_valptr(u8mm) ((uint8_t *)mui_pgm_wread(&((u8mm)->value)))
#else
# define mui_u8g2_u8mms_get_width(u8mm) ((u8mm)->width)
# define mui_u8g2_u8mms_get_step(u8mm) ((u8mm)->step)
# define mui_u8g2_u8mms_get_flags(u8mm) ((u8mm)->flags)
# define mui_u8g2_u8mms_get_min(u8mm) ((u8mm)->min)
@ -149,33 +158,6 @@ typedef const struct mui_u8g2_u8_min_max_step_struct mui_u8g2_u8_min_max_step_t;
#endif
struct mui_u8g2_u8_min_max_width_step_struct
{
uint8_t *value;
uint8_t min;
uint8_t max;
uint8_t width;
uint8_t step;
uint8_t flags;
} MUI_PROGMEM;
typedef const struct mui_u8g2_u8_min_max_width_step_struct mui_u8g2_u8_min_max_width_step_t;
#if defined(__GNUC__) && defined(__AVR__)
# define mui_u8g2_u8mmws_get_step(u8mm) mui_pgm_read(&((u8mm)->step))
# define mui_u8g2_u8mmws_get_width(u8mm) mui_pgm_read(&((u8mm)->width))
# define mui_u8g2_u8mmws_get_flags(u8mm) mui_pgm_read(&((u8mm)->flags))
# define mui_u8g2_u8mmws_get_min(u8mm) mui_pgm_read(&((u8mm)->min))
# define mui_u8g2_u8mmws_get_max(u8mm) mui_pgm_read(&((u8mm)->max))
# define mui_u8g2_u8mmws_get_valptr(u8mm) ((uint8_t *)mui_pgm_wread(&((u8mm)->value)))
#else
# define mui_u8g2_u8mmws_get_step(u8mm) ((u8mm)->step)
# define mui_u8g2_u8mmws_get_width(u8mm) ((u8mm)->width)
# define mui_u8g2_u8mmws_get_flags(u8mm) ((u8mm)->flags)
# define mui_u8g2_u8mmws_get_min(u8mm) ((u8mm)->min)
# define mui_u8g2_u8mmws_get_max(u8mm) ((u8mm)->max)
# define mui_u8g2_u8mmws_get_valptr(u8mm) ((u8mm)->value)
#endif
/* helper functions */
@ -274,14 +256,9 @@ uint8_t mui_u8g2_u8_min_max_wm_mud_pf(mui_t *ui, uint8_t msg); /* GIF, MUIF_U8G
/* gcc note: the macro uses array compound literals to extend the lifetime in C++, see last section in https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html */
#define MUIF_U8G2_U8_MIN_MAX_STEP(id, valptr, min, max, step, flags, muif) \
MUIF(id, MUIF_CFLAG_IS_CURSOR_SELECTABLE, \
(void *)((mui_u8g2_u8_min_max_step_t [] ) {{ (valptr) MUI_U8G2_COMMA (min) MUI_U8G2_COMMA (max) MUI_U8G2_COMMA (step) MUI_U8G2_COMMA (flags) }}), \
(void *)((mui_u8g2_u8_min_max_step_t [] ) {{ (valptr) MUI_U8G2_COMMA (min) MUI_U8G2_COMMA (max) MUI_U8G2_COMMA (step) MUI_U8G2_COMMA (flags) MUI_U8G2_COMMA (0) }}), \
(muif))
#define MUI_MMS_2X_BAR 0x01
#define MUI_MMS_4X_BAR 0x02
#define MUI_MMS_SHOW_VALUE 0x04
#define MUI_MMS_NO_WRAP 0x08
uint8_t mui_u8g2_u8_bar_wm_mse_pi(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_bar_wm_mud_pi(mui_t *ui, uint8_t msg);
@ -289,7 +266,6 @@ uint8_t mui_u8g2_u8_bar_wm_mse_pf(mui_t *ui, uint8_t msg);
uint8_t mui_u8g2_u8_bar_wm_mud_pf(mui_t *ui, uint8_t msg);
/*===== data = mui_u8g2_u8_min_max_width_step_t* =====*/
/*===== data = mui_u8g2_list_t* =====*/