User Tools

Site Tools


No renderer 'pdf' found for mode 'pdf'
arduino:displays_for_classic_arduinos:display_st7735_1.44_ucglib_transparent.ino
display_st7735_1.44_ucglib_transparent
/*
 * display_st7735_1.44_ucglib_transparent.ino
 * 
 * Test screen update speed with large transparent fonts on 
 * a 128x128 TFT screen that uses the ST7735 chip.
 *  
 * Consumes 53% of program storage space and
 * 13% of dynamic memory on a Pro Mini.
 * 
 * Mithat Konar
 */
 
//#include <SPI.h>
#include "Ucglib.h"
 
/*
 * Pin assignments:
 * RST: 8
 * CE/CS/SCE: 10
 * DC/"D/C"/A0: 9
 * DIN/DN/MOSI/DATA: 11 (Arduino HW standard)
 * CLK/SCLK/SCK: 13  (Arduino HW standard)
 * VCC: 3.3V
 * LIGHT/LED: ground through 1 ohm resistor (yields about 20mA)
 * GND: ground
 */
 
const unsigned int CLOCK_PIN = 13,
                   DATA_PIN = 11,
                   CS_PIN = 10,
                   DC_PIN = 9,
                   RESET_PIN = 8;
 
Ucglib_ST7735_18x128x160_HWSPI ucg(DC_PIN, CS_PIN, RESET_PIN);
 
unsigned int counter = 80;
 
void setup(void)
{
  delay(1000);
  ucg.begin(UCG_FONT_MODE_TRANSPARENT);
  ucg.clearScreen();
}
 
void loop(void)
{
  ucg.setFont(ucg_font_7x13_tf);
  ucg.setPrintPos(0, 12);
  ucg.setColor(255, 255, 255); // Draw new value
  ucg.print("Ucglib transparent");
 
  ucg.setFont(ucg_font_logisoso58_tr);
 
  // because the font is rendered transparent,
  // you need to clear the screen
  // ucg.clearScreen();
 
  // or draw over previous glyphs in background color
  ucg.setColor(0, 0 ,0);  
  ucg.setPrintPos(0, 90);
  ucg.print(counter);
 
  counter++;
 
  // draw new value
  ucg.setColor(255, 255, 255);
  ucg.setPrintPos(0, 90);
  ucg.print(counter);
 
  /* With 8MHz processor, inherent frame rate of this loop  is about
     1.2 fps with ucg.clearScreen(), and 1.5 fps with drawing over previous glyphs, 
     With 16MHz processor, inherent frame rate of this loop  is about
     2.4 fps with ucg.clearScreen(), and 2.9 fps with drawing over previous glyphs, 
     w/o added delay. The ucg.clearScreen() approach results in unacceptable 
     flickers. */
  delay(500);
}
arduino/displays_for_classic_arduinos/display_st7735_1.44_ucglib_transparent.ino.txt · Last modified: 2018/01/28 01:50 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki