implementing a generic screen introducing a game.

Dependencies:   N5110 mbed

Committer:
bonnyngangu
Date:
Fri May 06 17:06:42 2016 +0000
Revision:
0:0e74a8426191
Creating a generic background for a game program.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bonnyngangu 0:0e74a8426191 1 /*
bonnyngangu 0:0e74a8426191 2 Generic screen program
bonnyngangu 0:0e74a8426191 3 Displaying a title on an diamond filled in black
bonnyngangu 0:0e74a8426191 4 By Bonny_Ngangu
bonnyngangu 0:0e74a8426191 5 27-March-2016
bonnyngangu 0:0e74a8426191 6 */
bonnyngangu 0:0e74a8426191 7 #include "mbed.h"
bonnyngangu 0:0e74a8426191 8 #include "N5110.h"
bonnyngangu 0:0e74a8426191 9
bonnyngangu 0:0e74a8426191 10 // VCC,SCE,RST,D/C,MOSI,SCLK,LED
bonnyngangu 0:0e74a8426191 11 N5110 lcd(PTE26 , PTA0 , PTC4 , PTD0 , PTD2 , PTD1 , PTC3);
bonnyngangu 0:0e74a8426191 12 // Can also power (VCC) directly from VOUT (3.3 V) -
bonnyngangu 0:0e74a8426191 13 // Can give better performance due to current limitation from GPIO pin
bonnyngangu 0:0e74a8426191 14
bonnyngangu 0:0e74a8426191 15 int main()
bonnyngangu 0:0e74a8426191 16 {
bonnyngangu 0:0e74a8426191 17 // initialising the display
bonnyngangu 0:0e74a8426191 18 lcd.init();
bonnyngangu 0:0e74a8426191 19
bonnyngangu 0:0e74a8426191 20 while(1) {
bonnyngangu 0:0e74a8426191 21
bonnyngangu 0:0e74a8426191 22 // these are default settings so not strictly needed
bonnyngangu 0:0e74a8426191 23 lcd.normalMode(); // normal colour mode
bonnyngangu 0:0e74a8426191 24 lcd.setBrightness(1.0); // put LED backlight on 50%
bonnyngangu 0:0e74a8426191 25
bonnyngangu 0:0e74a8426191 26 lcd.printString(" SQUASH!",15,2);
bonnyngangu 0:0e74a8426191 27 lcd.inverseMode(); // invert colours
bonnyngangu 0:0e74a8426191 28 lcd.drawLine(41,0,0,23,1);
bonnyngangu 0:0e74a8426191 29 lcd.drawLine(41,0,83,23,1);
bonnyngangu 0:0e74a8426191 30 lcd.drawLine(0,23,41,47,1);
bonnyngangu 0:0e74a8426191 31 lcd.drawLine(83,23,41,47,1);
bonnyngangu 0:0e74a8426191 32 lcd.refresh();
bonnyngangu 0:0e74a8426191 33
bonnyngangu 0:0e74a8426191 34 wait(5.0);
bonnyngangu 0:0e74a8426191 35 lcd.clear();
bonnyngangu 0:0e74a8426191 36 }
bonnyngangu 0:0e74a8426191 37 }