ESPHome  2022.8.0
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 DisplayBuffer;
13 } // namespace display
14 
15 namespace qr_code {
16 class QrCode : public Component {
17  public:
18  void draw(display::DisplayBuffer *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  protected:
28  std::string value_;
29  qrcodegen_Ecc ecc_;
30  bool needs_update_ = true;
31  uint8_t qr_[qrcodegen_BUFFER_LEN_MAX];
32 };
33 } // namespace qr_code
34 } // namespace esphome
std::string value_
Definition: qr_code.h:28
qrcodegen_Ecc ecc_
Definition: qr_code.h:29
Definition: a4988.cpp:4