![](/media/cache/profiles/f93486bfff38ca69d76d85c089569a09.50x50_q85.jpg)
VGA 640x400 fullgraphic monochrome demo program
Dependencies: vga640x400g mbed
Diff: main.cpp
- Revision:
- 0:001deff5fcd5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jul 24 11:54:37 2011 +0000 @@ -0,0 +1,69 @@ +/* + * 640x400 70Hz fullgraphic monochrome VGA Driver demo program + * + * Copyright (C) 2011 by Ivo van Poorten <ivop(at)euronet.nl> + * and Gert van der Knokke <gertk(at)xs4all.nl> + * This file is licensed under the terms of the GNU Lesser + * General Public License, version 3. + * + * Inspired by Simon's (not Ford) Cookbook entry and Cliff Biffle's + * assembly code. + */ + +#include "mbed.h" +#include "vga640x400g.h" + +// visual feedback +DigitalOut myled(LED1); + +// define serial port for debug +Serial linktopc(USBTX,USBRX); + +int main() { + // init the VGA subsystem (always do this first!) + init_vga(); + + int s,t; + + // serial port on at 115200 baud + linktopc.baud(115200); + setbuf(stdout, NULL); // no buffering for this filehandle + + + // clear the screen + vga_cls(); + + // draw some circles + for (t=10; t<200; t+=5) + vga_circle(20+t,399-t,t,WHITE); + + // draw some boxes + for (t=10; t<100; t+=5) + vga_box(400+t,100+t,400+t*2,100+t*2,WHITE); + + // circumfence the screen + vga_box(0,0,639,399,WHITE); + + // show the complete character set + for (s=0; s<4; s++) { + for (t=0; t<64; t++) { + vga_putchar(20+t*8,20+16*s,t+s*64,WHITE); + } + } + + // put a string on screen + vga_putstring(400,370,"Hello World!",WHITE); + + // draw a line + vga_line(400,390,500,390,WHITE); + + // draw a filled box + vga_filledbox(450,330,550,360,1); + + + // all done + while (1){ + wait(1); + myled=!myled; + } + }