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