switch_l and switch_r in bughal work now

This commit is contained in:
bigalex 2012-10-01 22:27:16 +02:00
parent 4dc176676f
commit 6d039f5e92
2 changed files with 5 additions and 41 deletions

View File

@ -71,11 +71,11 @@ void init_switch(void){
} }
bool switch_l(void){ bool switch_l(void){
return PIND & 0b00000010; return !(PIND & 0b00000001);
}; };
bool switch_r(void){ bool switch_r(void){
return PIND & 0b00000001; return !(PIND & 0b00000010);
}; };

View File

@ -37,47 +37,11 @@ main(void)
//do something //do something
//main polling loop; //main polling loop;
if (timer_expired(&t)){ if (timer_expired(&t)){
if (0==ledmode){ if (switch_l()) {led_on(LED_L);} else {led_off(LED_L);};
ledmode =1; if (switch_r()) {led_on(LED_R);} else {led_off(LED_R);};
led_on(LED_L);
} else {
ledmode=0;
led_off(LED_L);
};
USART0_crlf();
if (0==ct%3){
if (0==ct%5){
//fizzbug
USART0_putc('f');
USART0_putc('i');
USART0_putc('z');
USART0_putc('z');
USART0_putc('b');
USART0_putc('u');
USART0_putc('g');
} else {
//fizz
USART0_putc('f');
USART0_putc('i');
USART0_putc('z');
USART0_putc('z');
}
} else {
if (0==ct%5){
//bug
USART0_putc('b');
USART0_putc('u');
USART0_putc('g');
} else {
USART0_put_uint16(ct);
};
};
timer_set(&t, 50); timer_set(&t, 50);
ct++;
}; //end if timer expired }; //end if timer expired
//USART0_put_uint16(0xA09F); //USART0_put_uint16(0xA09F);