mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-16 19:38:56 +00:00
v1.0.3
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
Create a QR Code
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
.. lv_example:: libs/qrcode/lv_example_qrcode_1
|
||||
:language: c
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @file lv_example_qrcode.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_EXAMPLE_QRCODE_H
|
||||
#define LV_EXAMPLE_QRCODE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_example_qrcode_1(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*LV_EXAMPLE_QRCODE_H*/
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_QRCODE && LV_BUILD_EXAMPLES
|
||||
|
||||
/**
|
||||
* Create a QR Code
|
||||
*/
|
||||
void lv_example_qrcode_1(void)
|
||||
{
|
||||
lv_color_t bg_color = lv_palette_lighten(LV_PALETTE_LIGHT_BLUE, 5);
|
||||
lv_color_t fg_color = lv_palette_darken(LV_PALETTE_BLUE, 4);
|
||||
|
||||
lv_obj_t * qr = lv_qrcode_create(lv_scr_act(), 150, fg_color, bg_color);
|
||||
|
||||
/*Set data*/
|
||||
const char * data = "https://lvgl.io";
|
||||
lv_qrcode_update(qr, data, strlen(data));
|
||||
lv_obj_center(qr);
|
||||
|
||||
/*Add a border with bg_color*/
|
||||
lv_obj_set_style_border_color(qr, bg_color, 0);
|
||||
lv_obj_set_style_border_width(qr, 5, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/opt/bin/lv_micropython -i
|
||||
import lvgl as lv
|
||||
import display_driver
|
||||
|
||||
bg_color = lv.palette_lighten(lv.PALETTE.LIGHT_BLUE, 5)
|
||||
fg_color = lv.palette_darken(lv.PALETTE.BLUE, 4)
|
||||
|
||||
qr = lv.qrcode(lv.scr_act(), 150, fg_color, bg_color)
|
||||
# Set data
|
||||
data = "https://lvgl.io"
|
||||
qr.update(data,len(data))
|
||||
qr.center()
|
||||
# Add a border with bg_color
|
||||
qr.set_style_border_color(bg_color, 0)
|
||||
qr.set_style_border_width(5, 0)
|
||||
Reference in New Issue
Block a user