All pastes #224542 Raw Edit

Something

public c v1 · immutable
#224542 ·published 2006-10-27 13:16 UTC
rendered paste body
void checkDirection(void)    {        if (0) {      }        else if ( !(PINC & (1<<PC5)) & !(PINC & (1<<PC4)) & !(PIND & (1<<PD7))) {direction =  1; } // NNNE		else if ( !(PINC & (1<<PC5)) & !(PINC & (1<<PC4)) & !(PINC & (1<<PC3))) {direction =  5; }		else if ( !(PINC & (1<<PC4)) & !(PINC & (1<<PC3)) & !(PINC & (1<<PC2))) {direction =  9; }		else if ( !(PINC & (1<<PC3)) & !(PINC & (1<<PC2)) & !(PIND & (1<<PD4))) {direction = 13; }		else if ( !(PINC & (1<<PC2)) & !(PIND & (1<<PD4)) & !(PIND & (1<<PD5))) {direction = 17; }		else if ( !(PIND & (1<<PD4)) & !(PIND & (1<<PD5)) & !(PIND & (1<<PD6))) {direction = 21; }		else if ( !(PIND & (1<<PD5)) & !(PIND & (1<<PD6)) & !(PIND & (1<<PD7))) {direction = 25; }		else if ( !(PINC & (1<<PC5)) & !(PIND & (1<<PD6)) & !(PIND & (1<<PD7))) {direction = 29; }        else if ( !(PINC & (1<<PC4)) & !(PIND & (1<<PD7)))                       {direction =  0; } // N		else if ( !(PINC & (1<<PC5)) & !(PINC & (1<<PC4)))                       {direction =  2; } // NNE		else if ( !(PINC & (1<<PC5)) & !(PINC & (1<<PC3)))                       {direction =  4; }		else if ( !(PINC & (1<<PC4)) & !(PINC & (1<<PC3)))                       {direction =  6; }		else if ( !(PINC & (1<<PC4)) & !(PINC & (1<<PC2)))                       {direction =  8; } // E		else if ( !(PINC & (1<<PC3)) & !(PINC & (1<<PC2)))                       {direction = 10; }		else if ( !(PINC & (1<<PC3)) & !(PIND & (1<<PD4)))                       {direction = 12; }		else if ( !(PINC & (1<<PC2)) & !(PIND & (1<<PD4)))                       {direction = 14; }		else if ( !(PINC & (1<<PC2)) & !(PIND & (1<<PD5)))                       {direction = 16; } // S		else if ( !(PIND & (1<<PD4)) & !(PIND & (1<<PD5)))                       {direction = 18; }		else if ( !(PIND & (1<<PD4)) & !(PIND & (1<<PD6)))                       {direction = 20; }		else if ( !(PIND & (1<<PD5)) & !(PIND & (1<<PD6)))                       {direction = 22; }		else if ( !(PIND & (1<<PD5)) & !(PIND & (1<<PD7)))                       {direction = 24; } // W		else if ( !(PIND & (1<<PD6)) & !(PIND & (1<<PD7)))                       {direction = 26; }		else if ( !(PINC & (1<<PC5)) & !(PIND & (1<<PD6)))                       {direction = 28; }		else if ( !(PINC & (1<<PC5)) & !(PIND & (1<<PD7)))                       {direction = 30; }		else if ( !(PINC & (1<<PC5)))                                             {direction =  3; } // ENEE		else if ( !(PINC & (1<<PC4)))                                             {direction =  7; }		else if ( !(PINC & (1<<PC3)))                                             {direction = 11; }		else if ( !(PINC & (1<<PC2)))                                             {direction = 15; }		else if ( !(PIND & (1<<PD4)))                                             {direction = 19; }		else if ( !(PIND & (1<<PD5)))                                             {direction = 23; }		else if ( !(PIND & (1<<PD6)))                                             {direction = 27; }		else if ( !(PIND & (1<<PD7)))                                             {direction = 31; }        else         { direction = -1;      }}