/*
 * avrLED.c
 * April 20, 2014
 * Fabacademy 2014
 * This code implements simple LED Blinking, infinitely. It has been tested on ATTiny44 MCU.
 * Notes -
 * 1) The code relies on internal clock for now, which is 8MHz. However, by default there is clock divisor which is set at 8, meaning resulting clock is 1MHz. Hence, F_CPU = 1MHz in the code.
 * 2) Default Fuse bit settings have been used, hence there is no need to create fuse bits values in this case. However, that does not mean Fuse Bits will always remain so. In case there is a need to change from Int. Oscillator to Ext. Crystal, Fuse Bits will change.
 */


#include "avrLED.h"

/*
main
*/
int main(void)
{
    const int numDelys_ms = 1000;

    // LED has been connected over Port A, Pin 3 (PA3). Set this pin to be Output pin.
    PORT_DIR_LED = 1<<PIN_LED;

    //Pull Down all the pins of PORTA.
    PORT_LED = 0;      

    while (1) 
    {
        //Change the state of PA3 to opposite of previous state (toggle).
        PORT_LED ^= 1<<PIN_LED;

        //add delay to take this toggled state ahead for a while.
        _delay_ms (numDelys_ms);
    }

    return 0;
}
