DOGS-102 Graphic LCD module Example. Based on Igor Skochinsky's "DOGLCDDemo" program.
Dependencies: DOG-S_GraphicLCD mbed
Fork of DOGLCDDemo by
Diff: main.cpp
- Revision:
- 1:b7a86d680935
- Parent:
- 0:2a5dccfd318f
--- a/main.cpp Thu Jan 14 00:49:39 2010 +0000 +++ b/main.cpp Sat May 03 18:12:06 2014 +0000 @@ -1,13 +1,25 @@ +//#define DEBUG + #include "mbed.h" + +//DOGS102 Library +#include "DogLCD.h" #include "Graphics.h" #include "Cuboid.h" #include "TrimeshObject.h" + +//Demo Data #include "TieFighter.h" -#include "DogLCD.h" #include "hellombed.h" -SPI spi(p5, NC, p7); -DogLCD dog(spi, p17, p18, p20, p19); // spi, power, cs, a0, reset +#if defined(TARGET_LPC1768) +SPI spi(p11, NC, p13); +DogLCD dog(spi, p18, p20, p19); // spi, cs, a0, reset +#elif defined(TARGET_LPC1114) +SPI spi(dp2, NC, dp6); +DogLCD dog(spi, dp9, dp11, dp10); // spi, cs, a0, reset +#endif + Graphics g(&dog); TrimeshObject tf(tie_fighter_vertices, tie_fighter_faces, TIE_FIGHTER_NUM_FACES); Cuboid cube; @@ -17,24 +29,27 @@ dog.init(); // draw "hello mbed" dog.send_pic(pic_hellombed); - wait(5); + wait(1); // draw rectangle around the screen g.line(0, 0, dog.width()-1, 0, 0xFFFFFF); - wait(2); + wait(1); g.line(dog.width()-1, 0, dog.width()-1, dog.height()-1, 0xFFFFFF); - wait(2); + wait(1); g.line(dog.width()-1, dog.height()-1, 0, dog.height()-1, 0xFFFFFF); - wait(2); + wait(1); g.line(0, dog.height()-1, 0, 0, 0xFFFFFF); - wait(5); + wait(3); dog.clear_screen(); float rotx = 0, roty = 0, rotz = 0; +#ifdef DEBUG Timer timer; timer.start(); int frameno = 0; - const int pollcount = 10; + const int pollcount = 100; +#endif + // shift 1/4th of screen to the left tf.position(-dog.width() / 4, 0, 0); tf.colour(0xffffff); @@ -59,15 +74,17 @@ cube.render(g); // unlock update (and draw framebuffer) dog.endupdate(); +#ifdef DEBUG if ( ++frameno == pollcount ) { // output fps to serial int end = timer.read_ms(); float fps = pollcount*1000.0/end; - printf("\r%d frames, %d ms, FPS: %f", pollcount, end, fps); + printf("%d frames, %d ms, FPS: %f\n", pollcount, end, fps); frameno = 0; timer.reset(); } +#endif //dog.fill(40, 40, 52, 52, 0x000000); } }