From 0825cd2f44b27349b50a85a6630ff31d5712e6ba Mon Sep 17 00:00:00 2001 From: Silver Kits Date: Tue, 4 Oct 2016 21:56:44 +0300 Subject: [PATCH] Add Arduino 1602LCD Shield settings and LCD lib usage to the project --- Makefile | 4 +++- lib/hd44780_111/hd44780_settings.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 lib/hd44780_111/hd44780_settings.h diff --git a/Makefile b/Makefile index 5f4fe7a..941fa71 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,8 @@ ELF = $(BINDIR)/$(BOARD)-user-code.elf # Source files. wildard "uses" all .c files in src directory SRCDIR = src -SRC = $(wildcard $(SRCDIR)/*.c) +BUILD_LIBS_DIR = lib +SRC = $(wildcard $(SRCDIR)/*.c $(BUILD_LIBS_DIR)/*/*.c) # Define object files from .c files defined above OBJ=$(SRC:.c=.o) @@ -76,6 +77,7 @@ clean: #Do not remove .placeholder in BINDIR find $(BINDIR) -type f -not -name '.placeholder' -print0 | xargs -0 rm -f -- rm -f $(SRCDIR)/*.o + rm -fr $(BUILD_LIBS_DIR)/*/*.o install: $(AVRDUDE) $(AVRDUDEARGS) -U flash:w:$(TARGET) diff --git a/lib/hd44780_111/hd44780_settings.h b/lib/hd44780_111/hd44780_settings.h new file mode 100755 index 0000000..5d5c954 --- /dev/null +++ b/lib/hd44780_111/hd44780_settings.h @@ -0,0 +1,30 @@ +#ifndef HD44780_SETTINGS_H +#define HD44780_SETTINGS_H + +#define USE_ADELAY_LIBRARY 0 +#define LCD_BITS 4 +#define RW_LINE_IMPLEMENTED 0 +#define WAIT_MODE 0 +#define DELAY_RESET 15 + +// Pin and port definitions for Arduino Mega 2560 +#define LCD_DB4_PORT PORTG +#define LCD_DB4_PIN 5 +#define LCD_DB5_PORT PORTE +#define LCD_DB5_PIN 3 +#define LCD_DB6_PORT PORTH +#define LCD_DB6_PIN 3 +#define LCD_DB7_PORT PORTH +#define LCD_DB7_PIN 4 + +#define LCD_RS_PORT PORTH +#define LCD_RS_PIN 5 + +#define LCD_DISPLAYS 1 + +#define LCD_DISPLAY_LINES 2 + +#define LCD_E_PORT PORTH +#define LCD_E_PIN 6 + +#endif /* HD44780_SETTINGS_H */