User Tools

Site Tools


arduino:displays_for_classic_arduinos:display_st7735_1.44_ucglib_solid.ino
display_st7735_1.44_ucglib_solid.ino
/*
 * display_st7735_1.44_ucglib_solid.ino
 *  
 * Test screen update speed with large solid fonts on 
 * a 128x128 TFT screen that uses the ST7735 chip.
 * 
 * Consumes 56% of program storage space and
 * 13% of dynamic memory on a Pro Mini.
 * 
 * Mithat Konar
 */
 
#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_SOLID);
  ucg.clearScreen();
}
 
void loop(void)
{
  ucg.setColor(0, 255, 255, 255); // text foreground color
  ucg.setColor(1, 0, 0, 0);       // text background color
 
  ucg.setFont(ucg_font_profont15_mr);
  ucg.setPrintPos(0, 12);
  ucg.print("Ucglib solid");
 
  ucg.setFont(ucg_font_inr49_mr);
  counter++;
 
  // draw new value
  ucg.setPrintPos(0, 90);
  ucg.print(counter);
 
  // inherent frame rate of this loop is about 1 fps (8Mhz)
  // and about 1.9 fps (16MHz) w/o added delay. 
  delay(500);
}
arduino/displays_for_classic_arduinos/display_st7735_1.44_ucglib_solid.ino.txt · Last modified: 2018/01/28 01:49 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki