9 static const char *
const TAG =
"qr_code";
12 ESP_LOGCONFIG(TAG,
"QR code:");
13 ESP_LOGCONFIG(TAG,
" Value: '%s'", this->
value_.c_str());
27 ESP_LOGV(TAG,
"Generating QR code...");
28 uint8_t tempbuffer[qrcodegen_BUFFER_LEN_MAX];
30 if (!qrcodegen_encodeText(this->
value_.c_str(), tempbuffer, this->
qr_, this->
ecc_, qrcodegen_VERSION_MIN,
31 qrcodegen_VERSION_MAX, qrcodegen_Mask_AUTO,
true)) {
32 ESP_LOGE(TAG,
"Failed to generate QR code");
37 ESP_LOGV(TAG,
"Drawing QR code at (%d, %d)", x_offset, y_offset);
44 uint8_t qrcode_width = qrcodegen_getSize(this->
qr_);
46 for (
int y = 0;
y < qrcode_width * scale;
y++) {
47 for (
int x = 0;
x < qrcode_width * scale;
x++) {
48 if (qrcodegen_getModule(this->
qr_,
x / scale,
y / scale)) {
61 uint8_t size = qrcodegen_getSize(this->
qr_);
void dump_config() override
uint8_t qr_[qrcodegen_BUFFER_LEN_MAX]
void draw(display::Display *buff, uint16_t x_offset, uint16_t y_offset, Color color, int scale)
void draw_pixel_at(int x, int y)
Set a single pixel at the specified coordinates to default color.
Implementation of SPI Controller mode.
void set_ecc(qrcodegen_Ecc ecc)
void set_value(const std::string &value)