ST7735s Scrolling Modified Terminal Code #2331
Godzilla-ZZ
started this conversation in
General
Replies: 1 comment
-
Thanks for sharing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi I was able to get scrolling to work on my 128x160 ST7735s boards, the terminal program works with these modifications. You also need to change the display dimensions in the rest of the code, but vertical scrolling top-to-bottom and bottom-to-top worked for me. Hopefully this might be useful to others.
#define VSSTADRS 0x37 //Scroll Addressing
#define VSCLLDEF 0x33 //Scroll
#define SCROLLUP 0x00 // Bottom-to-top if %00000100 top-to-bottom 0x4
#define SCROLLDOWN 0X40
// ##############################################################################################
// Setup a portion of the screen for vertical scrolling
// ##############################################################################################
// We are using a hardware feature of the display, so we can only scroll in portrait orientation
void setupScrollArea(uint16_t tfa, uint16_t bfa) {
/* Serial.printf("Mad MX %02x \n",TFT_MAD_MX);
Serial.printf("Mad MY %02x \n",TFT_MAD_MY);
Serial.printf("Mad MH %02x \n",TFT_MAD_MH);
Serial.printf("Mad RGB %02x \n",TFT_MAD_COLOR_ORDER);
Serial.printf("Mad ML %02x \n",TFT_MAD_ML);
*/
tft.writecommand(VSCLLDEF); // Vertical scroll definition
tft.writedata(tfa >> 8); // Top Fixed Area line count
tft.writedata(tfa);
tft.writedata((YMAX-tfa-bfa)>>8); // Vertical Scrolling Area line count
tft.writedata(YMAX-tfa-bfa);
tft.writedata(bfa >> 8); // Bottom Fixed Area line count
tft.writedata(bfa);
tft.writecommand(TFT_MADCTL);
// MADCTL Bits [MY][MX][MV][ML][RGB][MH][-][-]
// MADCTL register MY+MX+ML
tft.writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_ML | SCROLLUP); // 11010000
}
Beta Was this translation helpful? Give feedback.
All reactions