add i2c lib by Peter Fleury

This commit is contained in:
2021-04-29 01:47:53 +02:00
parent 852a2ef8a5
commit 1e51c8a151
4 changed files with 389 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
TARGET = main
FILES = main modbus buffer pid
FILES = main modbus buffer pid twimaster adc
MCU = atmega328p
PROGC = m328p
CC = avr-gcc
@@ -8,8 +8,8 @@ TOOL = atmelice_isp
BUILDDIR = build
DEFINES = -DF_CPU=18432000UL
CFLAGS =-mmcu=$(MCU) -O2 -Wall $(DEFINES) -I. -std=c99 -ffunction-sections -fdata-sections
CFLAGS =-mmcu=$(MCU) -g -O2 -Wall $(DEFINES) -I. -std=c99 -ffunction-sections -fdata-sections
LDFLAGS =-mmcu=$(MCU) -Wl,--gc-sections
LDFILES = $(foreach FILE,$(FILES),$(BUILDDIR)/$(FILE).o)
@@ -25,19 +25,17 @@ $(BUILDDIR)/$(TARGET).elf: $(LDFILES)
$(CC) $(LDFLAGS) $(LDFILES) -o $(BUILDDIR)/$(TARGET).elf
$(BUILDDIR)/$(TARGET).hex : $(BUILDDIR)/$(TARGET).elf
avr-objcopy -j .data -j .text -O ihex $< $@
avr-objcopy -j .data -j .text -O ihex $< $@
fuse:
avrdude -p $(PROGC) -c $(TOOL) -U lfuse:w:0xE8:m -U hfuse:w:0xD1:m
.PHONY=load program size clean
load: $(BUILDDIR)/$(TARGET).hex
avrdude -p $(PROGC) -c $(TOOL) -U flash:w:$(BUILDDIR)/$(TARGET).hex -v -B 2
avrdude -p $(PROGC) -c $(TOOL) -U flash:w:$(BUILDDIR)/$(TARGET).hex -v -B 4MHz
program: clean load
size: $(BUILDDIR)/$(TARGET).elf
avr-size -C --mcu=$(MCU) $(BUILDDIR)/$(TARGET).elf
.PHONY=clean
clean:
rm -rf $(BUILDDIR)