Demo program to show 640x480 monochrome fullgraphic
Dependencies: mbed vga640x480g
main.cpp
00001 /* 00002 * 640x480 60Hz fullgraphic monochrome VGA Driver demo program 00003 * 00004 * Copyright (C) 2011 by Ivo van Poorten <ivop(at)euronet.nl> 00005 * and Gert van der Knokke <gertk(at)xs4all.nl> 00006 * This file is licensed under the terms of the GNU Lesser 00007 * General Public License, version 3. 00008 * 00009 * Inspired by Simon's (not Ford) Cookbook entry and Cliff Biffle's 00010 * assembly code. 00011 */ 00012 00013 #include "mbed.h" 00014 #include "vga640x480g.h" 00015 00016 // visual feedback 00017 DigitalOut myled(LED1); 00018 00019 // define serial port for debug 00020 Serial linktopc(USBTX,USBRX); 00021 00022 int main() { 00023 // init the VGA subsystem (always do this first!) 00024 init_vga(); 00025 00026 int s,t; 00027 00028 // serial port on at 115200 baud 00029 linktopc.baud(115200); 00030 setbuf(stdout, NULL); // no buffering for this filehandle 00031 00032 00033 // clear the screen 00034 vga_cls(); 00035 00036 // draw some circles 00037 for (t=10; t<200; t+=5) 00038 vga_circle(20+t,399-t,t,WHITE); 00039 00040 // draw some boxes 00041 for (t=10; t<100; t+=5) 00042 vga_box(400+t,100+t,400+t*2,100+t*2,WHITE); 00043 00044 // circumfence the screen 00045 vga_box(0,0,639,479,WHITE); 00046 00047 // show the complete character set 00048 for (s=0; s<4; s++) { 00049 for (t=0; t<64; t++) { 00050 vga_putchar(20+t*8,20+16*s,t+s*64,WHITE); 00051 } 00052 } 00053 00054 // put a string on screen 00055 vga_putstring(400,370,"Hello World!",WHITE); 00056 00057 // draw some lines 00058 vga_line(400,390,500,390,WHITE); 00059 vga_line(500,475,600,375,WHITE); 00060 00061 // draw a filled box 00062 vga_filledbox(450,330,550,360,1); 00063 00064 // draw some more boxes 00065 for (t=10; t<320; t+=5) 00066 vga_box(100+t,440-t/16,110+t,440+t/16,WHITE); 00067 00068 00069 // all done 00070 while (1){ 00071 wait(1); 00072 myled=!myled; 00073 } 00074 }
Generated on Wed Jul 20 2022 19:48:49 by 1.7.2