A 55x31 font for the SPI_TFT library, based on the free Source Code Pro semi-bold (http://sourceforge.net/projects/sourcecodepro.adobe/) Includes optional characters for Mu (micro), Omega (Ohm), +-, square, cubed, Degree sign

Dependencies:   SPI_TFT mbed

Committer:
pholzleitner
Date:
Sun Jan 27 19:34:34 2013 +0000
Revision:
0:17a18e81efc5
Child:
1:a9b5d4535260
Source Code Pro 31px font for SPI_TFT library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pholzleitner 0:17a18e81efc5 1 // example for Source Code Pro 31px font
pholzleitner 0:17a18e81efc5 2
pholzleitner 0:17a18e81efc5 3 #include "stdio.h"
pholzleitner 0:17a18e81efc5 4 #include "mbed.h"
pholzleitner 0:17a18e81efc5 5 #include "string"
pholzleitner 0:17a18e81efc5 6 #include "SourceCodePro31.h"
pholzleitner 0:17a18e81efc5 7 #include "SPI_TFT.h"
pholzleitner 0:17a18e81efc5 8
pholzleitner 0:17a18e81efc5 9 // the TFT is connected to SPI pin 5-7
pholzleitner 0:17a18e81efc5 10 SPI_TFT TFT(p11, p12, p13, p14, p15,"TFT"); // mosi, miso, sclk, cs, reset
pholzleitner 0:17a18e81efc5 11
pholzleitner 0:17a18e81efc5 12 int main() {
pholzleitner 0:17a18e81efc5 13 int i, j; float f;
pholzleitner 0:17a18e81efc5 14 TFT.claim(stdout); // send stdout to the TFT display
pholzleitner 0:17a18e81efc5 15
pholzleitner 0:17a18e81efc5 16 TFT.set_orientation(1);
pholzleitner 0:17a18e81efc5 17
pholzleitner 0:17a18e81efc5 18 for(j = 0; 1; j++) {
pholzleitner 0:17a18e81efc5 19 TFT.background(Blue); // set background to black
pholzleitner 0:17a18e81efc5 20 TFT.foreground(White); // set chars to white
pholzleitner 0:17a18e81efc5 21 TFT.cls(); // clear the screen
pholzleitner 0:17a18e81efc5 22
pholzleitner 0:17a18e81efc5 23 TFT.set_orientation(1);
pholzleitner 0:17a18e81efc5 24 TFT.set_font((unsigned char*) SCProSB31x55);
pholzleitner 0:17a18e81efc5 25
pholzleitner 0:17a18e81efc5 26 for(i = 0; i < 320; i++) {
pholzleitner 0:17a18e81efc5 27 f = rand() / 1E9 - 1;
pholzleitner 0:17a18e81efc5 28 f = f / 5 + sin(i / 26.0);
pholzleitner 0:17a18e81efc5 29 TFT.locate(0,10);
pholzleitner 0:17a18e81efc5 30 TFT.printf("%c", f < 0 ? '-' : '+');
pholzleitner 0:17a18e81efc5 31 TFT.locate(33,10);
pholzleitner 0:17a18e81efc5 32 TFT.printf("%7.5f", abs(f));
pholzleitner 0:17a18e81efc5 33 TFT.locate(250,10);
pholzleitner 0:17a18e81efc5 34 // TFT.printf("}\x7f");
pholzleitner 0:17a18e81efc5 35 TFT.printf("}A");
pholzleitner 0:17a18e81efc5 36 TFT.line(i,150,i,150-f*50, f > 0 ? White : Red);
pholzleitner 0:17a18e81efc5 37 wait_ms(j & 1 ? 80 : 300
pholzleitner 0:17a18e81efc5 38 );
pholzleitner 0:17a18e81efc5 39 }
pholzleitner 0:17a18e81efc5 40 }
pholzleitner 0:17a18e81efc5 41 }
pholzleitner 0:17a18e81efc5 42