Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

9341 display tool
Moderators: adafruit_support_bill, adafruit

9341 display tool

by normlane on Wed Feb 19, 2014 1:30 am

This will dump the font to the screen along with a scale to help figure out character codes. Just between you and me I'd dump everything above 0x7f and cut the font memory use in half. This is a graphic display after all why do you need the funny characters? Everything below 0x20 looks expendable as well although it would be more work to reclaim that memory.

Code: Select all | TOGGLE FULL SIZE
#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>
#include <Streaming.h>

#define TFT_DC 9
#define TFT_CS 10

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

const int sz = 2;         // text size
const int charWd = 6*sz;  // actually 5X7 but it's padded a little
const int charHt = 8*sz;

const int hOffset = 4*(charWd);
const int vOffset = 2*(charHt);

void setup(void)
{
  Serial.begin(9600);
  tft.begin();
  tft.setTextSize(sz);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_GREEN,ILI9341_BLACK);
  for (int i = 0; i<0x10;i++){
    for (int j = 0;j<0x10;j++){
      if (j==0){
        tft.setCursor(0,i*(charHt)+vOffset);
        tft.setTextColor(ILI9341_WHITE,ILI9341_BLACK);
        tft << "0x" << _HEX(i) << "_";
      }
      tft.setTextColor(ILI9341_GREEN,ILI9341_BLACK);
      tft.setCursor(hOffset +(j*charWd),(i*charHt)+vOffset);
      char c = (i*0x10)+ j;
      tft.write(c);
    }
  }
  for (int i = 0;i<0x10;i++){
    tft.setTextColor(ILI9341_WHITE,ILI9341_BLACK);
    tft.setCursor(hOffset + i*(charWd), vOffset-charHt-2);
    tft << _HEX(i);
    tft.setCursor(hOffset + i*charWd, (0x10*charHt)+ vOffset+2);
    tft << _HEX(i);
  }
}

void loop()
{
}


normlane
 
Posts: 96
Joined: Thu Apr 01, 2010 5:39 pm