From: Martin Mares Date: Fri, 23 Aug 2013 19:56:26 +0000 (+0200) Subject: Tenar: Swapped pins X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=09a249bb66d40a0e2e52727c742273914ba44231;p=misc.git Tenar: Swapped pins --- diff --git a/tenar/tenar.c b/tenar/tenar.c index d69c0ad..3b9d1c2 100644 --- a/tenar/tenar.c +++ b/tenar/tenar.c @@ -9,8 +9,8 @@ * * +-------------------+ * | RESET* VCC | - * output RESET* | PB3 SCK | - * diagnostic LED* | PB4 MISO | + * diagnostic LED* | PB3 SCK | + * output RESET* | PB4 MISO | * | GND MOSI | * +-------------------+ */ @@ -35,21 +35,21 @@ static void sleep(uint16_t millisec) int main(void) { - PORTB &= ~B(PB3); // PB3: tri-stated - DDRB |= B(PB4); // PB4: output + PORTB &= ~B(PB4); // PB4: tri-stated + DDRB |= B(PB3); // PB3: output for (byte i=0; i<5; i++) { - PORTB &= ~B(PB4); + PORTB &= ~B(PB3); sleep(100); - PORTB |= B(PB4); + PORTB |= B(PB3); sleep(900); } - PORTB &= ~B(PB4); - DDRB |= B(PB3); // PB3: output 0 + PORTB &= ~B(PB3); + DDRB |= B(PB4); // PB4: output 0 sleep(300); - DDRB &= ~B(PB3); // PB3: tri-state - PORTB |= B(PB4); + DDRB &= ~B(PB4); // PB4: tri-state + DDRB &= ~B(PB3); // PB3: tri-state to save power for (;;) { set_sleep_mode(SLEEP_MODE_PWR_DOWN);