// main initializes the system and shows the picture. // Exit and clean up when you hit [RETURN]. int main(int argc, char **argv) { int w, h, n; char *usage = "%s [command]\n\tdemo sec\n\tastro\n\ttest ...\n\trand n\n\trotate n ...\n\timage\n\ttext\n\tfontsize\n\traspi\n\tadvert\n\tgradient\n"; char *progname = argv[0]; saveterm(); init(&w, &h); rawterm(); switch (argc) { case 2: if (strncmp(argv[1], "image", 5) == 0) { imagetable(w, h); } else if (strncmp(argv[1], "text", 4) == 0) { tb(w, h); } else if (strncmp(argv[1], "astro", 5) == 0) { sunearth(w, h); } else if (strncmp(argv[1], "fontsize", 8) == 0) { fontrange(w, h); } else if (strncmp(argv[1], "advert", 6) == 0) { advert(w,h); } else if (strncmp(argv[1], "raspi", 5) == 0) { raspi(w, h, "The Raspberry Pi"); } else if (strncmp(argv[1], "gradient", 8) == 0) { gradient(w,h); } else { restoreterm(); fprintf(stderr, usage, progname); return 1; } break; case 3: n = atoi(argv[2]); if (strncmp(argv[1], "demo", 4) == 0) { if (n < 1 || n > 30) { n = 5; } demo(w, h, n); } else if (strncmp(argv[1], "rand", 4) == 0) { if (n < 1 || n > 1000) { n = 100; } rshapes(w, h, n); } else if (strncmp(argv[1], "test", 4) == 0) { testpattern(w, h, argv[2]); } else { restoreterm(); fprintf(stderr, usage, progname); return 1; } break; case 4: if (strncmp(argv[1], "rotate", 6) == 0) { rotext(w, h, atoi(argv[2]), argv[3]); } else { restoreterm(); fprintf(stderr, usage, progname); return 1; } break; default: refcard(w, h); } waituntil(0x1b); restoreterm(); finish(); return 0; }
// main initializes the system and shows the picture. // Exit and clean up when you hit [RETURN]. int main(int argc, char **argv) { int n; char *progname = argv[0]; int NoDeviceEvent=0; saveterm(); init(&wscreen, &hscreen); rawterm(); if(argc>1) { NoDeviceEvent=atoi(argv[1]); printf("Device Event = %d\n",NoDeviceEvent); } if (openTouchScreen(NoDeviceEvent) == 1) perror("error opening touch screen"); int screenXmax, screenXmin; int screenYmax, screenYmin; getTouchScreenDetails(&screenXmin,&screenXmax,&screenYmin,&screenYmax); scaleXvalue = ((float)screenXmax-screenXmin) / wscreen; //printf ("X Scale Factor = %f\n", scaleXvalue); scaleYvalue = ((float)screenYmax-screenYmin) / hscreen; //printf ("Y Scale Factor = %f\n", scaleYvalue); int wbuttonsize=wscreen/5; int hbuttonsize=hscreen/5; int button=AddButton(0*wbuttonsize+20,0+hbuttonsize*0+20,wbuttonsize*0.9,hbuttonsize*0.9); color_t Col; Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"SR125",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"SR125",&Col); button=AddButton(1*wbuttonsize+20,hbuttonsize*0+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"SR250",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"SR250",&Col); button=AddButton(2*wbuttonsize+20,hbuttonsize*0+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"SR333",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"SR333",&Col); button=AddButton(3*wbuttonsize+20,hbuttonsize*0+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"SR500",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"SR500",&Col); button=AddButton(4*wbuttonsize+20,hbuttonsize*0+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"SR1000",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"SR1000",&Col); // FEC button=AddButton(0*wbuttonsize+20,hbuttonsize*1+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"FEC 1/2",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"FEC 1/2",&Col); button=AddButton(1*wbuttonsize+20,hbuttonsize*1+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"FEC 2/3",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"FEC 2/3",&Col); button=AddButton(2*wbuttonsize+20,hbuttonsize*1+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"FEC 3/4",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"FEC 3/4",&Col); button=AddButton(3*wbuttonsize+20,hbuttonsize*1+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"FEC 5/6",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"FEC 5/6",&Col); button=AddButton(4*wbuttonsize+20,hbuttonsize*1+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"FEC 7/8",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"FEC 7/8",&Col); //SOURCE button=AddButton(0*wbuttonsize+20,hbuttonsize*2+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"CAM MPEG2",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"CAM MPEG2",&Col); button=AddButton(1*wbuttonsize+20,hbuttonsize*2+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"CAM H264",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"CAM H264",&Col); char PictureName[255]; //strcpy(PictureName,ImageFolder); GetNextPicture(PictureName); button=AddButton(2*wbuttonsize+20,hbuttonsize*2+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"Patern",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,PictureName,&Col); button=AddButton(3*wbuttonsize+20,hbuttonsize*2+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"TS File",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"Video Name",&Col); button=AddButton(4*wbuttonsize+20,hbuttonsize*2+20,wbuttonsize*0.9,hbuttonsize*0.9); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"Carrier",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"Carrier",&Col); //TRANSMIT button=AddButton(0*wbuttonsize+20,hbuttonsize*3+20,wbuttonsize*1.2,hbuttonsize*1.2); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"TX ",&Col); Col.r=255;Col.g=0;Col.b=0; AddButtonStatus(button,"TX ON",&Col); button=AddButton(1*wbuttonsize*3+20,hbuttonsize*3+20,wbuttonsize*1.2,hbuttonsize*1.2); Col.r=0;Col.g=0;Col.b=128; AddButtonStatus(button,"RX ",&Col); Col.r=0;Col.g=128;Col.b=0; AddButtonStatus(button,"RX ON",&Col); Start(wscreen,hscreen); IsDisplayOn=1; char Param[]="symbolrate"; char Value[255]; GetConfigParam(PATH_CONFIG,Param,Value); SR=atoi(Value); switch(SR) { case 125:SelectSR(0);break; case 250:SelectSR(1);break; case 333:SelectSR(2);break; case 500:SelectSR(3);break; case 1000:SelectSR(4);break; } strcpy(Param,"fec"); strcpy(Value,""); GetConfigParam(PATH_CONFIG,Param,Value); printf("Value=%s %s\n",Value,"Fec"); fec=atoi(Value); switch(fec) { case 1:SelectFec(5);break; case 2:SelectFec(6);break; case 3:SelectFec(7);break; case 5:SelectFec(8);break; case 7:SelectFec(9);break; } strcpy(Param,"modeinput"); GetConfigParam(PATH_CONFIG,Param,Value); strcpy(ModeInput,Value); if(strcmp(Value,"CAMH264")==0) { SelectSource(11,1); } if(strcmp(Value,"CAMMPEG-2")==0) { SelectSource(10,1); } if(strcmp(Value,"PATERNAUDIO")==0) { SelectSource(12,1); } if(strcmp(Value,"CARRIER")==0) { SelectSource(13,1); } UpdateWindow(); // RESIZE JPEG TO BE DONE /*char PictureName[255]; strcpy(PictureName,ImageFolder); GetNextPicture(PictureName); Image(0,0,300,200,PictureName); End(); */ waituntil(wscreen,hscreen,0x1b); restoreterm(); finish(); return 0; }