//*********************************************** void radio2() { int STATION_1=1059; int STATION_2=1000; int STATION_3=1004; int STATION_4=1010; int STATION_5=1039; int STATION_6=1025; int STATION_7=1068; int STATION_8=1052; int STATION_9=1075; int x,y,f; boolean mem=0; myGLCD.setColor(VGA_WHITE); myGLCD.setBackColor(VGA_BLUE); myGLCD.setFont(BigFont); myGLCD.fillScr(66,32,7); //(66,32,7) //****************************************************************************************************** if (rad==0) { StationFrequency=STATION_5*100; MP1090S:: InitI2C (19); MP1090S:: SetBand (MHz87_5_108); MP1090S::SetSpace (kHz50); MP1090S::SetVolume (volume); MP1090S::SetStation (StationFrequency); //*************** //myGLCD.setFont( Dingbats1_XL); //myButtons.drawButton(but7); // but7 = myButtons.addButton(270, 80, 35, 35, "w", BUTTON_SYMBOL); // myGLCD.setFont( BigFont); // volume=5; // MP1090S::SetVolume (volume); rad=1; } pictrad(); c=1; //int a=0; // drawButtons(); // myGLCD.setFont( Dingbats1_XL); // pictradio(); myGLCD.setFont( BigFont); drawButt(); strelka(); myGLCD.setBackColor(0,104,39);//goluboy myGLCD.setColor(255,255,255); myGLCD.setFont( BigFont); myGLCD.print(" ", 160, 95); int pos=100*volume/15; myGLCD.printNumI(abs(pos) , 160, 95); //bar(x,y, pos,l,h); barrad(65,135, pos,270-25,10); // myGLCD.setColor(255,255,255); myGLCD.setColor(29,124,221); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.printNumI(STATION_1 , 70, 370); myGLCD.printNumI(STATION_2 ,119, 420); myGLCD.printNumI(STATION_3 , 230, 370); myGLCD.printNumI(STATION_4, 280, 420); myGLCD.printNumI(STATION_5 , 388, 370); myGLCD.printNumI(STATION_6 ,440, 420); myGLCD.printNumI(STATION_7 , 540, 370); myGLCD.printNumI(STATION_8 ,595, 420); myGLCD.printNumI(STATION_9 , 695, 370); // myGLCD.drawBitmap (639, 370, 160, 80, cl); // myGLCD.drawRoundRect (639, 370, 799, 450); //Clok clcrad(); while(1) { sec=t.sec; if (sec==0) { delay(800); //kalend(); clcrad(); } // digitalClockDisplay(); //{ if (myTouch.dataAvailable()) { myTouch.read(); x=myTouch.getX(); y=myTouch.getY(); myGLCD.setColor(VGA_BLUE); myGLCD.setBackColor(255,255,255); // myGLCD.setFont( Ubuntubold); // myGLCD.print("x= " , 650, 32); //myGLCD.printNumI(x , 700, 32); // myGLCD.setFont( Ubuntubold); // myGLCD.print("y= " ,650 , 72); //myGLCD.printNumI(y , 700, 72); //************************************************** if ((y>=405) && (y<=450)) // Upper row { if ((x>=62) && (x<=112))// 2 {waitForIt(62, 405, 112, 450); if (mem==1) {STATION_2= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 119, 420); myGLCD.printNumI(STATION_2 ,119, 420); mem=0; } else { StationFrequency=STATION_2*100; strelka(); } } if ((x>=224) && (x<=274))// 4 {waitForIt(224, 405, 274, 450); if (mem==1) {STATION_4= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 280, 420); myGLCD.printNumI(STATION_4, 280, 420); mem=0; } else { StationFrequency=STATION_4*100; strelka(); } } if ((x>=383) && (x<=433))// 6 {waitForIt(383, 405, 433, 450); if (mem==1) {STATION_6= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 440, 420); myGLCD.printNumI(STATION_6 ,440, 420); mem=0; } else { StationFrequency=STATION_6*100; strelka(); } } if ((x>=540) && (x<=590))// 8 {waitForIt(540, 405, 590, 450); if (mem==1) {STATION_8= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 595, 420); myGLCD.printNumI(STATION_8 ,595, 420); mem=0; } else { StationFrequency=STATION_8*100; strelka(); } } //****************************** } if ((y>=5) && (y<=50)) // Upper row { if ((x>=230) && (x<=280)) // Button: x { waitcirForIt(260+3,30+10,22); mem=1; } if ((x>=480) && (x<=520)) // Button:_ { waitForIt(482, 3, 532, 48); rad=1; //clok(); return ; } if ((x>=540) && (x<=580)) // Button: x { waitForIt(540, 3, 590, 48); rad=0; volume=0; MP1090S::SetVolume (volume); //clok(); return ; } } //********************************************************************************** if ((y>=290) && (y<=330)) // Upper row { if ((x>=20) && (x<=55)) // Button:<< { waitForIt(10, 284, 62, 329); // do //{ StationFrequency=StationFrequency-1000; if (StationFrequency<90000) {StationFrequency=108000; } strelka(); //myGLCD.printNumI(ust , CENTER, 350); // } while(ust>0); } if ((x>=75) && (x<=120)) // Button:- { waitForIt(70, 284, 120, 329); StationFrequency=StationFrequency-50; if (StationFrequency<90000) {StationFrequency=108000; } strelka(); } if ((x>=675) && (x<=725)) // Button:+ { waitForIt(677, 284, 727, 329); StationFrequency=StationFrequency+50; if (StationFrequency>108000) {StationFrequency=90000; } strelka(); } if ((x>=735) && (x<=775)) // Button:>> { waitForIt(739, 284, 792, 329); // do // { StationFrequency=StationFrequency+1000; if (StationFrequency>107000) {StationFrequency=90000; } strelka(); // myGLCD.printNumI(ust , CENTER, 350); // } while(ust>0); } } if ((y>=120) && (y<=150)) // Upper row { if ((x>=28) && (x<=48)) // Button:- volume { waitcirForIt(32-3,138+4,18); if (volume<1) {volume=1; } volume=volume-1; MP1090S::SetVolume (volume); myGLCD.setColor(255,255,255); myGLCD.setBackColor(0,104,39); myGLCD.setFont( BigFont); myGLCD.print(" ", 160, 95); // myGLCD.printNumI(volume , 168, 90); int pos=100*volume/15; myGLCD.printNumI(abs(pos) ,160, 95); barrad(65,135, pos,270-25,10); } if ((x>=316) && (x<=356)) // Button:+ volume { waitcirForIt(338+3,138+4,18); if (volume>14) {volume=14; } volume=volume+1; MP1090S::SetVolume (volume); myGLCD.setColor(255,255,255); myGLCD.setBackColor(0,104,39); myGLCD.setFont( BigFont); myGLCD.print(" ", 160, 95); // myGLCD.printNumI(volume , 168, 90); int pos=100*volume/15; myGLCD.printNumI(abs(pos) , 160, 95); barrad(65,135, pos,270-25,10); } } if ((y>=70) && (y<=100)) // Upper row { if ((x>=17) && (x<=47)) // Button:mute { waitcirForIt(32-3,85+6,18); volume=0; MP1090S::SetVolume (volume); myGLCD.setColor(255,255,255); myGLCD.setBackColor(0,104,39); myGLCD.setFont( BigFont); myGLCD.print(" ", 160, 95); // myGLCD.printNumI(volume , 168, 90); int pos=100*volume/15; myGLCD.printNumI(abs(pos) , 160, 95); barrad(65,135, pos,270-25,10); } } if ((y>=355) && (y<=405)) // Upper row { if ((x>=16) && (x<=56))// 1 {waitForIt(6, 355, 56, 400); if (mem==1) {STATION_1= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 70, 370); myGLCD.printNumI(STATION_1 , 70, 370); mem=0; } else { StationFrequency=STATION_1*100; strelka(); } } if ((x>=175) && (x<=215))// 3 {waitForIt(170, 355, 220, 400); if (mem==1) {STATION_3= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 230, 370); myGLCD.printNumI(STATION_3 , 230, 370); mem=0; } else { StationFrequency=STATION_3*100; strelka(); } } if ((x>=330) && (x<=380))// 5 {waitForIt(330, 355, 380, 400); if (mem==1) {STATION_5= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 388, 370); myGLCD.printNumI(STATION_5 , 388, 370); mem=0; } else { StationFrequency=STATION_5*100; strelka(); } } if ((x>=484) && (x<=530))// 7 {waitForIt(484, 355, 534, 400); if (mem==1) {STATION_7= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 540, 370); myGLCD.printNumI(STATION_7 , 540, 370); mem=0; } else { StationFrequency=STATION_7*100; strelka(); } } if ((x>=640) && (x<=690))// 9 {waitForIt(640, 355, 690, 400); if (mem==1) {STATION_9= StationFrequency/100; myGLCD.setColor(255,255,255); myGLCD.setBackColor(66,32,7); myGLCD.setFont( Ubuntubold); myGLCD.print(" ", 695, 370); myGLCD.printNumI(STATION_9 , 695, 370); mem=0; } else { StationFrequency=STATION_9*100; strelka(); } } } //**********----------------------------------------------------------------------------------------------------- if ((y>=210) && (y<=270)) // Upper row {f=x*10/44+900; myGLCD.setFont( BigFont); myGLCD.setColor(VGA_BLUE); myGLCD.setBackColor(255,255,255); // myGLCD.print("f= " , 650, 132); // myGLCD.printNumI(f , 700, 132); StationFrequency=f*100; strelka(); } } delay(100); } } // Рисуем кнопки void drawButt() { // Draw the upper row of buttons myGLCD.setColor(255, 232, 13); myGLCD.drawRoundRect (482, 3, 532, 48);// _ 50x45 myGLCD.drawRoundRect (540, 3, 590, 48); //x myGLCD.drawRoundRect (10, 284, 62, 329);//<< myGLCD.drawRoundRect (70, 284, 120, 329);//- 50x45 myGLCD.drawRoundRect (677, 284, 727, 329);//+ myGLCD.drawRoundRect (739, 284, 792, 329);//>> myGLCD.drawCircle (32-3,85+6,18);//mute myGLCD.drawCircle (32-3,138+4,18);//- myGLCD.drawCircle (338+3,138+4,18);//+ myGLCD.drawCircle (260+3,30+10,22);//glass myGLCD.drawRoundRect (6, 355, 56, 400);//1 myGLCD.drawRoundRect (170, 355, 220, 400);//3 myGLCD.drawRoundRect (330, 355, 380, 400);//5 myGLCD.drawRoundRect (484, 355, 534, 400);//7 myGLCD.drawRoundRect (640, 355, 690, 400);//9 myGLCD.drawRoundRect (62, 405, 112, 450);//2 myGLCD.drawRoundRect (224, 405, 274, 450);//4 myGLCD.drawRoundRect (383, 405, 433, 450);//6 myGLCD.drawRoundRect (540, 405, 590, 450);//8 } // Draw a red frame while a button is touched void waitForIt(int x1, int y1, int x2, int y2) { myGLCD.setColor(0, 217, 48); myGLCD.drawRoundRect (x1, y1, x2, y2); while (myTouch.dataAvailable()) myTouch.read(); myGLCD.setColor(255, 232, 13); myGLCD.drawRoundRect (x1, y1, x2, y2); } void waitcirForIt(int x1, int y1, int x2) { myGLCD.setColor(0, 217, 48); myGLCD.drawCircle (x1,y1,x2);//glass while (myTouch.dataAvailable()) myTouch.read(); myGLCD.setColor(255, 232, 13); myGLCD.drawCircle (x1,y1,x2);//glass } //****************************strelka*********************************** void strelka() { int xstr; xstr=(StationFrequency/100-900)*44/10; xstr=abs(xstr); myGLCD.setColor(0,104,39); myGLCD.fillRoundRect (306, 279, 500, 333); //clear myGLCD.setColor(255,255,255); myGLCD.setBackColor(0,104,39); myGLCD.setFont( SevenSegNumFont); myGLCD.printNumI(StationFrequency/100 , CENTER, 280); MP1090S::SetStation ( StationFrequency); myGLCD.setColor(63,33, 9); myGLCD.fillRoundRect (0, 246, 800, 266); myGLCD.setColor(255,0, 0); myGLCD.fillRoundRect (xstr-2, 246, xstr+3, 266); } //************************************************************************************ void clcrad() { char* strm[] = {"JAN","FEBR","MARCH","APRIL","MAY","JUNE","JULY","AUG","SEPT","OCT","NOV","DEC"}; int cx=70; int cy=30; int month1; //**********CLOK******************************************************************************* myGLCD.setColor(VGA_WHITE); myGLCD.setBackColor(0,38,92); myGLCD.setFont( SevenSegNumFont); if (t.hour<10) { myGLCD.printNumI(0,cx, cy); myGLCD.printNumI(t.hour, cx+32, cy); } else { myGLCD.printNumI(t.hour,cx, cy); } myGLCD.print(":",cx+64, cy); if (t.min<10) { myGLCD.printNumI(0,cx+96, cy); myGLCD.printNumI(t.min, cx+128, cy); } else { myGLCD.printNumI(t.min, cx+96, cy); } // kalendar myGLCD.setFont( Ubuntubold); //myGLCD.setFont(BigFont); myGLCD.setBackColor( VGA_TRANSPARENT); myGLCD.setColor(245,61,6); // myGLCD.setBackColor(255,114,0); month1=t.mon; myGLCD.print(strm[month1-1], 663-15, 18+8); // myGLCD.print(rtc.getDOWStr(FORMAT_SHORT), 256+450, 8); myGLCD.setFont( SevenSegNumFont); myGLCD.setBackColor( VGA_TRANSPARENT); // myGLCD.setBackColor(255,255,255); myGLCD.setColor(29,124,221);//goluboy if (t.date<10) myGLCD.printNumI(t.date, 710-30, 56+5); else myGLCD.printNumI(t.date, 695-30, 56+5); // myGLCD.setFont(BigFont); // myGLCD.setBackColor(180,180,180); myGLCD.setFont( Ubuntubold); myGLCD.setColor(13,124,30);//zelen dow= t.dow; myGLCD.print(str[dow-1], 690-20,110+5); /// myGLCD.printNumI(rtc_clock.get_months(), 695, 122); myGLCD.setFont(BigFont); myGLCD.setBackColor( VGA_TRANSPARENT); //myGLCD.setBackColor(180,180,180); myGLCD.printNumI(t.year, 694-20, 143+5); //myGLCD.setBackColor(0,0,55); } void barrad(int x,int y,int pos,int l,int h)//kalendar(days, mon, years); l-длинна шкалы pos-позиция метки положения h-высота { //int h=40;//высота шкалы myGLCD.setBackColor(0,0,255); myGLCD.setColor(0,104,39);//цвет фоновый пр-к // myGLCD.setColor(0,0,255); myGLCD.fillRoundRect(x-5, y-5, l+x+5, h+y+5);//рисуем фоновый пр-к myGLCD.setColor(255, 255, 255);//цвет обводки myGLCD.drawRoundRect(x, y, l+x, h+y);//прямоугольник с обводкой //myGLCD.setColor(255,114,0); //myGLCD.fillRoundRect(80, 35, 632, 87); myGLCD.setColor(29,124,221);// цвет прямоуг уровня myGLCD.fillRoundRect(x+1, y+1, (pos*l/100+x)-1, h+y-1);//рисуем прямоуг уровня // myGLCD.setFont(BigFont); // myGLCD.setColor(VGA_WHITE); // myGLCD.setBackColor(0,104,39); // myGLCD.setBackColor(0,0,255); // myGLCD.print("BRIGHT", x-48+(l/2), y-25); // myGLCD.printNumI(abs(pos), x-10+(l/2), y+2);// уровень в процентах }