#include "LED.h"
#include "Switch.h"
#include <stdio.h>
#define DDR_F 0x30
#define DDR_K 0x107
#define DATA_F_OUT 0x31
#define DATA_K_IN 0x106
#define LEDS 8
#define SWITCHES 8
struct LED leds[LEDS] = {
{DDR_F, DATA_F_OUT,0x01}, // LED 0
{DDR_F, DATA_F_OUT,0x02}, // LED 1
{DDR_F, DATA_F_OUT,0x04}, // LED 2
{DDR_F, DATA_F_OUT,0x08}, // LED 3
{DDR_F, DATA_F_OUT,0x10}, // LED 4
{DDR_F, DATA_F_OUT,0x20}, // LED 5
{DDR_F, DATA_F_OUT,0x40}, // LED 6
{DDR_F, DATA_F_OUT,0x80} // LED 7
};
struct Switch switches[SWITCHES] = {
{DDR_K, DATA_K_IN,0x01}, // Switch 0
{DDR_K, DATA_K_IN,0x02}, // Switch 1
{DDR_K, DATA_K_IN,0x04}, // Switch 2
{DDR_K, DATA_K_IN,0x08}, // Switch 3
{DDR_K, DATA_K_IN,0x10}, // Switch 4
{DDR_K, DATA_K_IN,0x20}, // Switch 5
{DDR_K, DATA_K_IN,0x40}, // Switch 6
{DDR_K, DATA_K_IN,0x80} // Switch 7
};
void setup() {
// put your setup code here, to run once:
volatile uint8_t device;
for (device = 0; device < LEDS; device++) {
setupLED(&leds[device], leds[device].mask);
init_switch(&switches[device]);
}
}
void loop() {
// put your main code here, to run repeatedly:
volatile uint8_t switchClicked;
volatile uint8_t device;
for (device = 0; device < LEDS; device++) {
// switchClicked = read_switch(&switches[device]);
//if (switchClicked) {
glow_led(&leds[device], switches[device].mask);
//}
}
for (long i = 0; i < 80000; i++);
for (device = 0; device < LEDS; device++) {
// switchClicked = read_switch(&switches[device]);
//if (switchClicked) {
glow_led(&leds[device], 0x00);
//}
}
}