kohacraft Lab
/
kc_matrixclock
dot Matrix Led Clock with TLC5940
Diff: main.cpp
- Revision:
- 1:7afb65e75dcd
- Parent:
- 0:c61e5f0d54c1
- Child:
- 2:6edd801ae662
--- a/main.cpp Tue Jul 28 00:21:58 2015 +0000 +++ b/main.cpp Tue Jul 28 00:33:47 2015 +0000 @@ -89,47 +89,47 @@ unsigned short LEDS[16]; while(1) { - for( int l =1 ; l<13 ; l++ ) + for( int hour =1 ; hour<13 ; hour++ ) { - for( int k=0 ; k<60 ; k++) + for( int min=0 ; min<60 ; min++) { - for( int j = 0 ; j < 1024; j+=2 ) + for( int bright = 0 ; bright < 1024; bright+=2 ) { if( fastSw == 1 ) - j+=fastCount; + bright+=fastCount; if( slowSw == 1 ) - j+=slowCount; - for( int i=0 ; i<16 ; i++ ) + bright+=slowCount; + for( int colmn=0 ; colmn<16 ; colmn++ ) { //PWMをクリア for( int h=0; h<16 ; h++ ) LEDS[h] = 0; - LEDS[i] = (unsigned short)j; //必要なピンのみ指定した明るさでON + LEDS[colmn] = (unsigned short)bright; //必要なピンのみ指定した明るさでON offDisp(blank, gsclk); //PWM強制OFF - if( i<8 ) - fontOut( decfont( k , i ) ); + if( colmn<8 ) + fontOut( decfont( min , colmn ) ); else - fontOut( hourDecfont( l , i-8 ) ); + fontOut( hourDecfont( hour , colmn-8 ) ); update_led (driver, xlat, blank, gsclk , LEDS); wait_us(dispTime); } } - for( int j = 1024 ; j > 0; j-=2 ) + for( int bright = 1024 ; bright > 0; bright-=2 ) { if( fastSw == 1 ) - j-= fastCount; + bright-= fastCount; if( slowSw == 1 ) - j-=slowCount; - for( int i=0 ; i<16 ; i++ ) + bright-=slowCount; + for( int colmn=0 ; colmn<16 ; colmn++ ) { for( int h=0; h<16 ; h++ ) LEDS[h] = 0; - LEDS[i] = (unsigned short)j; + LEDS[colmn] = (unsigned short)bright; offDisp(blank, gsclk); - if( i<8 ) - fontOut( decfont( k , i ) ); + if( colmn<8 ) + fontOut( decfont( min , colmn ) ); else - fontOut( hourDecfont( l , i-8 ) ); + fontOut( hourDecfont( hour , colmn-8 ) ); update_led (driver, xlat, blank, gsclk , LEDS); wait_us(dispTime); }