]> mj.ucw.cz Git - misc.git/commitdiff
Tenar: Swapped pins
authorMartin Mares <mj@ucw.cz>
Fri, 23 Aug 2013 19:56:26 +0000 (21:56 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 23 Aug 2013 19:56:26 +0000 (21:56 +0200)
tenar/tenar.c

index d69c0ad916dda0ccff56b3e869db3cb6cf5ac068..3b9d1c29ca5ce132cdb9a2b7dae314da048218e5 100644 (file)
@@ -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);