Skip to content

Commit

Permalink
added support for ILI9329(i) with inverted touch
Browse files Browse the repository at this point in the history
  • Loading branch information
kbr committed Oct 20, 2019
1 parent 32784f6 commit cdaad6f
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 2 deletions.
139 changes: 139 additions & 0 deletions atmega328-ili9329i/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
###############################################################################
# Makefile for the project SDrive
###############################################################################

## General Flags
PROJECT = SDrive
MCU = atmega328
TARGET = SDrive.elf
CC = avr-gcc
AWK = awk

## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
//CFLAGS += -Wall -Wpadded -Wshadow -Wa,-gdwarf2 -DF_CPU=16000000UL -Os -funsigned-char -fpack-struct
CFLAGS += -Wall -Wshadow -Wa,-gdwarf2 -DF_CPU=16000000UL -Os -funsigned-char -fpack-struct
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d
CFLAGS += -ffunction-sections -mrelax -mcall-prologues

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS += -Wl,-Map=$@.map -Wl,--gc-sections


## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom

HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings

BIN_FLASH_FLAGS = --change-section-address .eeprom=$(FLASHSIZE) --gap-fill 0xff

DATE = $(shell date +%Y%m%d)
FORMAT = binary

#SWVERSIONMAJOR = 1 moved to SDrive.c
#SWVERSIONMINOR = 2

CDEFS += -DDATE=$(DATE)
#CDEFS += -DSWVERSIONMAJOR=$(SWVERSIONMAJOR)
#CDEFS += -DSWVERSIONMINOR=$(SWVERSIONMINOR)
CFLAGS += $(CDEFS) -DILI9329i

## Include Directories
#INCLUDES = -I"C:\My\BOB\Sdrive\AVRSDrive\..\..\..\..\AVR\WinAVR\avr\include" -I"C:\My\BOB\Sdrive\AVRSDrive\..\..\..\..\AVR\WinAVR\bin"

## Objects that must be built in order to link
#OBJECTS = SDrive.o spi.o mmc.o fat.o delay100us.o timer.o
OBJECTS = SDrive.o spi.o mmc.o fat.o usart.o tft.o display.o touchscreen.o atx.o atx_avr.o
OBJECTS += tape.o

## Objects explicitly added by the user
LINKONLYOBJECTS =

## Build
all: $(TARGET) SDrive.hex SDrive.eep SDrive.lss SDrive.bin size eeprom_writer.hex

## Compile
#delay100us.o: ../delay100us.s
# $(CC) $(INCLUDES) $(ASMFLAGS) -c $<

SDrive.o: ../SDrive.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

spi.o: ../spi.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

mmc.o: ../mmc.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

fat.o: ../fat.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

usart.o: ../usart.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

tft.o: ../tft.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

display.o: ../display.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

touchscreen.o: ../touchscreen.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

atx.o: ../atx.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

atx_avr.o: ../atx_avr.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

tape.o: ../tape.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<

##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@

%.eep: $(TARGET)
-avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0
-avr-objcopy $(HEX_EEPROM_FLAGS) -O binary $< $@.bin || exit 0
-xxd -i $@.bin ../eeprom_writer.h || exit 0

%.lss: $(TARGET)
avr-objdump -h -S $< > $@

%.bin: $(TARGET)
avr-objcopy -O $(FORMAT) $(BIN_FLASH_FLAGS) $< $@

size: ${TARGET}
@echo
@avr-size -C --mcu=${MCU} ${TARGET}

## Clean target
.PHONY: clean
clean:
-rm -rf $(OBJECTS) SDrive.elf dep/* SDrive.hex SDrive.eep* SDrive.lss *.map SDrive.bin eeprom_writer.*


## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)

eeprom_writer.hex: ../eeprom_writer.c ../eeprom_writer.h
$(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) -o eeprom_writer.elf display.o $<
avr-objcopy -O ihex $(HEX_FLASH_FLAGS) eeprom_writer.elf $@

dist:
tar cvzf sdrive-ng-$(MCU)-bin.tgz SDrive.hex SDrive.bin SDrive.eep README
4 changes: 2 additions & 2 deletions touchscreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct TSPoint p;
struct TSPoint getPoint () {
cli(); //disable interrupts
setIdling();
#if defined(HX8347G)
#if defined(HX8347G) || defined(ILI9329i)
p.x = map(readTouch(1), TS_MINX, TS_MAXX, 0, MAX_X);
p.y = map(readTouch(0), TS_MINY, TS_MAXY, 0, MAX_Y);
#else
Expand All @@ -132,7 +132,7 @@ struct TSPoint getRawPoint () {
cli();
setIdling();

#if defined(HX8347G)
#if defined(HX8347G) || defined(ILI9329i)
p.x = readTouch(1);
p.y = readTouch(0);
#else
Expand Down

0 comments on commit cdaad6f

Please sign in to comment.