diff --git a/firmware/main.c b/firmware/main.c index d0f0ef4..8cb8ce1 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -32,7 +32,9 @@ #include "ir_nec.h" #include "settings.h" -#include /* EEPROM handling */ +volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD,&PORTD,&PORTD}; +volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2] = {&DDRC,&DDRC,&DDRC,&DDRC,&DDRC,&DDRD,&DDRD,&DDRD,&DDRD,&DDRD}; +const uint8_t BITS[CHANNELS_1+CHANNELS_2] = {PC0,PC1,PC2,PC3,PC4}; /* global variables */ #define INPUT_MAX 255 /* max length for user input string */ @@ -181,10 +183,10 @@ void ioinit(void) TIMSK1 |= (1<0) { OCR0A--; diff --git a/firmware/main.h b/firmware/main.h index 6f94a9f..5aff61d 100644 --- a/firmware/main.h +++ b/firmware/main.h @@ -16,23 +16,19 @@ * It handles all peripherals (power, fan, channels, IR, serial) */ -/* ports */ +/* peripheral I/O */ #define LED PD6 /* status LED */ #define IR PB0 /* IR receiver */ #define FAN PC5 /* FAN output */ #define PWR_OK PB1 /* ATX power OK */ #define nPS_ON PB2 /* ATX power supply ON switch */ -/* LEDs */ -#define CH1_1 PC0 -#define CH1_2 PC1 -#define CH1_3 PC2 -#define CH1_4 PC3 -#define CH1_5 PC4 -#define CH2_1 PD2 -#define CH2_2 PD3 -#define CH2_3 PD4 -#define CH2_4 PD5 -#define CH2_5 PD7 + +/* channel definitions */ +#define CHANNELS_1 5 /* the number of outputs for channel 1 */ +#define CHANNELS_2 5 /* the number of outputs for channel 2 */ +extern volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2]; /* channel ports */ +extern volatile uint8_t* DDRS[CHANNELS_1+CHANNELS_2]; /* channel I/O configuration registers */ +extern const uint8_t BITS[CHANNELS_1+CHANNELS_2]; /* channel bits */ void ioinit(void); void uart_action(char c); diff --git a/firmware/settings.c b/firmware/settings.c index eb7eb0e..9f4292c 100644 --- a/firmware/settings.c +++ b/firmware/settings.c @@ -3,11 +3,10 @@ #include /* Boolean */ #include /* EEPROM handling */ +#include "main.h" #include "settings.h" /* initialize variable */ -volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2] = {&PORTC,&PORTC,&PORTC,&PORTC,&PORTC,&PORTD,&PORTD,&PORTD,&PORTD,&PORTD}; -const uint8_t BITS[CHANNELS_1+CHANNELS_2] = {PC0,PC1,PC2,PC3,PC4}; uint8_t brightness[MODES][CHANNELS_1+CHANNELS_2]; uint8_t mode; uint8_t ir_keys[IR_ACTION_END][2]; diff --git a/firmware/settings.h b/firmware/settings.h index 3be1c24..53413fb 100644 --- a/firmware/settings.h +++ b/firmware/settings.h @@ -1,11 +1,3 @@ -#include /* AVR device-specific IO definitions */ - -/* channel definitions */ -#define CHANNELS_1 5 /* the number of outputs for channel 1 */ -#define CHANNELS_2 5 /* the number of outputs for channel 2 */ -extern volatile uint8_t* PORTS[CHANNELS_1+CHANNELS_2]; /* channel ports */ -extern const uint8_t BITS[CHANNELS_1+CHANNELS_2]; /* channel bits */ - /* mode settings */ #define MODES 3 /* the number of modes */ extern uint8_t mode; /* the current mode */ //TODO load the mode