FLAGS = -D ACTIVE_HIGH=0 -D SCL_PORT=PORTC -D SCL=4 -D SDA_PORT=PORTC -D SDA=5
UPLOAD = relay-board.hex
UPLOAD_HI = relay-hi.hex

OBJECTS = \
	../i2c-sync/slave_C4_C5.o \
	../handy/i2c_C4_C5.o \
	../handy/wait.o

all: $(UPLOAD) $(UPLOAD_HI)


# NOTE: the ACTIVE_HIGH def must come *after* FLAGS to override the
#       default value of 0.
main-hi.o: main.asm
	gpasm -c $< -o $@ $(FLAGS) -D ACTIVE_HIGH=1


relay-board.hex: $(OBJECTS) main.o
	gplink -m -c $^ -o $@

relay-hi.hex: $(OBJECTS) main-hi.o
	gplink -m -c $^ -o $@

test1.hex: test1.asm

upload-hi upload_hi: $(UPLOAD_HI)
	pk2cmd -P PIC16F688 -M -Z -F $<


include ../include/PIC.mk