From f036f73bb830edc8f0f78c59a8af0a8cf3d5a8da Mon Sep 17 00:00:00 2001 From: Stefan Rupp Date: Sat, 1 Mar 2014 23:52:49 +0100 Subject: [PATCH] improved LCD code and changed pins --- Makefile | 14 +++++++------- lcd.c | 29 +++++++++++++++++------------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 0e67b4a..c49d003 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PRG = rgbyteclock -OBJ = rgbyteclock.o timer.o lcd.o main.o rtc.o spi.o ringbuffer.o crc.o +OBJ = rgbyteclock.o timer.o lcd.o main.o rtc.o spi.o ringbuffer.o crc.o led1642gw.o MCU_TARGET = atmega164a OPTIMIZE = -Os @@ -25,15 +25,15 @@ $(PRG).elf: $(OBJ) @echo # dependency: -rgbyteclock.o: timer.o lcd.o rgbyteclock.h rtc.o -main.o: rgbyteclock.o -timer.o:timer.h -lcd.o: lcd.h +rgbyteclock.o: timer.o lcd.o rgbyteclock.h rtc.o spi.o led1642gw.o +main.o: rgbyteclock.o lcd.o spi.o led1642gw.o +timer.o: timer.h +lcd.o: lcd.h timer.o rtc.o: rtc.h -spi.o: spi.h +spi.o: spi.h crc.o ringbuffer.o ringbuffer.o: ringbuffer.h crc.o: crc.h - +led1642gw.o: led1642gw.h clean: rm -rf *.o $(PRG).elf *.eps *.png *.pdf *.bak diff --git a/lcd.c b/lcd.c index f575d97..ae1b59f 100644 --- a/lcd.c +++ b/lcd.c @@ -16,7 +16,13 @@ #include "timer.h" #include "lcd.h" -//#define WAIT_250_ns() _delay_us(1) +#define LCD_DATA_PIN (PINA) +#define LCD_DATA_PORT (PORTA) +#define LCD_DATA_DIR (DDRA) +#define LCD_DATA_MASK (0x0f) + + + #if (F_CPU <= 4000000UL) #define WAIT_250_ns() _NOP() #elif (F_CPU <= 8000000UL) @@ -32,15 +38,15 @@ #define WAIT_250_ns() _delay_us(1) #endif -#define LCD_DATA_MODE() (PORTD |= (1<