From 26209772e79fea32e443104c817c8bb345ea6fed Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Tue, 18 Mar 2014 01:14:19 +0100 Subject: [PATCH 1/2] remove old port definitions and fix missing include --- led1642gw.c | 15 --------------- rgbyteclock.c | 6 +----- rgbyteclock.h | 2 +- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/led1642gw.c b/led1642gw.c index dd7162b..19de748 100644 --- a/led1642gw.c +++ b/led1642gw.c @@ -45,35 +45,26 @@ static void write_data(uint16_t data, uint8_t le_clocks) { uint16_t mask = 0x8000; int8_t bit; - //PORTC &= ~(1<=le_clocks; bit--) { - //PORTC &= ~(1<>= 1; } - //PORTC |= (1<=0; bit--) { - //PORTC &= ~(1<>= 1; } - //PORTC &= ~(1< - +#include "ledcontroller.h" void rgbyteclock(void); From 07b8628080adf110d42482f00aa375200ada1e6c Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Tue, 18 Mar 2014 01:19:43 +0100 Subject: [PATCH 2/2] put application specific config for led1642 into separate header file --- Makefile | 2 +- led1642gw.c | 23 ++--------------------- led1642gw_config.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 led1642gw_config.h diff --git a/Makefile b/Makefile index 63a0925..ff3c4fb 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ $(PRG).elf: $(OBJ) rgbyteclock.o: timer.o lcd.o rgbyteclock.h rtc.o spi.o ledcontroller.o main.o: rgbyteclock.o lcd.o spi.o ledcontroller.o rtc.o timer.o ledcontroller.o: led1642gw.o -led1642gw.o: led1642gw.h +led1642gw.o: led1642gw.h led1642gw_config.h timer.o: timer.h lcd.o: lcd.h timer.o rtc.o: rtc.h diff --git a/led1642gw.c b/led1642gw.c index 19de748..00e9996 100644 --- a/led1642gw.c +++ b/led1642gw.c @@ -15,32 +15,13 @@ #include "led1642gw.h" #include +#include "led1642gw_config.h" + #define NUM_LED1642GW_CHANNELS (16) #define NUM_LED_CHANNELS (NUM_LED1642GW_CHANNELS*NUM_LED1642GW_ICs) -#define NUM_LED1642GW_ICs (3) static uint16_t ledbuffer[NUM_LED_CHANNELS]; - -#define DDR_CLK (DDRC) -#define PORT_CLK (PORTC) -#define PIN_CLK (3) -#define SET_CLK_H() ((PORT_CLK) |= (1<<(PIN_CLK))) -#define SET_CLK_L() ((PORT_CLK) &= ~(1<<(PIN_CLK))) - -#define DDR_SDI (DDRC) -#define PORT_SDI (PORTC) -#define PIN_SDI (4) -#define SET_SDI_H() ((PORT_SDI) |= (1<<(PIN_SDI))) -#define SET_SDI_L() ((PORT_SDI) &= ~(1<<(PIN_SDI))) - -#define DDR_LE (DDRC) -#define PORT_LE (PORTC) -#define PIN_LE (2) -#define SET_LE_H() ((PORT_LE) |= (1<<(PIN_LE))) -#define SET_LE_L() ((PORT_LE) &= ~(1<<(PIN_LE))) - - static void write_data(uint16_t data, uint8_t le_clocks) { uint16_t mask = 0x8000; diff --git a/led1642gw_config.h b/led1642gw_config.h new file mode 100644 index 0000000..f688960 --- /dev/null +++ b/led1642gw_config.h @@ -0,0 +1,28 @@ + +#ifndef LED1642GW_CONFIG_H_ +#define LED1642GW_CONFIG_H_ + +#define NUM_LED1642GW_ICs (3) + +#define DDR_CLK (DDRC) +#define PORT_CLK (PORTC) +#define PIN_CLK (3) +#define SET_CLK_H() ((PORT_CLK) |= (1<<(PIN_CLK))) +#define SET_CLK_L() ((PORT_CLK) &= ~(1<<(PIN_CLK))) + +#define DDR_SDI (DDRC) +#define PORT_SDI (PORTC) +#define PIN_SDI (4) +#define SET_SDI_H() ((PORT_SDI) |= (1<<(PIN_SDI))) +#define SET_SDI_L() ((PORT_SDI) &= ~(1<<(PIN_SDI))) + +#define DDR_LE (DDRC) +#define PORT_LE (PORTC) +#define PIN_LE (2) +#define SET_LE_H() ((PORT_LE) |= (1<<(PIN_LE))) +#define SET_LE_L() ((PORT_LE) &= ~(1<<(PIN_LE))) + + + +#endif // LED1642GW_CONFIG_H_ +