Demo program for the Oled display
Diff: main.cpp
- Revision:
- 3:1fb597da3fdf
- Parent:
- 2:1eac3ea8c6e8
--- a/main.cpp Fri Jan 09 18:21:01 2015 +0000 +++ b/main.cpp Mon Jan 12 21:10:53 2015 +0000 @@ -23,7 +23,7 @@ char statusText[6][20] = {"Waiting Synchronise"," Wait for 21st bit ","Reading Signal data"," Checking Parity "," Last Minute Okay "," Signal error "}; char leapSymbol[2][10] = {" ", "Leap Year"}; -int hour,minute,second,dayofweek,dayofmonth,month,year,nextsec,DCF; +int hour,minute,second,dayofweek,dayofmonth,month,year,nextsec; int RTCsecond,RTCminute,RTChour,RTCdayofweek,RTCdayofmonth,RTCmonth,RTCyear; int xbuffer,ybuffer,IRQ; int xs,ys,xm,ym,xh,yh,x,y; @@ -82,7 +82,6 @@ oled.clear(); oled.setTextBackgroundType(TEXT_OPAQUE); oled.setFontSize(FONT12X16);oled.setFontColor(oled.toRGB(255,255,0)); - oled.setFontColor(oled.toRGB(255,255,0)); oled.drawText(2,0,(FONT12X16),"--drawText vs. printf--",oled.toRGB(255,0,255)); oled.drawText(2,22,(FONT5X7),"Use drawText as much as possible, it's nearly twice",oled.toRGB(255,255,255)); oled.drawText(2,23,(FONT5X7),"as fast as printf. Make sure the serial stream is",oled.toRGB(255,255,255)); @@ -354,9 +353,8 @@ t.tm_mday = (dayofmonth); // 1-31 t.tm_mon = (month-1); // 0-11 DCF "0" = Jan, -1 added for Mbed RCT clock format t.tm_year = ((year)+100); // year since 1900, current DCF year + 100 + 1900 = correct year - if (DCF==1) {set_time(mktime(&t)-3600);} // set RTC clock to DCF -1 hour for GMT time zone - else {set_time(mktime(&t));} // set RTC clock to local time zone - DCF=0; + set_time(mktime(&t)-3600); // set RTC clock to DCF -1 hour for GMT time zone + rtcset=1; } // **************************** DCF clock ********************************************** @@ -397,10 +395,7 @@ oled.drawLine(288,190,305,190, oled.toRGB(225, 255, 255)); oled.drawText(0,26,(FONT5X7)," 0 start min hour Dt dy mon year 60",oled.toRGB(255,0,0)); oled.setTouchArea(240,140,290,160); - start=0;sync=1;x=0;y=5;r=0;SignalStatus=0; - laststart=2; - loop=0; - //RTCset=0; + start=0;sync=1;x=0;y=5;r=0;SignalStatus=0;laststart=2;loop=0; interrupt_counter = 0;dcf_sec=0;error_count=0,display=0;signal_error=0;rtcset_times=0; hour = 0;minute = 0,second = 0,dayofweek = 6;dayofmonth = 1;month = 1;year = 0; @@ -426,7 +421,7 @@ if (interrupt_counter == 0) { if (start == 0) {dcf_sec=0;} if (dcf_sec == 0){dcf_array[58] = 0;} - if (dcf_good==1 && dcf_sec==2) {DCF=1;RTCset();} + if (dcf_good==1 && dcf_sec==2) {RTCset();} } if (interrupt_counter == 1) { @@ -655,7 +650,7 @@ void dcfIRQ(void) { - if (sync==0){ + if (sync==0){ // align Ticker with DCF 59th bit start signal every minute interrupt_counter = 0;sync=1;dcf_sec=0;error_count=0; Ticker50ms.attach(& dcfISR, .05); }