cbm80amiga / arduino_st7735_fast Goto Github PK
View Code? Open in Web Editor NEWFast library for the ST7735 128x160 SPI display
License: GNU Lesser General Public License v3.0
Fast library for the ST7735 128x160 SPI display
License: GNU Lesser General Public License v3.0
When I try to compile the Hello World example for Arduino Due (both Programming Port and Native USB), it yields this error:
{ARDUINO DIRECTORY}/libraries/Arduino_ST7735_Fast-master/Arduino_ST7735_Fast.cpp: In member function 'void Arduino_ST7735::writeSPI(uint8_t)': {ARDUINO DIRECTORY}/libraries/Arduino_ST7735_Fast-master/Arduino_ST7735_Fast.cpp:113:5: error: 'SPDR' was not declared in this scope SPDR = c; ^ {ARDUINO DIRECTORY}/libraries/Arduino_ST7735_Fast-master/Arduino_ST7735_Fast.cpp: In member function 'void Arduino_ST7735::init()': {ARDUINO DIRECTORY}/libraries/Arduino_ST7735_Fast-master/Arduino_ST7735_Fast.cpp:143:10: error: cannot convert 'RwReg* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment dcPort = portOutputRegister(digitalPinToPort(dcPin)); ^ {ARDUINO DIRECTORY}/libraries/Arduino_ST7735_Fast-master/Arduino_ST7735_Fast.cpp:146:9: error: cannot convert 'RwReg* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment csPort = portOutputRegister(digitalPinToPort(csPin));
Compiling for the Arduino Uno is fine, but for my current project, it requires the Due. Is there any way to fix this, or is it something different with the board? Thanks in advance!
First of all thanks for your fast library. Its really fast for smooth scrolling text. But I had an issue with smooth menu scrolling. When I pressed next or previous button the menu for next or previous menu item it made a little flickering which is unexpected for me. How can I solved it.
Here is my menu code:
` #include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <SPI.h>
unsigned long startMillis, currentMillis;
// For the breakout board, you can use any 2 or 3 pins.
// These pins will also work for the 1.8" TFT shield.
#define TFT_CS 8
#define TFT_RST 7 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 6
//-------------------Constants for row and column sizes-------------------
// For 1.44" and 1.8" TFT with ST7735 use:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
//Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
//Adafruit_ST7735 tft = Adafruit_ST7735(8, 7, 10, 9, 6);
byte menuPos, menuScreen, markerPos, menuStartAt;
const char* const menu[12] PROGMEM = {"Binary to Decimal", "Binary to Octal", "Binary to Hexa Deci", "Decimal to Binary", "Decimal to Ocatl", "Decimal to Hexa Deci", "Octal to Binary",
"Octal to decimal", "Octal to Hexa Deci", "Hexa-Decimal to Binary", "Hexa-Decimal to Ocatl", "Hexa-Deci to Decimal"};
byte MENU_LENGTH = sizeof(menu) / sizeof(menu[0]);
#define btnEnt 4
#define btnUp 3
#define btnDwn 2
#define MENU_ROW_HEIGHT 12
#define LCD_ROWS 12
void setup() {
Serial.begin(9600);
pinMode(btnUp, INPUT_PULLUP);
pinMode(btnDwn, INPUT_PULLUP);
pinMode(btnEnt, INPUT_PULLUP);
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST77XX_BLACK);
delay(2000);
showMenu();
startMillis = millis();
}
void loop() {
currentMillis = millis();
if (isButtonDown(btnDwn) == true) {
if (menuPos < MENU_LENGTH - 1) {
menuPos++;
if (menuPos - menuStartAt > 12 )
menuStartAt++;
showMenu();
}
delay(100);
startMillis = currentMillis;
}
if (isButtonDown(btnUp) == true) {
if (menuPos > 0) {
menuPos--;
if (menuPos - menuStartAt < 0 && menuStartAt != 0)
menuStartAt--;
showMenu();
}
delay(100);
startMillis = currentMillis;
}
if (isButtonDown(btnEnt) == true) {
if (menuPos == 0) {
testF();
}
else if (menuPos == 1) {
showMenu();
}
else if (menuPos == 2) {
}
else if (menuPos == 3) {
showMenu();
}
else if (menuPos == 4) {
showMenu();
}
else if (menuPos == 5) {
}
else if (menuPos == 6) {
showMenu();
}
else if (menuPos == 7) {
tft.println(F("Waiting to \nregister sim \ncard"));
delay(1000);
} else if (menuPos == 8) {
showMenu();
}
else if (menuPos == 9) {
showMenu();
}
else if (menuPos == 10) {
}
else if (menuPos == 11) {
tft.println(F("Waiting to \nregister sim \ncard"));
} else if (menuPos == 12) {
showMenu();
}
else if (menuPos == 13) {
showMenu();
}
delay(100);
startMillis = currentMillis = millis();
}
}
bool isButtonDown(byte pin) {
if (digitalRead(pin) == LOW) {
delay(30);
if (digitalRead(pin) == LOW)
return true;
return false;
}
return false;
}
void showMenu() {
for (byte i = menuStartAt; i < (menuStartAt + LCD_ROWS); i++) {
byte markerY = (i - menuStartAt) * MENU_ROW_HEIGHT;
if (i == menuPos) {
tft.setTextColor(ST77XX_BLACK);
tft.fillRect(0, markerY, tft.width(), MENU_ROW_HEIGHT, ST77XX_GREEN);
}
else {
tft.setTextColor(ST77XX_WHITE);
tft.fillRect(0, markerY, tft.width(), MENU_ROW_HEIGHT, ST77XX_BLACK);
}
if (i >= MENU_LENGTH)
continue;
tft.setCursor(3, markerY + 2);
tft.print((char*)pgm_read_word(&(menu[i])));
}
}
void testF(){
tft.fillScreen(ST77XX_BLACK);
tft.setTextColor(ST77XX_WHITE);
tft.setCursor(1, 1);
tft.println(F("Waiting to \nregister sim \ncard"));
delay(3000);
showMenu();
}`
I were able to control my SD card and TFT LCD fine using the Adafruit libraries, but when I discovered that the Adafruit libraries were too slow for my tasks, I switched to Arduino_ST7735_Fast. And, when I run my code, the TFT LCD does not initialize properly and stays on a white screen, but the SD card can be read from and written to.
I would suggest you add commands to toggle the Chip Select of the LCD high or low so that I can control an SD card.
Hi, was trying a example ST7735_BigScroll.ino from the library, and it seem to crash after trying to render the scrolling text on nodemcu ESP8622 esp-12f with 1.8' (128x160) display.
I got RST line connected to 3.3v pin with a rezistor - doesnt make any difference if i connect it to a real pin
The serial output with Serial.setDebugOutput(true); if it helps with any troubleshooting
esp8266-Arduino_ST7735_Fast-master-serial-output.txt
Source code: esp8266-ST7735_BigScroll.txt
Video with output: https://user-images.githubusercontent.com/3987091/109518992-7b390080-7ab3-11eb-9b19-9d39cc01bd23.mp4
Any clues?
Hi, super library!
Will there be any support for the Arduino Zero samd21? I tried, but it failed to compile:
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.cpp: In member function 'void Arduino_ST7789::writeSPI(uint8_t)':
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.cpp:75:5: error: 'SPDR' was not declared in this scope
SPDR = c;
^~~~
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.cpp:75:5: note: suggested alternative: 'SPI'
SPDR = c;
^~~~
SPI
In file included from \AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.5\cores\arduino/delay.h:23:0,
from C:\Users\el\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.5\cores\arduino/Arduino.h:81,
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.h:16,
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.cpp:4:
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.cpp: In member function 'void Arduino_ST7789::commonST7789Init(const uint8_t*)':
\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.5\variants\arduino_zero/variant.h:68:55: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
#define portOutputRegister(port) ( &(port->OUT.reg) )
^
\Documents\Arduino\libraries\Arduino_ST7789_Fast-master\Arduino_ST7789_Fast.cpp:169:12: note: in expansion of macro 'portOutputRegister'
dcPort = portOutputRegister(digitalPinToPort(dcPin));
^~~~~~~~~~~~~~~~~~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.