Error: lvalue required as unary '&' operand #define LV_FONT_MONTSERRAT_14 1

Hello All

My code:

#include “Arduino_H7_Video.h”
#include “Arduino_GigaDisplayTouch.h”
#include "lvgl.h "

Arduino_H7_Video Display(800, 480, GigaDisplayShield); /* Arduino_H7_Video Display(1024, 768, USBCVideo); */
Arduino_GigaDisplayTouch TouchDetector;

void setup() {
Serial.begin(115200);

Display.begin();
TouchDetector.begin();

static lv_style_t style_sel;
lv_style_init(&style_sel);
lv_style_set_text_font(&style_sel, &LV_FONT_MONTSERRAT_14); <— error!
lv_style_set_bg_color(&style_sel, lv_color_hex3(0xf88));
lv_style_set_border_width(&style_sel, 2);
lv_style_set_border_color(&style_sel, lv_color_hex3(0xf00));
}

c:\Users\SERVER\Documents\Arduino\libraries\ lv_conf.h

/*==================

  • FONT USAGE
    ===================/

#define LV_FONT_MONTSERRAT_8 1
#define LV_FONT_MONTSERRAT_10 1
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 1
#define LV_FONT_MONTSERRAT_18 1
#define LV_FONT_MONTSERRAT_20 1
#define LV_FONT_MONTSERRAT_22 1
#define LV_FONT_MONTSERRAT_24 1
#define LV_FONT_MONTSERRAT_26 1
#define LV_FONT_MONTSERRAT_28 1
#define LV_FONT_MONTSERRAT_30 1
#define LV_FONT_MONTSERRAT_32 1
#define LV_FONT_MONTSERRAT_34 1
#define LV_FONT_MONTSERRAT_36 1
#define LV_FONT_MONTSERRAT_38 1
#define LV_FONT_MONTSERRAT_40 1
#define LV_FONT_MONTSERRAT_42 1
#define LV_FONT_MONTSERRAT_44 1
#define LV_FONT_MONTSERRAT_46 1
#define LV_FONT_MONTSERRAT_48 1

/Always set a default font/
#define LV_FONT_DEFAULT &lv_font_montserrat_14

When compiling, an error occurs: /Always set a default font/
#define LV_FONT_DEFAULT &lv_font_montserrat_14

Tell me why it occurs?

Usage fonts too much.
You need to allow only used.
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0

#define LV_FONT_MONTSERRAT_48 0

1 Like

Thank you very much. Everything worked.
It turns out that you can only use one font size in an application?

Large font size occupies a lot of memory. It is necessary to determine the quantity experimentally.
(UA) Щось мені здається що ви маєте розуміти українську))) Так от, великі шрифти займають багацько місця, тому з ними бажано бути уважним. Зазвичай десь п’ять розмірів можна впхати, але то все експеріментально. Успіху!

1 Like