|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Functions | |
| void | packModule (uint8_t *out, uint16_t stride, uint8_t scale, uint8_t quiet, int mx, int my) |
| Sets the packed pixels of one black QR module. | |
| int | measure (const char *data, uint8_t max_version, uint8_t ecc, uint16_t *out_modules) |
| Measures the module count for data without rendering. | |
| int | render (const char *data, uint8_t max_version, uint8_t ecc, uint8_t scale, uint8_t quiet_modules, uint8_t *out, size_t out_size, uint16_t *out_stride_bytes, uint16_t *out_height_px) |
| Encodes data and packs it into a 1-bpp raster. | |
Variables | |
| constexpr uint16_t | QR_MAX_SIDE_PX = 1024 |
| Hard cap on the rendered side length in pixels (incl. quiet zone, scaled). | |
| int cdc::ui::qr::measure | ( | const char * | data, |
| uint8_t | max_version, | ||
| uint8_t | ecc, | ||
| uint16_t * | out_modules ) |
Measures the module count for data without rendering.
| data | NUL-terminated payload text. |
| max_version | Maximum QR version 1..20 (0 defaults to 20). |
| ecc | ECC level 0..3 (LOW..HIGH). |
| out_modules | Receives the side length in modules. |
Definition at line 73 of file QrRaster.cpp.
Referenced by host_qr_measure(), and render().
|
inline |
Sets the packed pixels of one black QR module.
Pure bit-packing shared by the firmware renderer and the host unit tests: module (mx, my) inks a scale x scale pixel block offset by the quiet zone. Rows are MSB-first, a set bit is black.
| out | Packed raster, stride bytes per row, pre-cleared to white. |
| stride | Bytes per row. |
| scale | Pixels per module, >= 1. |
| quiet | Quiet-zone width in modules per edge. |
| mx | Module column. |
| my | Module row. |
Definition at line 33 of file QrRaster.h.
References cdc::ui::scale.
| int cdc::ui::qr::render | ( | const char * | data, |
| uint8_t | max_version, | ||
| uint8_t | ecc, | ||
| uint8_t | scale, | ||
| uint8_t | quiet_modules, | ||
| uint8_t * | out, | ||
| size_t | out_size, | ||
| uint16_t * | out_stride_bytes, | ||
| uint16_t * | out_height_px ) |
Encodes data and packs it into a 1-bpp raster.
The rendered side is (modules + 2 * quiet_modules) * scale pixels; the quiet zone is white. Rows are packed MSB-first with a set bit meaning black.
| data | NUL-terminated payload text. |
| max_version | Maximum QR version 1..20 (0 defaults to 20). |
| ecc | ECC level 0..3 (LOW..HIGH). |
| scale | Pixels per module, >= 1. |
| quiet_modules | Quiet-zone width in modules per edge. |
| out | Caller buffer for the packed rows. |
| out_size | Capacity of out in bytes. |
| out_stride_bytes | Receives the row stride (side_px + 7) / 8. |
| out_height_px | Receives the side length in pixels. |
Definition at line 84 of file QrRaster.cpp.
References measure(), QR_MAX_SIDE_PX, and cdc::ui::scale.
Referenced by host_qr_render_bitmap().
|
inlineconstexpr |
Hard cap on the rendered side length in pixels (incl. quiet zone, scaled).
Definition at line 18 of file QrRaster.h.
Referenced by render().