Dimiter K
/
KS0108-driver
Demo of current functions .
Diff: main.cpp
- Revision:
- 0:13c4589302f6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jan 04 18:37:11 2011 +0000 @@ -0,0 +1,62 @@ +#include "mbed.h" +#include "KS0108.h" +#include "image.h" + +KS0108 display (p13,p12, p14, p11, p21, p22, p30, p29, p28, p27, p26, p25, p24, p23); +void testlib(int i); + +int main() { + + display.ClearScreen(); + display.RoundRectangle(0,0,127,63,3,BLACK); + + while(1){ + + for(int i=0;i<7;i++){ + testlib(i); + wait(2); + display.ClearScreen(); + } + } + +} + +void testlib(int i){ + + switch(i){ + case 1: + for(int i=0;i<10;i++){ + display.SetPixel(i*10,i+10,BLACK); + } + break; + case 2: + display.HLine(20,70,30,BLACK); + display.HLineShort(30,20,50,BLACK); + display.VLine(20,40,30,BLACK); + display.VLineShort(70,5,50,BLACK); + display.SlantyLine(5,8,20,30,BLACK); + display.DegreeLine(15,30,30,6,20,BLACK); + break; + case 3: + display.FullRectangle(10,30,15,34,BLACK); + display.EmptyRectangle(5,5,50,59,BLACK); + display.RoundRectangle(30,20,80,35,7,BLACK); + break; + case 4: + display.EmptyCircle(60,20,10,BLACK); + display.FullCircle(40,30,5,BLACK); + display.PlotEllipse(40,20,40,20,BLACK); + break; + case 5: + display.FullScreenBMP(pic); + wait(1); + break; + case 6: + display.PutString(3,2,"I can has mbed too"); + display.PrintFloat(123.23,4,5); + display.PrintInteger(3,5,7); + break; + + default: break; + } + }