58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
|
#ifndef __MAIN_H_
|
||
|
#define __MAIN_H_
|
||
|
|
||
|
#define F_CPU 1200000UL // Chip left with
|
||
|
// default factory fuse values
|
||
|
// Low = 0x6A
|
||
|
// High = 0xFF
|
||
|
// Internal oscillator on 9.6MHZ with
|
||
|
// clock divided by 8, thus making
|
||
|
// making CPU to run at 1.2MHZ
|
||
|
|
||
|
#include <avr/io.h>
|
||
|
#include <avr/interrupt.h>
|
||
|
#include <avr/eeprom.h>
|
||
|
#include <avr/sleep.h>
|
||
|
#include <util/delay.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
|
||
|
// Global Variable declarations --------------
|
||
|
uint8_t cur_led = 7; // This will hold the
|
||
|
// current LED that is
|
||
|
// turned ON, starting
|
||
|
// with the central LED
|
||
|
// number 7
|
||
|
|
||
|
uint8_t stand_cycle = 0; // Saves the
|
||
|
// standby number of
|
||
|
// times will blink
|
||
|
|
||
|
uint8_t led_table[9] = { // Table that
|
||
|
// holds the first
|
||
|
// nibble for DDRB
|
||
|
// and second nibble
|
||
|
// for PORTB
|
||
|
|
||
|
0b00000000, // Led's off
|
||
|
0b00010011, // Led 1
|
||
|
0b00100110, // Led 2
|
||
|
0b01001100, // Led 3
|
||
|
0b00100011, // Led 4
|
||
|
0b01000110, // Led 5
|
||
|
0b10001100, // Led 6
|
||
|
0b01000101, // Led 7
|
||
|
0b00010101 // Led tester point
|
||
|
};
|
||
|
// -------------------------------------------
|
||
|
|
||
|
|
||
|
// Functions declarations --------------------
|
||
|
void what_led(uint8_t led); // Function to
|
||
|
// turn ON given
|
||
|
// led number with
|
||
|
// charlieplex
|
||
|
// -------------------------------------------
|
||
|
|
||
|
#endif
|