From c8a867ed77563791bd26f061cb0b9d42c34ec4b3 Mon Sep 17 00:00:00 2001
From: Erik Strand <erik@erikstrand.net>
Date: Sun, 21 Oct 2018 00:14:40 -0400
Subject: [PATCH] Update code again

---
 content/08_embedded_programming.md |  2 -
 static/designs/08_blink.c          | 78 ------------------------------
 2 files changed, 80 deletions(-)
 delete mode 100644 static/designs/08_blink.c

diff --git a/content/08_embedded_programming.md b/content/08_embedded_programming.md
index 4f640c9..4875a07 100644
--- a/content/08_embedded_programming.md
+++ b/content/08_embedded_programming.md
@@ -63,7 +63,6 @@ int main(void) {
     // Activate button_pin's pullup resistor.
     PORTA |= button_pin;
 
-    // Nothing left to do, so just spin.
     while (1) {
         // Turn on the LED when the button is pressed.
         if (PINA & button_pin) {
@@ -158,7 +157,6 @@ int main(void) {
     int bouncy_switch_state = 0;
     int debounced_switch_state = 0;
 
-    // Nothing left to do, so just spin.
     while (1) {
         // Use the timer to count how long it's been
         // since button_pin changed state.
diff --git a/static/designs/08_blink.c b/static/designs/08_blink.c
deleted file mode 100644
index eb33d73..0000000
--- a/static/designs/08_blink.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <avr/io.h>
-
-#define switch_pin (1 << PA7)
-#define led_pin (1 << PB2)
-
-int main(void) {
-    // Set the clock prescaler to 1.
-    CLKPR = (1 << CLKPCE);
-    CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
-
-    // Set the 8 bit timer's prescaler to 1/1024.
-    TCCR0B |= 0b00000101;
-
-    // Configure led_pin as an output.
-    DDRB |= led_pin;
-
-    // Configure switch_pin as an input.
-    DDRA |= switch_pin;
-
-    // Activate switch_pin's pullup resistor.
-    PORTA |= switch_pin;
-
-    //int count1 = 0;
-    //int count2 = 0;
-
-    int bouncy_switch_state = 0;
-    int debounced_switch_state = 0;
-
-    while (1) {
-        // Turn on the led when the button is pressed
-        /*
-        if (PINA & switch_pin) {
-            PORTB &= ~led_pin;
-        } else {
-            PORTB |= led_pin;
-        }
-        */
-
-        // ~5s blink period based on counting
-        /*
-        if (++count1 == 255) {
-            if (++count2 == 255) {
-                PORTB ^= led_pin;
-                count1 = 0;
-                count2 = 0;
-            }
-        }
-        */
-
-        // ~2.5s second blink period
-        // 255 * 200 * (1024 / 20M) = 2.6112
-        /*
-        if (TCNT0 >= 200) {
-            TCNT0 = 0;
-            if (++count1 == 255) {
-                PORTB ^= led_pin;
-                count1 = 0;
-            }
-        }
-        */
-
-        // the button toggles the led (with debouncing)
-        if ((PINA & switch_pin) != bouncy_switch_state) {
-            bouncy_switch_state = PINA & switch_pin;
-            TCNT0 = 0;
-        }
-        if (TCNT0 >= 195) {
-            // It's been 10ms since the switch changed.
-            if (bouncy_switch_state != debounced_switch_state) {
-                debounced_switch_state = bouncy_switch_state;
-                if (debounced_switch_state == 0) {
-                    PORTB ^= led_pin;
-                }
-            }
-        }
-    }
-}
-
-- 
GitLab