add some code

This commit is contained in:
2025-09-05 13:25:11 +08:00
parent 9ff0a99e7a
commit 3cf1229a85
8911 changed files with 2535396 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
Create a Barcode
----------------
.. lv_example:: libs/barcode/lv_example_barcode_1
:language: c

View File

@@ -0,0 +1,38 @@
/**
* @file lv_example_barcode.h
*
*/
#ifndef LV_EXAMPLE_BARCODE_H
#define LV_EXAMPLE_BARCODE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_example_barcode_1(void);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_EXAMPLE_BARCODE_H*/

View File

@@ -0,0 +1,27 @@
#include "../../lv_examples.h"
#if LV_USE_BARCODE && LV_BUILD_EXAMPLES
/**
* Create a Barcode
*/
void lv_example_barcode_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 * barcode = lv_barcode_create(lv_screen_active());
lv_obj_set_height(barcode, 50);
lv_obj_center(barcode);
/*Set color*/
lv_barcode_set_dark_color(barcode, fg_color);
lv_barcode_set_light_color(barcode, bg_color);
/*Add a border with bg_color*/
lv_obj_set_style_border_color(barcode, bg_color, 0);
/*Set data*/
lv_barcode_update(barcode, "https://lvgl.io");
}
#endif