lv_qrcode.h

API reference for lv_qrcode.h

Report on GitHub
See Also: Private HeaderThis header has a companion private implementation with internal data structures.lv_qrcode_private.h

Functions

lv_qrcode_set_size

Set QR code size.

 
void lv_qrcode_set_size(lv_obj_t *obj, int32_t size)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a QR code object
sizeint32_twidth and height of the QR code

lv_qrcode_set_dark_color

Set QR code dark color.

 
void lv_qrcode_set_dark_color(lv_obj_t *obj, lv_color_t color)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a QR code object
colorlv_color_tdark color of the QR code

lv_qrcode_set_light_color

Set QR code light color.

 
void lv_qrcode_set_light_color(lv_obj_t *obj, lv_color_t color)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a QR code object
colorlv_color_tlight color of the QR code

lv_qrcode_set_data

Helper function to set the data of a QR code object from a string. The NUL terminator is not part of the encoded payload.

 
void lv_qrcode_set_data(lv_obj_t *obj, const char *data)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a QR code object
dataconst char *data to display as a NUL terminated string

lv_qrcode_set_quiet_zone

Enable or disable quiet zone. Quiet zone is the area around the QR code where no data is encoded.

 
void lv_qrcode_set_quiet_zone(lv_obj_t *obj, bool enable)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a QR code object
enablebooltrue: enable quiet zone; false: disable quiet zone

lv_qrcode_set_update_mode

Set when a property change is turned into a new QR code bitmap. With LV_QRCODE_UPDATE_MODE_IMMEDIATE (the default) changing the size or the quiet zone re-encodes the stored data right away. With LV_QRCODE_UPDATE_MODE_DEFERRED such a change only marks the bitmap as out of date and several changes are collapsed into a single re-encode on the next redraw.

 
void lv_qrcode_set_update_mode(lv_obj_t *obj, lv_qrcode_update_mode_t mode)
Parameters
NameTypeDescription
objlv_obj_t *pointer to a QR code object
modelv_qrcode_update_mode_tthe mode to use

In deferred mode you are expected to call lv_qrcode_render() yourself once the properties are set. It encodes right away and returns the result, leaving the next redraw nothing to do. If it is forgotten, the encode is done by the redraw instead: the bitmap is still correct, but the work is charged to that refresh and its result cannot be reported to anyone, so a warning is logged. Prefer the explicit call.

Switching back to LV_QRCODE_UPDATE_MODE_IMMEDIATE while the bitmap is out of date also re-encodes it, but this function returns void, so an encode failure can only be logged, not reported. A warning is emitted in that case. Call lv_qrcode_render() first and switch the mode afterwards to get the result.

Enums

lv_qrcode_update_mode_t

Controls when a property change is turned into a new QR code bitmap. Only the properties that require re-encoding (size, quiet zone) are affected; lv_qrcode_update() always encodes right away and the colors are always a palette-only write.

NameValueDescription
LV_QRCODE_UPDATE_MODE_IMMEDIATE0Re-encode as soon as a property changes (default)
LV_QRCODE_UPDATE_MODE_DEFERREDOnly mark the bitmap out of date and re-encode once, on the next redraw
Used by 1 function
  • lv_qrcode_set_update_mode — param mode

Variables

lv_qrcode_class

 
const lv_obj_class_t lv_qrcode_class

Dependencies

Last updated on

On this page