ESPHome  2024.5.5
qr_code.h
Go to the documentation of this file.
1 #pragma once
3 #include "esphome/core/color.h"
4 
5 #include <cstdint>
6 
7 #include "qrcodegen.h"
8 
9 namespace esphome {
10 // forward declare DisplayBuffer
11 namespace display {
12 class Display;
13 } // namespace display
14 
15 namespace qr_code {
16 class QrCode : public Component {
17  public:
18  void draw(display::Display *buff, uint16_t x_offset, uint16_t y_offset, Color color, int scale);
19 
20  void dump_config() override;
21 
22  void set_value(const std::string &value);
23  void set_ecc(qrcodegen_Ecc ecc);
24 
25  void generate_qr_code();
26 
27  uint8_t get_size();
28 
29  protected:
30  std::string value_;
31  qrcodegen_Ecc ecc_;
32  bool needs_update_ = true;
33  uint8_t qr_[qrcodegen_BUFFER_LEN_MAX];
34 };
35 } // namespace qr_code
36 } // namespace esphome
std::string value_
Definition: qr_code.h:30
qrcodegen_Ecc ecc_
Definition: qr_code.h:31
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7