int main (void) { TWI_init(); //TWI Bus Initialisieren TWI_59116_reset(); TWI_59116_setup(); if(CORE==Master){ DDRA=0xff; //PORTA als Ausgang DDRD|=(1<<2); // PD2 als Ausgang Interrupt_init(); sei(); SPI_MasterInit(); Ebene_ein=0; while(1) { effect_blinky2(1); //ok effect_planboing(0,AXIS_Z,20); //ok effect_planboing(1,AXIS_X,20); //ok effect_planboing(0,AXIS_Y,20); //ok effect_planboing(1,AXIS_Z,20); //ok for (uint8_t ii=0;ii<8;ii++) effect_box_shrink_grow (0,ii%4, ii & 4, 20); //ok //sendvoxels_rand_z(100,10,20); // ok effect_random_sparkle (1,3,20,10); //ok effect_box_woopwoop(1,40,1); //naja effect_rain(0,300); //ok //effect_wormsqueeze (2, AXIS_Z, 1, 100, 25); //ok for(int i=0;i<8;i++){ // Pixel durchtesten for(int j=0;j<64;j++) { LED[0][i][j/8][j%8]=0xff; _delay_us(500); } for(int j=0;j<64;j++) { LED[0][i][j/8][j%8]=0; _delay_us(500); } } } }else{ DDRA=0x00; //PORTA als Eingang DDRD&=~(1<<2); // PD2 als Eingang SPI_SlaveInit(); Ebene_ein=0; while(1) { I2C_Leds_ein(Ebene_ein%8); //Säulentreiber einschalten für nächste Ebene } } return 0; }
void launch_effect(int effect) { int i; unsigned char ii; fill(0x00); switch (effect) { case 0x00: effect_rain(100); break; case 1: sendvoxels_rand_z(20,220,2000); break; case 2: effect_random_filler(5,1); effect_random_filler(5,0); effect_random_filler(5,1); effect_random_filler(5,0); break; case 3: effect_z_updown(20,1000); break; case 4: effect_wormsqueeze (2, AXIS_Z, -1, 100, 1000); break; case 5: effect_blinky2(); break; case 6: for (ii=0;ii<8;ii++) { effect_box_shrink_grow (1, ii%4, ii & 0x04, 650); } effect_box_woopwoop(800,0); effect_box_woopwoop(800,1); effect_box_woopwoop(800,0); effect_box_woopwoop(800,1); break; case 7: effect_planboing (AXIS_Z, 600); effect_planboing (AXIS_X, 600); effect_planboing (AXIS_Y, 600); effect_planboing (AXIS_Z, 600); effect_planboing (AXIS_X, 600); effect_planboing (AXIS_Y, 600); fill(0x00); break; case 8: fill(0x00); effect_telcstairs(0,800,0xff); effect_telcstairs(0,800,0x00); effect_telcstairs(1,800,0xff); effect_telcstairs(1,800,0x00); delay_ms(1000); fill(0x00); effect_telcstairs(0,800,0xff); effect_telcstairs(0,800,0x00); effect_telcstairs(1,800,0xff); effect_telcstairs(1,800,0x00); break; case 9: effect_axis_updown_randsuspend(AXIS_Z, 550,5000,0); effect_axis_updown_randsuspend(AXIS_Z, 550,5000,1); effect_axis_updown_randsuspend(AXIS_Z, 550,5000,0); effect_axis_updown_randsuspend(AXIS_Z, 550,5000,1); effect_axis_updown_randsuspend(AXIS_X, 550,5000,0); effect_axis_updown_randsuspend(AXIS_X, 550,5000,1); effect_axis_updown_randsuspend(AXIS_Y, 550,5000,0); effect_axis_updown_randsuspend(AXIS_Y, 550,5000,1); break; case 10: effect_loadbar(700); break; case 11: effect_wormsqueeze (1, AXIS_Z, 1, 100, 1000); break; case 12: effect_smileyspin(2,1000,1); break; case 13: effect_stringfly2("HELLO WORLD!"); break; case 14: effect_smileyspin(3,1000,0); break; case 15: effect_boxside_randsend_parallel (AXIS_Z, 0 , 200,1); delay_ms(1500); effect_boxside_randsend_parallel (AXIS_Z, 1 , 200,1); delay_ms(1500); effect_boxside_randsend_parallel (AXIS_Z, 0 , 200,2); delay_ms(1500); effect_boxside_randsend_parallel (AXIS_Z, 1 , 200,2); delay_ms(1500); effect_boxside_randsend_parallel (AXIS_Y, 0 , 200,1); delay_ms(1500); effect_boxside_randsend_parallel (AXIS_Y, 1 , 200,1); delay_ms(1500); break; case 16: boingboing(250, 600, 0x01, 0x02); break; case 17: fill(0x00); // Create a random starting point for the Game of Life effect. for (i = 0; i < 20;i++) { setvoxel(rand()%4,rand()%4,rand()%4); } gol_play(20, 400); break; case 18: effect_pathspiral(100,500); break; case 19: effect_path_bitmap(700,2,3); break; case 20: effect_smileyspin(2,1000,1); break; case 21: effect_path_text(1000,"HI"); break; case 22: effect_rand_patharound(400,600); break; case 23: effect_wormsqueeze (1, AXIS_Z, -1, 100, 1000); break; case 24: effect_smileyspin(2,1000,2); break; case 25: effect_random_sparkle(); break; case 26: effect_wormsqueeze (1, AXIS_Z, -1, 100, 1000); break; case 27: boingboing(250, 600, 0x01, 0x03); break; // In case the effect number is out of range: default: effect_stringfly2("FAIL"); break; } }
void launch_effects() { unsigned char k; k = 0; #if EFFECT_TEST == 1 clear_and_wait(); effect_test(); #endif #if EFFECT_RAIN == 1 clear_and_wait(); effect_rain(100); #endif #if EFFECT_SENDVOXELS_RZ == 1 clear_and_wait(); effect_sendvoxels_rand_z(20,220,2000); #endif #if EFFECT_SENDPLANE_RZ == 1 clear_and_wait(); effect_sendplane_rand_z(20, 220, 2000); #endif #if EFFECT_RANDOM_FILTER == 1 clear_and_wait(); effect_random_filler(5, 1); effect_random_filler(5, 0); #endif #if EFFECT_BLINKY == 1 clear_and_wait(); effect_blinky2(); #endif #if EFFECT_BOX_SHRING_GROW == 1 clear_and_wait(); for(k = 0; k < 8; k++) { effect_box_shrink_grow(1, k % 4, k & 0x04, 450); } #endif #if EFFECT_BOX_WOOPWOOP == 1 clear_and_wait(); effect_box_woopwoop(800, 0); effect_box_woopwoop(800, 1); effect_box_woopwoop(800, 0); effect_box_woopwoop(800, 1); #endif #if EFFECT_PLANBOING == 1 clear_and_wait(); effect_planboing(AXIS_Z, 400); effect_planboing(AXIS_X, 400); effect_planboing(AXIS_Y, 400); effect_planboing(AXIS_Z, 400); effect_planboing(AXIS_X, 400); effect_planboing(AXIS_Y, 400); #endif #if EFFECT_LOADBAR == 1 clear_and_wait(); effect_loadbar(700); #endif #if EFFECT_WORMSQUEEZE == 1 clear_and_wait(); effect_wormsqueeze(1, AXIS_Z, 1, 100, 1000); #endif #if EFFECT_BOXSIDE_RAND_SEND == 1 clear_and_wait(); for(k = 0; k < 5; k++) { effect_boxside_randsend_parallel(AXIS_Z, 0, 200, 2); delay_ms(1500); } #endif #if EFFECT_Z_UPDOWN == 1 clear_and_wait(); effect_z_updown(20, 1000); #endif #if EFFECT_TELKSTAIRS == 1 clear_and_wait(); effect_telcstairs(0, 800, 0xff); effect_telcstairs(0, 800, 0x00); effect_telcstairs(1, 800, 0xff); effect_telcstairs(1, 800, 0xff); #endif #if EFFECT_AXIS_UPDOWN_RSUSPEND == 1 clear_and_wait(); effect_axis_updown_randsuspend(AXIS_Z, 550, 5000, 0); effect_axis_updown_randsuspend(AXIS_Z, 550, 5000, 1); effect_axis_updown_randsuspend(AXIS_Z, 550, 5000, 0); effect_axis_updown_randsuspend(AXIS_Z, 550, 5000, 1); effect_axis_updown_randsuspend(AXIS_X, 550, 5000, 0); effect_axis_updown_randsuspend(AXIS_X, 550, 5000, 1); effect_axis_updown_randsuspend(AXIS_Y, 550, 5000, 0); effect_axis_updown_randsuspend(AXIS_Y, 550, 5000, 1); #endif #if EFFECT_BOINGBOING == 1 clear_and_wait(); effect_boingboing(250, 600, 0x01, 0x02); #endif #if EFFECT_SPARKLE == 1 clear_and_wait(); effect_random_sparkle(); #endif #if EFFECT_BIT_WALKING == 1 clear_and_wait(); effect_bit_walking(); #endif #if EFFECT_LINES == 1 clear_and_wait(); effect_lines(); #endif #if EFFECT_RIPPLES == 1 clear_and_wait(); effect_ripples(100, 10); #endif #if EFFECT_STRING_FLY == 1 clear_and_wait(); effect_str_fly(); #endif #if EFFECT_CLOSING_BOX == 1 clear_and_wait(); effect_closing_box(); #endif }