1 #include "../../lv_examples.h"
2 #if LV_USE_QRCODE && LV_BUILD_EXAMPLES
3
4 /**
5 * Create a QR Code
6 */
lv_example_qrcode_1(void)7 void lv_example_qrcode_1(void)
8 {
9 lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
10 lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
11
12 lv_obj_t * qr = lv_qrcode_create(lv_scr_act(), 150, fg_color, bg_color);
13
14 /*Set data*/
15 const char * data = "https://lvgl.io";
16 lv_qrcode_update(qr, data, strlen(data));
17 lv_obj_center(qr);
18
19 /*Add a border with bg_color*/
20 lv_obj_set_style_border_color(qr, bg_color, 0);
21 lv_obj_set_style_border_width(qr, 5, 0);
22 }
23
24 #endif
25
26
27
28
29
30
31
32
33