Created
September 13, 2021 20:29
Revisions
-
oxyii created this gist
Sep 13, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #include <Arduino.h> #include "qrencode.h" #include "qrcode_espi.h" QRcode_eSPI::QRcode_eSPI(TFT_eSPI *display) { this->display = display; } void QRcode_eSPI::init() { //display->init(); this->screenwidth = display->width(); this->screenheight = display->height(); display->fillScreen(TFT_WHITE); int min = screenwidth; if (screenheight<screenwidth) min = screenheight; multiply = min/WD; offsetsX = (screenwidth-(WD*multiply))/2; offsetsY = (screenheight-(WD*multiply))/2; } void QRcode_eSPI::screenwhite() { display->fillScreen(TFT_WHITE); } void QRcode_eSPI::screenupdate() { // No hay que hacer nada } void QRcode_eSPI::drawPixel(int x, int y, int color) { if(color==1) { color = TFT_BLACK; } else { color = TFT_WHITE; } display->drawPixel(x,y,color); if (this->multiply>1) { display->drawPixel(x+1,y,color); display->drawPixel(x+1,y+1,color); display->drawPixel(x,y+1,color); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #ifndef ESPQRST7735_H #define ESPQRST7735_H /* ESP_QRcode. tft version for ST7735 * include this .h if you have a TFT display */ #define TFTDISPLAY #include <TFT_eSPI.h> #include <SPI.h> #include "qrcode.h" class QRcode_eSPI : public QRcodeDisplay { private: TFT_eSPI *display; void drawPixel(int x, int y, int color); public: QRcode_eSPI(TFT_eSPI *display); void init(); void screenwhite(); void screenupdate(); }; #endif