1 /** 2 * @file lv_barcode.h 3 * 4 */ 5 6 #ifndef LV_BARCODE_H 7 #define LV_BARCODE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 #include "../../lv_conf_internal.h" 17 #include "../../misc/lv_types.h" 18 #include "../../misc/lv_color.h" 19 #include "../../widgets/canvas/lv_canvas.h" 20 21 #if LV_USE_BARCODE 22 23 /********************* 24 * DEFINES 25 *********************/ 26 27 /********************** 28 * TYPEDEFS 29 **********************/ 30 31 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_barcode_class; 32 33 /********************** 34 * GLOBAL PROTOTYPES 35 **********************/ 36 37 /** 38 * Create an empty barcode (an `lv_canvas`) object. 39 * @param parent point to an object where to create the barcode 40 * @return pointer to the created barcode object 41 */ 42 lv_obj_t * lv_barcode_create(lv_obj_t * parent); 43 44 /** 45 * Set the dark color of a barcode object 46 * @param obj pointer to barcode object 47 * @param color dark color of the barcode 48 */ 49 void lv_barcode_set_dark_color(lv_obj_t * obj, lv_color_t color); 50 51 /** 52 * Set the light color of a barcode object 53 * @param obj pointer to barcode object 54 * @param color light color of the barcode 55 */ 56 void lv_barcode_set_light_color(lv_obj_t * obj, lv_color_t color); 57 58 /** 59 * Set the scale of a barcode object 60 * @param obj pointer to barcode object 61 * @param scale scale factor 62 */ 63 void lv_barcode_set_scale(lv_obj_t * obj, uint16_t scale); 64 65 /** 66 * Set the direction of a barcode object 67 * @param obj pointer to barcode object 68 * @param direction draw direction (`LV_DIR_HOR` or `LB_DIR_VER`) 69 */ 70 void lv_barcode_set_direction(lv_obj_t * obj, lv_dir_t direction); 71 72 /** 73 * Set the tiled mode of a barcode object 74 * @param obj pointer to barcode object 75 * @param tiled true: tiled mode, false: normal mode (default) 76 */ 77 void lv_barcode_set_tiled(lv_obj_t * obj, bool tiled); 78 79 /** 80 * Set the data of a barcode object 81 * @param obj pointer to barcode object 82 * @param data data to display 83 * @return LV_RESULT_OK: if no error; LV_RESULT_INVALID: on error 84 */ 85 lv_result_t lv_barcode_update(lv_obj_t * obj, const char * data); 86 87 /** 88 * Get the dark color of a barcode object 89 * @param obj pointer to barcode object 90 * @return dark color of the barcode 91 */ 92 lv_color_t lv_barcode_get_dark_color(lv_obj_t * obj); 93 94 /** 95 * Get the light color of a barcode object 96 * @param obj pointer to barcode object 97 * @return light color of the barcode 98 */ 99 lv_color_t lv_barcode_get_light_color(lv_obj_t * obj); 100 101 /** 102 * Get the scale of a barcode object 103 * @param obj pointer to barcode object 104 * @return scale factor 105 */ 106 uint16_t lv_barcode_get_scale(lv_obj_t * obj); 107 108 /********************** 109 * MACROS 110 **********************/ 111 112 #endif /*LV_USE_BARCODE*/ 113 114 #ifdef __cplusplus 115 } /* extern "C" */ 116 #endif 117 118 #endif /*LV_BARCODE_H*/ 119