2019-08-03 23:42:59 +00:00
|
|
|
#
|
|
|
|
# Usage: make I2C_ADDR=8
|
|
|
|
#
|
|
|
|
|
2019-07-07 01:59:39 +00:00
|
|
|
ifndef TTY
|
|
|
|
TTY=/dev/ttyACM0
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef TARGET
|
2019-07-14 15:15:38 +00:00
|
|
|
TARGET=i2c_timer_pwm
|
2019-07-07 01:59:39 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
MCU=attiny85
|
|
|
|
AVRDUDEMCU=t85
|
|
|
|
CC=/usr/bin/avr-gcc
|
2019-08-03 23:42:59 +00:00
|
|
|
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=$(MCU) -DI2C_SLAVE_ADDRESS=$(I2C_ADDR)
|
2019-07-07 01:59:39 +00:00
|
|
|
OBJ2HEX=/usr/bin/avr-objcopy
|
|
|
|
AVRDUDE=avrdude
|
|
|
|
|
|
|
|
# See http://www.engbedded.com/fusecalc for fuse settings
|
|
|
|
# /usr/bin/avrdude -C/etc/avrdude/avrdude.conf -v -pattiny85 -cstk500v1 -P/dev/ttyACM0 -b19200 -Uflash:w:/tmp/arduino_build_108059/i2c.ino.hex:i
|
|
|
|
#
|
|
|
|
|
2019-08-07 01:36:22 +00:00
|
|
|
# lfuse=0xe2 = 8 Mghz
|
|
|
|
# lfuse=0xe1 = 16 Mghz
|
|
|
|
|
2019-07-07 01:59:39 +00:00
|
|
|
all:
|
|
|
|
$(CC) $(CFLAGS) $(TARGET).c usiTwiSlave.c -o$(TARGET)
|
|
|
|
$(OBJ2HEX) -R .eeprom -O ihex $(TARGET) $(TARGET).hex
|
|
|
|
|
|
|
|
burn:
|
2019-08-07 01:36:22 +00:00
|
|
|
$(AVRDUDE) -p $(MCU) -P $(TTY) -C/etc/avrdude/avrdude.conf -v -c avrisp -b 19200 -U flash:w:$(TARGET).hex -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xff:m
|
2019-07-07 01:59:39 +00:00
|
|
|
clean:
|
|
|
|
rm -f *.hex *.obj *.o
|
|
|
|
|