Ich habe zur obigen Library noch einen System-Timer hinzugefügt, die Inline-Doku verbessert und ein besseres Beispielprogramm eingefügt. Leider ist die Nachricht nun zu groß, das Makefile passt nicht mehr rein. Darum reiche ich es hier nach:

Code:
# Makefile for this AVR project

# make          Compiles the source code into hex files.
# make fuses    Program fuses
# make program  Program flash and eeprom

# make list     Create generated code listing
# make clean    Delete all generated files


# Parameters for avrdude
AVRDUDE_HW = -c usbasp -P USB

# Source files, separated by space.
SRC = main.c nibobee.c

# Microcontroller
# The code is designed for atmega16 or atmega644
MCU = atmega16
F_CPU = 15000000

# Serial port settings
# Set TERMINAL_MODE = 1 to support terminal programs that send and
# expect line breaks in old MS-DOS format.
# Set SERIAL_ECHO = 1 to enable sending back an echo of all incoming
# characters.
USE_SERIAL = 0
BAUD = 115200
TERMINAL_MODE = 1
SERIAL_ECHO = 1

# Fuses
HFUSE = 0xd1
LFUSE = 0xef
#EFUSE = 0xff

# Binaries to be used
# You may add the path to them if they are not in the PATH variable.
CC      = avr-gcc
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
AVRDUDE = avrdude

# Name of the program without extension
PRG = nibobee

# Do we need to write Eeprom? (yes/no)
EEPROM = no

# Libraries
#LIBS = -L ../nibobee-lib/lib -lnibobee_base -lnibobee_usart -lnibobee_utils

# Includes
#INCLUDES = -I../nibobee-lib/include

# Compiler options for all c source files
CFLAGS = -std=c99 -Os -Wall -mmcu=$(MCU) -DF_CPU=$(F_CPU) $(INCLUDES)
CFLAGS += -DUSE_SERIAL=$(USE_SERIAL) -DBAUD=$(BAUD) -DTERMINAL_MODE=$(TERMINAL_MODE) -DSERIAL_ECHO=$(SERIAL_ECHO)

# Linker options 
LDFLAGS = -Wl,-Map,$(PRG).map 

# Enable floating-point support in printf
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -lm

# Collect fuse operations for avrdude
ifdef FUSE
  FUSES += -U fuse:w:$(FUSE):m
endif
ifdef LFUSE
  FUSES += -U lfuse:w:$(LFUSE):m
endif
ifdef HFUSE
  FUSES += -U hfuse:w:$(HFUSE):m
endif
ifdef EFUSE
  FUSES += -U efuse:w:$(EFUSE):m
endif

# Default sections
ifeq ($(EEPROM),yes)
all: code eeprom
else
all: code
endif

# Program code
code: $(PRG).hex

# Eeprom content
eeprom: $(PRG)_eeprom.hex

# Generated code listing
list: $(PRG).lst

# Remove all generated files
clean:
	rm -f *.o $(PRG).hex $(PRG).elf $(PRG).lst $(PRG).map $(PRG)_eeprom.hex

# Program flash memory with or without eeprom
ifeq ($(EEPROM),yes)
program: code eeprom
	$(AVRDUDE) -p $(MCU) $(AVRDUDE_HW) -U flash:w:$(PRG).hex:i -U eeprom:w:$(PRG)_eeprom.hex:i 
else
program: code 
	$(AVRDUDE) -p $(MCU) $(AVRDUDE_HW) -U flash:w:$(PRG).hex:i 
endif

# Program fuses
fuses:
	$(AVRDUDE) -p $(MCU) $(AVRDUDE_HW) $(FUSES)

$(PRG).elf: $(SRC:.c=.o)
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

%.lst: %.elf
	$(OBJDUMP) -h -S $< > $@

%.hex: %.elf
	$(OBJCOPY) -j .text -j .data -O ihex $< $@

%_eeprom.hex: %.elf
	$(OBJCOPY) -j .eeprom --change-section-lma .eeprom=0 -O ihex $< $@