]> jspc29.x-matter.uni-frankfurt.de Git - avr.git/commitdiff
add first files for step motor controller master
authorJan Michel <mail@janmichel.eu>
Mon, 6 Apr 2026 17:27:38 +0000 (19:27 +0200)
committerJan Michel <mail@janmichel.eu>
Mon, 6 Apr 2026 17:27:38 +0000 (19:27 +0200)
23 files changed:
atmega32u4/stepmotorcontroller/Makefile [new file with mode: 0644]
atmega32u4/stepmotorcontroller/README.md [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/.gitattributes [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/.gitignore [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/digits_24px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/digits_32px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_fixed_16bit.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_fixed_8px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_proportional_16px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_proportional_8px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/symbols_16px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/symbols_8px.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/Fonts/template_simplefont.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/README.md [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/dogm-graphic.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/dogm-graphic.h [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/font.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/font.h [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/lcd-color-graphic.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/lcdlib/lcd-color-graphic.h [new file with mode: 0644]
atmega32u4/stepmotorcontroller/main.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/usb_serial.c [new file with mode: 0644]
atmega32u4/stepmotorcontroller/usb_serial.h [new file with mode: 0644]

diff --git a/atmega32u4/stepmotorcontroller/Makefile b/atmega32u4/stepmotorcontroller/Makefile
new file mode 100644 (file)
index 0000000..8ee15d8
--- /dev/null
@@ -0,0 +1,230 @@
+# Hey Emacs, this is a -*- makefile -*-
+
+# AVR-GCC Makefile template, derived from the WinAVR template (which
+# is public domain), believed to be neutral to any flavor of "make"
+# (GNU make, BSD make, SysV make)
+
+
+MCU = atmega32u4
+FORMAT = ihex
+TARGET = main
+SRC = $(TARGET).c usb_serial.c 
+ASRC = 
+OPT = 2
+PORT=/dev/ttyACM0
+
+# Name of this Makefile (used for "make depend").
+MAKEFILE = Makefile
+
+# Debugging format.
+# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2.
+# AVR (extended) COFF requires stabs, plus an avr-objcopy run.
+DEBUG = stabs
+
+# Compiler flag to set the C Standard level.
+# c89   - "ANSI" C
+# gnu89 - c89 plus GCC extensions
+# c99   - ISO C99 standard (not yet fully implemented)
+# gnu99 - c99 plus GCC extensions
+CSTANDARD = -std=gnu99
+
+# Place -D or -U options here
+CDEFS = -DF_CPU=8000000
+
+# Place -I options here
+CINCS =
+
+
+CDEBUG = -g$(DEBUG)
+CWARN = -Wall -Wstrict-prototypes 
+CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums  -Wl,--relax
+#CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
+CFLAGS = $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CSTANDARD) $(CEXTRA) $(CTUNING) -DSTR_SERIAL_NUMBER=L\"$(NUMBER)\"
+
+
+#ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs 
+
+
+#Additional libraries.
+
+# Minimalistic printf version
+PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
+
+# Floating point printf version (requires MATH_LIB = -lm below)
+PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
+
+PRINTF_LIB = 
+
+# Minimalistic scanf version
+SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
+
+# Floating point + %[ scanf version (requires MATH_LIB = -lm below)
+SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
+
+SCANF_LIB = 
+
+MATH_LIB = -lm
+
+# External memory options
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# used for variables (.data/.bss) and heap (malloc()).
+#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff
+
+# 64 KB of external RAM, starting after internal RAM (ATmega128!),
+# only used for heap (malloc()).
+#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff
+
+EXTMEMOPTS =
+
+#LDMAP = $(LDFLAGS) -Wl,-Map=$(TARGET).map,--cref
+LDFLAGS = $(EXTMEMOPTS) $(LDMAP) $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
+
+
+# Programming support using avrdude. Settings and variables.
+
+AVRDUDE_PROGRAMMER = dragon_jtag
+AVRDUDE_PORT = usb
+
+AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
+#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
+
+
+# Uncomment the following if you want avrdude's erase cycle counter.
+# Note that this counter needs to be initialized first using -Yn,
+# see avrdude manual.
+#AVRDUDE_ERASE_COUNTER = -y
+
+# Uncomment the following if you do /not/ wish a verification to be
+# performed after programming the device.
+AVRDUDE_NO_VERIFY = -V
+
+# Increase verbosity level.  Please use this when submitting bug
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> 
+# to submit bug reports.
+#AVRDUDE_VERBOSE = -v -v
+
+AVRDUDE_BASIC = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER)
+AVRDUDE_FLAGS = $(AVRDUDE_BASIC) $(AVRDUDE_NO_VERIFY) $(AVRDUDE_VERBOSE) $(AVRDUDE_ERASE_COUNTER)
+
+
+CC = avr-gcc
+OBJCOPY = avr-objcopy
+OBJDUMP = avr-objdump
+SIZE = avr-size
+NM = avr-nm
+AVRDUDE = avrdude
+REMOVE = rm -f
+MV = mv -f
+
+# Define all object files.
+OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) 
+
+# Define all listing files.
+LST = $(ASRC:.S=.lst) $(SRC:.c=.lst)
+
+# Combine all necessary flags and optional flags.
+# Add target processor to flags.
+ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS)
+ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
+
+
+# Default target.
+all: build
+
+build: elf hex eep
+
+elf: $(TARGET).elf
+hex: $(TARGET).hex
+eep: $(TARGET).eep
+lss: $(TARGET).lss 
+sym: $(TARGET).sym
+
+
+# Program the device.  
+program: $(TARGET).hex $(TARGET).eep
+       $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
+
+
+size: 
+       $(SIZE) -C --mcu=$(MCU)   $(TARGET).elf 
+
+# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB.
+COFFCONVERT=$(OBJCOPY) --debugging \
+--change-section-address .data-0x800000 \
+--change-section-address .bss-0x800000 \
+--change-section-address .noinit-0x800000 \
+--change-section-address .eeprom-0x810000 
+
+
+coff: $(TARGET).elf
+       $(COFFCONVERT) -O coff-avr $(TARGET).elf $(TARGET).cof
+
+
+extcoff: $(TARGET).elf
+       $(COFFCONVERT) -O coff-ext-avr $(TARGET).elf $(TARGET).cof
+
+
+.SUFFIXES: .elf .hex .eep .lss .sym
+
+.elf.hex:
+       $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@
+
+.elf.eep:
+       -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \
+       --change-section-lma .eeprom=0 -O $(FORMAT) $< $@
+
+# Create extended listing file from ELF output file.
+.elf.lss:
+       $(OBJDUMP) -h -S $< > $@
+
+# Create a symbol table from ELF output file.
+.elf.sym:
+       $(NM) -n $< > $@
+
+
+
+# Link: create ELF output file from object files.
+$(TARGET).elf: $(OBJ)
+       $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)
+
+
+# Compile: create object files from C source files.
+.c.o:
+       $(CC) -c $(ALL_CFLAGS) $< -o $@ 
+
+
+# Compile: create assembler files from C source files.
+.c.s:
+       $(CC) -S $(ALL_CFLAGS) $< -o $@
+
+
+# Assemble: create object files from assembler source files.
+.S.o:
+       $(CC) -c $(ALL_ASFLAGS) $< -o $@
+
+
+# Target: clean project.
+clean:
+       $(REMOVE) $(TARGET).hex $(TARGET).eep $(TARGET).cof $(TARGET).elf \
+       $(TARGET).map $(TARGET).sym $(TARGET).lss \
+       $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d)
+
+depend:
+       if grep '^# DO NOT DELETE' $(MAKEFILE) >/dev/null; \
+       then \
+               sed -e '/^# DO NOT DELETE/,$$d' $(MAKEFILE) > \
+                       $(MAKEFILE).$$$$ && \
+               $(MV) $(MAKEFILE).$$$$ $(MAKEFILE); \
+       fi
+       echo '# DO NOT DELETE THIS LINE -- make depend depends on it.' \
+               >> $(MAKEFILE); \
+       $(CC) -M -mmcu=$(MCU) $(CDEFS) $(CINCS) $(SRC) $(ASRC) >> $(MAKEFILE)
+
+.PHONY:        all build elf hex eep lss sym program coff extcoff clean depend program_bootloader program_arduino
+
+program_bootloader: all
+       dfu-programmer $(MCU) erase && dfu-programmer $(MCU) flash $(TARGET).hex && dfu-programmer $(MCU) start
+
+program_arduino: all
+       avrdude -patmega32u4 -cavr109 -P$(PORT) -b57600 -D -Uflash:w:$(TARGET).hex:i
diff --git a/atmega32u4/stepmotorcontroller/README.md b/atmega32u4/stepmotorcontroller/README.md
new file mode 100644 (file)
index 0000000..626d834
--- /dev/null
@@ -0,0 +1,26 @@
+# Step Motor Controller
+
+
+
+------------------------------------------------------------------------------------------------------------------------
+
+## Installation
+
+1. make
+2. connect the Board via MicroUSB
+3. RESET the Microcontroller
+4. dfu-programmer atmega32u4 erase --force
+5. make program_bootloader
+
+------------------------------------------------------------------------------------------------------------------------
+
+## Protocol definition
+
+ **Data format:**    *XRRvvvvvvvv*
+         X    - command   (write: W, read: R, answer: A)
+         RR   - register (Hex value)
+         vvvvvvvv - 32 Bit value
+
+         close with a "\n"
+         e.g. "W0200000000\n"
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/.gitattributes b/atmega32u4/stepmotorcontroller/lcdlib/.gitattributes
new file mode 100644 (file)
index 0000000..670c7f1
--- /dev/null
@@ -0,0 +1,4 @@
+* text=auto
+*.c text
+*.h text
+*.font binary
\ No newline at end of file
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/.gitignore b/atmega32u4/stepmotorcontroller/lcdlib/.gitignore
new file mode 100644 (file)
index 0000000..9fa3b1b
--- /dev/null
@@ -0,0 +1,18 @@
+# Object files
+*.o
+*.ko
+
+# Libraries
+*.lib
+*.a
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/digits_24px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/digits_24px.c
new file mode 100644 (file)
index 0000000..e0af34c
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : digits_24px.c
+    Date                : 13.03.2010
+    Font size in bytes  : 0x05AC, 1452
+    Font width          : 19
+    Font height         : 24
+    Font first char     : 0x25
+    Font last char      : 0xBE
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_digits_24px
+
+
+
+const uint8_t digits_24px_data[] PROGMEM = {
+    0x12, 0x00, 0x03, 0x05, 0x05, 0x00, 0x0D, 0x06, 0x08, 0x04, 0x0E, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 
+    0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x04, 0x00, 0x11, 0x11, 0x11, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x0D, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x0D, 0x09, 0x09, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x11, 0x11, 0x11, 
+    0xF0, 0x00, 0x00, 0xFC, 0x83, 0x01, 0x0C, 0xC3, 0x00, 0x06, 0xC6, 0x00, 0x06, 0x46, 0x00, 0x06, 
+    0x66, 0x00, 0x06, 0x26, 0x00, 0x0C, 0x33, 0x00, 0xFC, 0x33, 0x1E, 0xF0, 0x98, 0x7F, 0x00, 0x98, 
+    0x61, 0x00, 0xC8, 0xC0, 0x00, 0xCC, 0xC0, 0x00, 0xC4, 0xC0, 0x00, 0xC6, 0xC0, 0x00, 0x86, 0x61, 
+    0x00, 0x83, 0x7F, 0x00, 0x00, 0x1E, 0xFE, 0x01, 0x00, 0xFE, 0x01, 0x00, 0xFE, 0x01, 0x00, 0x00, 
+    0xFF, 0x01, 0xF0, 0xFF, 0x1F, 0xF8, 0xFF, 0x3F, 0x7C, 0x00, 0x7C, 0x0C, 0x00, 0x60, 0x0C, 0x00, 
+    0x60, 0x7C, 0x00, 0x7C, 0xF8, 0xFF, 0x3F, 0xF0, 0xFF, 0x1F, 0x00, 0xFF, 0x01, 0x00, 0x38, 0x00, 
+    0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0xE0, 0xFF, 0x0F, 0xE0, 
+    0xFF, 0x0F, 0xE0, 0xFF, 0x0F, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 
+    0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xF0, 0x00, 0x80, 0x7F, 0x00, 0x80, 0x3F, 
+    0x00, 0x80, 0x0F, 0x00, 0x80, 0x07, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 
+    0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 
+    0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x80, 0x00, 0x00, 0xE0, 
+    0x00, 0x00, 0xFC, 0x00, 0x00, 0x7F, 0x00, 0xC0, 0x1F, 0x00, 0xF0, 0x03, 0x00, 0xFC, 0x00, 0x00, 
+    0x3F, 0x00, 0xE0, 0x0F, 0x00, 0xF8, 0x03, 0x00, 0xFE, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x07, 0x00, 
+    0x00, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0x01, 0xF0, 0xFF, 0x07, 0xFC, 0xFF, 0x1F, 0x7E, 0x00, 0x3F, 
+    0x0E, 0x00, 0x3C, 0x0F, 0x00, 0x78, 0x07, 0x08, 0x70, 0x07, 0x1C, 0x70, 0x07, 0x08, 0x70, 0x0F, 
+    0x00, 0x78, 0x0E, 0x00, 0x38, 0x7E, 0x00, 0x3F, 0xFC, 0xFF, 0x1F, 0xF0, 0xFF, 0x07, 0xC0, 0xFF, 
+    0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x0E, 0x00, 0x70, 0x0E, 0x00, 0x70, 0x0F, 0x00, 0x70, 
+    0x07, 0x00, 0x70, 0x07, 0x00, 0x70, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0x00, 
+    0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x0E, 0x00, 
+    0x70, 0x0E, 0x00, 0x78, 0x07, 0x00, 0x7C, 0x07, 0x00, 0x7E, 0x07, 0x00, 0x77, 0x07, 0x80, 0x77, 
+    0x07, 0xC0, 0x73, 0x07, 0xE0, 0x71, 0x07, 0xF0, 0x70, 0x07, 0xF8, 0x70, 0x0E, 0x7C, 0x70, 0x1E, 
+    0x3E, 0x70, 0xFC, 0x1F, 0x70, 0xFC, 0x0F, 0x70, 0xF0, 0x03, 0x70, 0x00, 0x00, 0x38, 0x0E, 0x00, 
+    0x38, 0x0E, 0x00, 0x70, 0x07, 0x00, 0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 
+    0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 0x0F, 0x1F, 0x70, 0x0E, 0x1B, 0x38, 0xFE, 0x3B, 0x3C, 0xFC, 
+    0xF1, 0x1F, 0xF8, 0xF0, 0x1F, 0x00, 0xC0, 0x07, 0x00, 0xC0, 0x03, 0x00, 0xE0, 0x03, 0x00, 0xF8, 
+    0x03, 0x00, 0xBE, 0x03, 0x00, 0x8F, 0x03, 0xC0, 0x83, 0x03, 0xE0, 0x81, 0x03, 0x78, 0x80, 0x03, 
+    0x1E, 0x80, 0x03, 0x0F, 0x80, 0x03, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0x7F, 0x00, 
+    0x80, 0x03, 0x00, 0x80, 0x03, 0x00, 0x00, 0x38, 0xFF, 0x0F, 0x38, 0xFF, 0x07, 0x70, 0xFF, 0x07, 
+    0x70, 0x07, 0x07, 0x70, 0x07, 0x07, 0x70, 0x07, 0x07, 0x70, 0x07, 0x07, 0x70, 0x07, 0x07, 0x70, 
+    0x07, 0x0F, 0x78, 0x07, 0x0E, 0x38, 0x07, 0x1E, 0x3C, 0x07, 0xFC, 0x1F, 0x00, 0xF8, 0x0F, 0x00, 
+    0xE0, 0x03, 0x80, 0xFF, 0x01, 0xF0, 0xFF, 0x0F, 0xF8, 0xFF, 0x1F, 0xFC, 0x30, 0x3C, 0x1E, 0x1C, 
+    0x38, 0x0F, 0x0C, 0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 
+    0x07, 0x1E, 0x78, 0x07, 0x3C, 0x3C, 0x0E, 0xFC, 0x3F, 0x00, 0xF8, 0x1F, 0x00, 0xE0, 0x07, 0x07, 
+    0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x40, 0x07, 0x00, 0x78, 0x07, 0x00, 
+    0x7E, 0x07, 0xC0, 0x3F, 0x07, 0xF0, 0x0F, 0x07, 0xFE, 0x01, 0x87, 0x7F, 0x00, 0xF7, 0x0F, 0x00, 
+    0xFF, 0x03, 0x00, 0xFF, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xC0, 0x07, 0xF8, 
+    0xF0, 0x1F, 0xFC, 0xF9, 0x3F, 0xFE, 0x3B, 0x3C, 0x0F, 0x1B, 0x78, 0x07, 0x0E, 0x70, 0x07, 0x0E, 
+    0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 0x07, 0x0E, 0x70, 0x0F, 0x1B, 0x78, 0xFE, 0x3B, 0x3C, 
+    0xFC, 0xF9, 0x3F, 0xF8, 0xF0, 0x1F, 0x00, 0xC0, 0x07, 0xF0, 0x03, 0x00, 0xFC, 0x0F, 0x00, 0xFE, 
+    0x1F, 0x38, 0x1E, 0x1E, 0x70, 0x0F, 0x3C, 0x70, 0x07, 0x38, 0x70, 0x07, 0x38, 0x70, 0x07, 0x38, 
+    0x70, 0x07, 0x38, 0x70, 0x07, 0x18, 0x78, 0x0E, 0x1C, 0x3C, 0x1E, 0x86, 0x1F, 0xFC, 0xFF, 0x0F, 
+    0xF8, 0xFF, 0x07, 0xC0, 0xFF, 0x00, 0xF0, 0x01, 0x1F, 0xF0, 0x01, 0x1F, 0xF0, 0x01, 0x1F, 0xF0, 
+    0x01, 0x1F, 0x00, 0x30, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xFC, 
+    0x00, 0x00, 0xCC, 0x00, 0x00, 0xCE, 0x01, 0x00, 0x86, 0x01, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 
+    0x00, 0x03, 0x03, 0x80, 0x03, 0x07, 0x80, 0x03, 0x07, 0xC0, 0x01, 0x0E, 0xC0, 0x01, 0x0E, 0xC0, 
+    0x00, 0x0C, 0xE0, 0x00, 0x1C, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 
+    0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 
+    0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 
+    0x87, 0x03, 0x00, 0x87, 0x03, 0x00, 0x87, 0x03, 0xE0, 0x00, 0x1C, 0xC0, 0x00, 0x0C, 0xC0, 0x01, 
+    0x0E, 0xC0, 0x01, 0x0E, 0x80, 0x03, 0x07, 0x80, 0x03, 0x07, 0x00, 0x03, 0x03, 0x00, 0x87, 0x03, 
+    0x00, 0x87, 0x03, 0x00, 0x86, 0x01, 0x00, 0xCE, 0x01, 0x00, 0xCC, 0x00, 0x00, 0xFC, 0x00, 0x00, 
+    0xFC, 0x00, 0x00, 0x78, 0x00, 0x00, 0x78, 0x00, 0x00, 0x30, 0x00, 0x1C, 0x00, 0x00, 0x0E, 0x00, 
+    0x00, 0x0E, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0xF0, 0x79, 0x07, 0xFC, 0x79, 0x07, 0xFE, 0x79, 
+    0x07, 0x1F, 0x00, 0x8F, 0x07, 0x00, 0xFE, 0x03, 0x00, 0xFC, 0x01, 0x00, 0xF8, 0x00, 0x00, 0x00, 
+    0x78, 0x00, 0x00, 0x38, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x1C, 
+    0x00, 0x00, 0x1C, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x38, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 
+    0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x70, 0x00, 0x00, 0x38, 0x00, 0x00, 
+    0x3C, 0x00, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x3F, 0x00, 
+    0x00, 0x1F, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x80, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x7F, 0x00, 0x00, 
+    0x3F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0xE0, 
+    0x00, 0x00, 0x7F, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x78, 0x00, 
+    0x00, 0xFE, 0x01, 0x00, 0x86, 0x01, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x00, 
+    0x03, 0x03, 0x00, 0x86, 0x01, 0x00, 0xFE, 0x01, 0x00, 0x78, 0x00, 0x00, 0x00, 0x07, 0x1C, 0x00, 
+    0x07, 0x1C, 0x00, 0x07, 0x1C, 0x00, 0x07, 0x1C, 0x00, 0x07, 0x1C, 0xF8, 0xFF, 0x1C, 0xF8, 0xFF, 
+    0x1C, 0xF8, 0xFF, 0x1C, 0x00, 0x07, 0x1C, 0x00, 0x07, 0x1C, 0x00, 0x07, 0x1C, 0x00, 0x07, 0x1C, 
+    0x00, 0x07, 0x1C, 0x06, 0x18, 0x00, 0x03, 0x1C, 0x00, 0x03, 0x1E, 0x00, 0x03, 0x1F, 0x00, 0x83, 
+    0x1B, 0x00, 0xC3, 0x19, 0x00, 0xE7, 0x18, 0x00, 0x7E, 0x18, 0x00, 0x3C, 0x18, 0x00, 0x06, 0x0C, 
+    0x00, 0x03, 0x18, 0x00, 0x03, 0x18, 0x00, 0x63, 0x18, 0x00, 0x63, 0x18, 0x00, 0x63, 0x18, 0x00, 
+    0xF7, 0x1C, 0x00, 0xFE, 0x0F, 0x00, 0x9C, 0x07, 0x00, 0x06, 0x18, 0x00, 0x06, 0x18, 0x00, 0x03, 
+    0x18, 0x00, 0xFF, 0x1F, 0x00, 0xFF, 0x1F, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 
+    0x00, 0x06, 0x00, 0x00, 0x06, 0x18, 0x00, 0x03, 0x18, 0x10, 0xFF, 0x1F, 0x08, 0xFF, 0x1F, 0x06, 
+    0x00, 0x18, 0x01, 0x00, 0x98, 0x00, 0x00, 0x40, 0x1C, 0x00, 0x30, 0x1E, 0x00, 0x88, 0x1B, 0x00, 
+    0xC4, 0x18, 0x00, 0x62, 0x18, 0x80, 0x39, 0x18, 0x40, 0xF8, 0xFF, 0x20, 0xF8, 0xFF, 0x00, 0x00, 
+    0x18, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x06, 0x18, 0x00, 0x03, 0x18, 0x10, 0xFF, 0x1F, 0x0C, 
+    0xFF, 0x1F, 0x02, 0x00, 0x18, 0x01, 0x00, 0xD8, 0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0xC0, 0x00, 
+    0x0C, 0xE0, 0x00, 0x32, 0xF0, 0x00, 0x19, 0xF8, 0xC0, 0x18, 0xDC, 0x20, 0x18, 0xCE, 0x10, 0x38, 
+    0xC7, 0x00, 0xF0, 0xC3, 0x00, 0xE0, 0xC1, 0x06, 0x0C, 0x00, 0x03, 0x18, 0x00, 0x03, 0x18, 0x10, 
+    0x63, 0x18, 0x08, 0x63, 0x18, 0x04, 0x63, 0x18, 0x03, 0xF7, 0x9C, 0x00, 0xFE, 0x47, 0x1C, 0x9C, 
+    0x27, 0x1E, 0x00, 0x90, 0x1B, 0x00, 0xC8, 0x18, 0x00, 0x66, 0x18, 0x00, 0x39, 0x18, 0x80, 0xF8, 
+    0xFF, 0x40, 0xF8, 0xFF, 0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00
+};
+
+const struct font_info digits_24px PROGMEM = {0xAC+(0x05<<8),0x13,0x18,0x25,0xBE,digits_24px_data,(uint8_t*)digits_24px_data+0xBE -0x25+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/digits_32px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/digits_32px.c
new file mode 100644 (file)
index 0000000..b7a3d1b
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : digits_32px.c
+    Date                : 08.10.2011
+    Font size in bytes  : 0x0544, 1348
+    Font width          : 28
+    Font height         : 32
+    Font first char     : 0x2B
+    Font last char      : 0x3A
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_digits_32px
+
+
+
+const uint8_t digits_32px_data[] PROGMEM = {
+    0x1B, 0x00, 0x1B, 0x08, 0x00, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x09, 
+    
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 
+    0xE0, 0xFF, 0xFF, 0xFF, 0xE0, 0xFF, 0xFF, 0xFF, 0xE0, 0xFF, 0xFF, 0xFF, 0xE0, 0xFF, 0xFF, 0xFF, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 
+    0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 
+    0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF8, 0x1F, 0x00, 0x80, 0xFF, 0xFF, 0x01, 
+    0xE0, 0xFF, 0xFF, 0x07, 0xF0, 0xFF, 0xFF, 0x0F, 0xF8, 0xFF, 0xFF, 0x1F, 0xFC, 0xFF, 0xFF, 0x3F, 
+    0xFC, 0xFF, 0xFF, 0x3F, 0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0x03, 0xC0, 0x7F, 0x7F, 0x00, 0x00, 0xFE, 
+    0x3F, 0x00, 0x00, 0xFC, 0x1F, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0xF8, 
+    0x3F, 0x00, 0x00, 0xFC, 0x7F, 0x00, 0x00, 0xFE, 0xFE, 0x03, 0xC0, 0x7F, 0xFE, 0xFF, 0xFF, 0x7F, 
+    0xFC, 0xFF, 0xFF, 0x3F, 0xFC, 0xFF, 0xFF, 0x3F, 0xF8, 0xFF, 0xFF, 0x1F, 0xF0, 0xFF, 0xFF, 0x0F, 
+    0xE0, 0xFF, 0xFF, 0x07, 0x80, 0xFF, 0xFF, 0x01, 0x00, 0xF8, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0xF0, 0x03, 0x00, 0xFC, 0xF0, 0x03, 0x00, 0xFC, 0xF8, 0x01, 0x00, 0xFC, 0xF8, 0x01, 0x00, 0xFC, 
+    0xFC, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, 0xFC, 0x7E, 0x00, 0x00, 0xFC, 
+    0x7E, 0x00, 0x00, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 
+    0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 
+    0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC, 
+    0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC, 
+    0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x01, 0x00, 0xF8, 0xFC, 0x01, 0x00, 0xFC, 
+    0xFC, 0x00, 0x00, 0xFE, 0x7E, 0x00, 0x00, 0xFF, 0x7E, 0x00, 0x80, 0xFF, 0x3E, 0x00, 0xC0, 0xFF, 
+    0x3E, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0xF0, 0xFF, 0x1F, 0x00, 0xF8, 0xFF, 
+    0x1F, 0x00, 0xFC, 0xFF, 0x1F, 0x00, 0xFE, 0xFD, 0x1F, 0x00, 0xFF, 0xFC, 0x3F, 0x80, 0x7F, 0xFC, 
+    0x3F, 0xC0, 0x3F, 0xFC, 0xFF, 0xE0, 0x3F, 0xFC, 0xFF, 0xFF, 0x1F, 0xFC, 0xFE, 0xFF, 0x0F, 0xFC, 
+    0xFE, 0xFF, 0x07, 0xFC, 0xFC, 0xFF, 0x03, 0xFC, 0xFC, 0xFF, 0x01, 0xFC, 0xF8, 0xFF, 0x00, 0xFC, 
+    0xF0, 0x7F, 0x00, 0xFC, 0xC0, 0x1F, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x7E, 0x7E, 0x00, 0x00, 0x7C, 0x3E, 0x00, 0x00, 0x7C, 0x3E, 0x00, 0x00, 0xFC, 
+    0x3F, 0x00, 0x00, 0xFC, 0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 
+    0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 
+    0x1F, 0xE0, 0x03, 0xF8, 0x3F, 0xF0, 0x03, 0xF8, 0x3F, 0xF0, 0x07, 0xFC, 0x7F, 0xF8, 0x07, 0xFC, 
+    0xFF, 0xFF, 0x1F, 0x7E, 0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0xBF, 0xFF, 0x7F, 
+    0xFC, 0xBF, 0xFF, 0x3F, 0xFC, 0x1F, 0xFF, 0x3F, 0xF8, 0x0F, 0xFE, 0x1F, 0xE0, 0x07, 0xFC, 0x0F, 
+    0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0xFE, 0x03, 
+    0x00, 0x00, 0xFF, 0x03, 0x00, 0xC0, 0xFF, 0x03, 0x00, 0xE0, 0xFF, 0x03, 0x00, 0xF8, 0xF7, 0x03, 
+    0x00, 0xFC, 0xF3, 0x03, 0x00, 0xFE, 0xF1, 0x03, 0x80, 0x7F, 0xF0, 0x03, 0xC0, 0x3F, 0xF0, 0x03, 
+    0xF0, 0x0F, 0xF0, 0x03, 0xF8, 0x07, 0xF0, 0x03, 0xFE, 0x03, 0xF0, 0x03, 0xFE, 0x00, 0xF0, 0x03, 
+    0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 
+    0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xF0, 0x03, 
+    0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x3F, 0xFE, 0xFF, 0x01, 0x7E, 0xFE, 0xFF, 0x00, 0x7E, 0xFE, 0xFF, 0x00, 0x7C, 
+    0xFE, 0xFF, 0x00, 0x7C, 0xFE, 0x7F, 0x00, 0xFC, 0xFE, 0x7F, 0x00, 0xF8, 0x7E, 0x7C, 0x00, 0xF8, 
+    0x7E, 0x7C, 0x00, 0xF8, 0x7E, 0x7C, 0x00, 0xF8, 0x7E, 0x7C, 0x00, 0xF8, 0x7E, 0x7C, 0x00, 0xF8, 
+    0x7E, 0xFC, 0x00, 0xFC, 0x7E, 0xFC, 0x00, 0xFC, 0x7E, 0xFC, 0x01, 0xFE, 0x7E, 0xFC, 0x03, 0x7F, 
+    0x7E, 0xF8, 0xFF, 0x7F, 0x7E, 0xF8, 0xFF, 0x7F, 0x7E, 0xF0, 0xFF, 0x3F, 0x7E, 0xF0, 0xFF, 0x3F, 
+    0x7E, 0xE0, 0xFF, 0x1F, 0x7E, 0xC0, 0xFF, 0x0F, 0x7E, 0x80, 0xFF, 0x07, 0x00, 0x00, 0xFE, 0x01, 
+    0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x01, 0xC0, 0xFF, 0xFF, 0x07, 
+    0xE0, 0xFF, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0x1F, 0xF8, 0xFF, 0xFF, 0x3F, 0xFC, 0xFF, 0xFF, 0x7F, 
+    0xFC, 0xFF, 0xFF, 0x7F, 0xFE, 0xE3, 0xFF, 0x7F, 0xFE, 0xF0, 0x03, 0xFE, 0x7F, 0xF0, 0x01, 0xFC, 
+    0x3F, 0xF8, 0x00, 0xF8, 0x3F, 0xF8, 0x00, 0xF8, 0x3F, 0xF8, 0x00, 0xF8, 0x1F, 0xF8, 0x00, 0xF8, 
+    0x1F, 0xF8, 0x00, 0xF8, 0x1F, 0xF8, 0x01, 0xFC, 0x1F, 0xF8, 0x03, 0xFE, 0x1F, 0xF8, 0xFF, 0x7F, 
+    0x1F, 0xF0, 0xFF, 0x7F, 0x3F, 0xF0, 0xFF, 0x7F, 0x3F, 0xE0, 0xFF, 0x3F, 0x3E, 0xE0, 0xFF, 0x1F, 
+    0x7E, 0xC0, 0xFF, 0x0F, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0xFC, 0x01, 0x00, 0x00, 0x00, 0x00, 
+    0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 
+    0x7E, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0xC0, 0x7E, 0x00, 0x00, 0xF0, 0x7E, 0x00, 0x00, 0xFC, 
+    0x7E, 0x00, 0x00, 0xFF, 0x7E, 0x00, 0xC0, 0xFF, 0x7E, 0x00, 0xF8, 0xFF, 0x7E, 0x00, 0xFE, 0xFF, 
+    0x7E, 0x80, 0xFF, 0xFF, 0x7E, 0xE0, 0xFF, 0x3F, 0x7E, 0xF8, 0xFF, 0x0F, 0x7E, 0xFE, 0xFF, 0x03, 
+    0xFE, 0xFF, 0xFF, 0x00, 0xFE, 0xFF, 0x3F, 0x00, 0xFE, 0xFF, 0x07, 0x00, 0xFE, 0xFF, 0x01, 0x00, 
+    0xFE, 0x7F, 0x00, 0x00, 0xFE, 0x1F, 0x00, 0x00, 0xFE, 0x07, 0x00, 0x00, 0xFE, 0x01, 0x00, 0x00, 
+    0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0xE0, 0x07, 0xFC, 0x0F, 
+    0xF8, 0x1F, 0xFE, 0x1F, 0xFC, 0x3F, 0xFE, 0x3F, 0xFC, 0x3F, 0xFF, 0x7F, 0xFE, 0x7F, 0xFF, 0x7F, 
+    0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFE, 0x7F, 0xF8, 0x07, 0xFC, 
+    0x3F, 0xF0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 0x1F, 0xE0, 0x03, 0xF8, 
+    0x3F, 0xF0, 0x03, 0xF8, 0x7F, 0xF8, 0x07, 0xFC, 0xFF, 0xFF, 0x0F, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 
+    0xFE, 0xFF, 0xFF, 0x7F, 0xFE, 0x7F, 0xFF, 0x7F, 0xFC, 0x3F, 0xFF, 0x7F, 0xFC, 0x3F, 0xFE, 0x3F, 
+    0xF8, 0x1F, 0xFE, 0x1F, 0xE0, 0x07, 0xFC, 0x0F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 
+    0x80, 0x3F, 0x00, 0x00, 0xE0, 0xFF, 0x01, 0x00, 0xF0, 0xFF, 0x03, 0x7E, 0xF8, 0xFF, 0x07, 0x7C, 
+    0xFC, 0xFF, 0x07, 0xFC, 0xFE, 0xFF, 0x0F, 0xFC, 0xFE, 0xFF, 0x0F, 0xF8, 0xFE, 0xFF, 0x1F, 0xF8, 
+    0x7F, 0xC0, 0x1F, 0xF8, 0x3F, 0x80, 0x1F, 0xF8, 0x1F, 0x00, 0x1F, 0xF8, 0x1F, 0x00, 0x1F, 0xF8, 
+    0x1F, 0x00, 0x1F, 0xFC, 0x1F, 0x00, 0x1F, 0xFC, 0x3F, 0x80, 0x0F, 0xFE, 0x7F, 0xC0, 0x0F, 0x7F, 
+    0xFE, 0xFF, 0xC7, 0x7F, 0xFE, 0xFF, 0xFF, 0x3F, 0xFE, 0xFF, 0xFF, 0x3F, 0xFC, 0xFF, 0xFF, 0x1F, 
+    0xF8, 0xFF, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0x07, 0xE0, 0xFF, 0xFF, 0x03, 0x80, 0xFF, 0xFF, 0x00, 
+    0x00, 0xFC, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 
+    0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 0xC0, 0x3F, 
+    0xC0, 0x3F, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+const struct font_info digits_32px PROGMEM = {0x44+(0x05<<8),0x1C,0x20,0x2B,0x3A,digits_32px_data,(uint8_t*)digits_32px_data+0x3A-0x2B+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_fixed_16bit.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_fixed_16bit.c
new file mode 100644 (file)
index 0000000..34b5ce2
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : 16bit_fixed.c
+    Date                : 24.12.2013
+    Font size in bytes  : 2002
+    Font width          : 10
+    Font height         : 16
+    Font first char     : 0x20
+    Font last char      : 0x7E
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_font_fixed_16px
+
+
+const uint8_t font_fixed_16px_data[] PROGMEM={ 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x33, 0xFF, 0x33, 0xFF, 0x33, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x32, 0x20, 0x3F, 0xF8, 0x0F, 0xFE, 0x02, 
+    0x26, 0x32, 0xA0, 0x3F, 0xF8, 0x0F, 0x7E, 0x02, 0x26, 0x02, 0x20, 0x00, 0x38, 0x30, 0x7C, 0x70, 
+    0xFE, 0x60, 0xC6, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0x06, 0x63, 0x06, 0x3F, 0x04, 0x1C, 0x00, 0x00, 
+    0x3C, 0x60, 0x7E, 0x38, 0x42, 0x1C, 0x7E, 0x0E, 0xFE, 0x3F, 0xFC, 0x7F, 0x70, 0x7E, 0x38, 0x42, 
+    0x1C, 0x7E, 0x06, 0x3C, 0x00, 0x1E, 0x00, 0x3F, 0xBC, 0x7F, 0xFE, 0x71, 0xFE, 0x63, 0xE6, 0x67, 
+    0x3E, 0x7F, 0x1C, 0x7C, 0x00, 0x7F, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 
+    0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 
+    0xF0, 0x0F, 0xFC, 0x3F, 0x3E, 0x7C, 0x0E, 0x70, 0x07, 0xE0, 0x03, 0xC0, 0x03, 0xC0, 0x00, 0x00, 
+    0x00, 0x00, 0x03, 0xC0, 0x03, 0xC0, 0x07, 0xE0, 0x0E, 0x70, 0x3E, 0x7C, 0xFC, 0x3F, 0xF0, 0x0F, 
+    0xC0, 0x03, 0x00, 0x00, 0x18, 0x00, 0x98, 0x00, 0xD8, 0x01, 0xDE, 0x01, 0x4E, 0x00, 0xDE, 0x01, 
+    0xD8, 0x01, 0x98, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 
+    0xF0, 0x3F, 0xF0, 0x3F, 0xF0, 0x3F, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4E, 
+    0x00, 0x7E, 0x00, 0x7E, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 
+    0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x38, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x78, 0x00, 0x7F, 
+    0xE0, 0x1F, 0xF8, 0x07, 0xFE, 0x00, 0x1E, 0x00, 0x06, 0x00, 0x00, 0x00, 0xF0, 0x0F, 0xF8, 0x1F, 
+    0xFC, 0x3F, 0x1E, 0x78, 0x06, 0x60, 0x06, 0x60, 0x1E, 0x78, 0xFC, 0x3F, 0xFC, 0x1F, 0xF0, 0x0F, 
+    0x00, 0x60, 0x18, 0x60, 0x1C, 0x60, 0x0C, 0x60, 0xFE, 0x7F, 0xFE, 0x7F, 0xFE, 0x7F, 0x00, 0x60, 
+    0x00, 0x60, 0x00, 0x60, 0x0C, 0x70, 0x0E, 0x78, 0x06, 0x7C, 0x06, 0x6E, 0x06, 0x67, 0x8E, 0x63, 
+    0xFE, 0x61, 0xFC, 0x60, 0x78, 0x60, 0x00, 0x60, 0x00, 0x00, 0x0C, 0x60, 0xCE, 0x60, 0xC6, 0x60, 
+    0xC6, 0x60, 0xE6, 0x71, 0xFE, 0x7F, 0xBE, 0x3F, 0x1C, 0x1E, 0x00, 0x00, 0x00, 0x06, 0x80, 0x07, 
+    0xC0, 0x07, 0xE0, 0x06, 0x78, 0x06, 0x1C, 0x06, 0xFE, 0x7F, 0xFE, 0x7F, 0xFE, 0x7F, 0x00, 0x06, 
+    0x00, 0x00, 0xFE, 0x60, 0xFE, 0x60, 0xFE, 0x60, 0xC6, 0x60, 0xC6, 0x71, 0xC6, 0x7F, 0x86, 0x3F, 
+    0x06, 0x1F, 0x06, 0x0E, 0xE0, 0x0F, 0xF8, 0x3F, 0xFC, 0x3F, 0x9E, 0x71, 0xCE, 0x60, 0xC6, 0x60, 
+    0xC6, 0x71, 0xC6, 0x7F, 0x84, 0x3F, 0x00, 0x1F, 0x06, 0x00, 0x06, 0x60, 0x06, 0x7C, 0x06, 0x7F, 
+    0xC6, 0x1F, 0xF6, 0x03, 0xFE, 0x00, 0x3E, 0x00, 0x0E, 0x00, 0x06, 0x00, 0x00, 0x1E, 0x3C, 0x3F, 
+    0x7C, 0x7F, 0xFE, 0x71, 0xE6, 0x61, 0xC6, 0x61, 0xFE, 0x73, 0x7E, 0x7F, 0x3C, 0x3F, 0x00, 0x1E, 
+    0xF8, 0x00, 0xFC, 0x21, 0xFE, 0x63, 0x8E, 0x63, 0x06, 0x63, 0x06, 0x73, 0x8E, 0x79, 0xFC, 0x3F, 
+    0xFC, 0x1F, 0xF0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1C, 0x38, 0x1C, 0x38, 0x1C, 
+    0x38, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9C, 0x38, 0xFC, 0x38, 0xFC, 
+    0x38, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 
+    0xC0, 0x03, 0xE0, 0x07, 0x60, 0x06, 0x70, 0x0E, 0x30, 0x0C, 0x38, 0x1C, 0x18, 0x18, 0x18, 0x18, 
+    0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 
+    0x30, 0x03, 0x30, 0x03, 0x18, 0x18, 0x18, 0x18, 0x38, 0x1C, 0x30, 0x0C, 0x70, 0x0E, 0x60, 0x06, 
+    0xE0, 0x07, 0xC0, 0x03, 0x80, 0x01, 0x80, 0x01, 0x0E, 0x00, 0x0E, 0x00, 0x06, 0x00, 0x06, 0x66, 
+    0x06, 0x67, 0x86, 0x67, 0xCE, 0x01, 0xFE, 0x00, 0x7C, 0x00, 0x3C, 0x00, 0xF0, 0x0F, 0xFC, 0x3F, 
+    0x1C, 0x38, 0xC6, 0x67, 0xE2, 0x4F, 0x32, 0x4C, 0x36, 0x4C, 0x3E, 0x6C, 0xFC, 0x6F, 0xF8, 0x0F, 
+    0x00, 0x38, 0x80, 0x3F, 0xE0, 0x1F, 0xFC, 0x07, 0x3C, 0x06, 0x3C, 0x06, 0xFC, 0x07, 0xE0, 0x1F, 
+    0x80, 0x3F, 0x00, 0x38, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x8C, 0x31, 0x8C, 0x31, 0x8C, 0x31, 
+    0xCC, 0x33, 0xFC, 0x3F, 0x78, 0x1F, 0x78, 0x1E, 0xE0, 0x07, 0xF0, 0x0F, 0xF8, 0x1F, 0x38, 0x1C, 
+    0x1C, 0x38, 0x0C, 0x30, 0x0C, 0x30, 0x0C, 0x30, 0x1C, 0x30, 0x18, 0x10, 0xFC, 0x3F, 0xFC, 0x3F, 
+    0xFC, 0x3F, 0x0C, 0x30, 0x0C, 0x30, 0x1C, 0x38, 0x3C, 0x3C, 0xF8, 0x1F, 0xF8, 0x0F, 0xE0, 0x07, 
+    0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x8C, 0x31, 0x8C, 0x31, 0x8C, 0x31, 0x8C, 0x31, 0x8C, 0x31, 
+    0x0C, 0x30, 0x0C, 0x30, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x8C, 0x01, 0x8C, 0x01, 0x8C, 0x01, 
+    0x8C, 0x01, 0x8C, 0x01, 0x0C, 0x00, 0x0C, 0x00, 0xE0, 0x07, 0xF0, 0x0F, 0xF8, 0x1F, 0x38, 0x1C, 
+    0x1C, 0x38, 0x0C, 0x30, 0x8C, 0x31, 0x8C, 0x31, 0x9C, 0x3F, 0x98, 0x1F, 0xFC, 0x3F, 0xFC, 0x3F, 
+    0xFC, 0x3F, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 
+    0x0C, 0x30, 0x0C, 0x30, 0x0C, 0x30, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x0C, 0x30, 0x0C, 0x30, 
+    0x0C, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x0C, 0x30, 0x0C, 0x30, 0x0C, 0x30, 0x0C, 0x38, 
+    0xFC, 0x3F, 0xFC, 0x1F, 0xFC, 0x0F, 0x00, 0x00, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0xC0, 0x03, 
+    0xE0, 0x07, 0x78, 0x0F, 0x3C, 0x1E, 0x1C, 0x3C, 0x0C, 0x38, 0x04, 0x30, 0xFC, 0x3F, 0xFC, 0x3F, 
+    0xFC, 0x3F, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 
+    0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0xF8, 0x00, 0xF0, 0x07, 0xC0, 0x07, 0xE0, 0x07, 0xF8, 0x00, 
+    0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0xF8, 0x00, 0xF0, 0x03, 0xC0, 0x0F, 
+    0x00, 0x1F, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0xE0, 0x07, 0xF8, 0x1F, 0xF8, 0x1F, 0x1C, 0x38, 
+    0x0C, 0x30, 0x0C, 0x30, 0x1C, 0x38, 0xF8, 0x1F, 0xF8, 0x1F, 0xE0, 0x07, 0xFC, 0x3F, 0xFC, 0x3F, 
+    0xFC, 0x3F, 0x8C, 0x01, 0x8C, 0x01, 0x8C, 0x01, 0xCC, 0x01, 0xFC, 0x01, 0xF8, 0x00, 0x78, 0x00, 
+    0xE0, 0x07, 0xF8, 0x0F, 0xF8, 0x1F, 0x1C, 0x38, 0x0C, 0x30, 0x0C, 0x70, 0x1C, 0xF8, 0xF8, 0xDF, 
+    0xF8, 0xCF, 0xE0, 0x87, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x8C, 0x01, 0x8C, 0x03, 0xCC, 0x07, 
+    0xFC, 0x1F, 0xFC, 0x3E, 0x78, 0x38, 0x00, 0x30, 0x78, 0x18, 0xF8, 0x38, 0xFC, 0x38, 0xCC, 0x30, 
+    0x8C, 0x31, 0x8C, 0x31, 0x8C, 0x33, 0x1C, 0x3F, 0x18, 0x1F, 0x00, 0x0E, 0x00, 0x00, 0x0C, 0x00, 
+    0x0C, 0x00, 0x0C, 0x00, 0xFC, 0x3F, 0xFC, 0x3F, 0xFC, 0x3F, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 
+    0xFC, 0x0F, 0xFC, 0x1F, 0xFC, 0x3F, 0x00, 0x38, 0x00, 0x30, 0x00, 0x30, 0x00, 0x38, 0xFC, 0x3F, 
+    0xFC, 0x1F, 0xFC, 0x0F, 0x0C, 0x00, 0xFC, 0x00, 0xF8, 0x03, 0xE0, 0x1F, 0x80, 0x3F, 0x00, 0x3C, 
+    0x80, 0x3F, 0xE0, 0x1F, 0xFC, 0x03, 0x3C, 0x00, 0x00, 0x00, 0xFC, 0x07, 0xFC, 0x1F, 0x00, 0x3F, 
+    0xC0, 0x1F, 0xE0, 0x07, 0xC0, 0x1F, 0x00, 0x3F, 0xFC, 0x1F, 0xFC, 0x07, 0x00, 0x00, 0x0C, 0x30, 
+    0x1C, 0x38, 0x78, 0x1E, 0xE0, 0x07, 0xC0, 0x03, 0xE0, 0x07, 0x78, 0x1E, 0x1C, 0x38, 0x0C, 0x30, 
+    0x00, 0x00, 0x1C, 0x00, 0x7C, 0x00, 0xF0, 0x00, 0xE0, 0x3F, 0x80, 0x3F, 0xE0, 0x3F, 0xF0, 0x00, 
+    0x7C, 0x00, 0x1C, 0x00, 0x0C, 0x38, 0x0C, 0x3C, 0x0C, 0x3E, 0x0C, 0x3F, 0x8C, 0x37, 0xCC, 0x33, 
+    0xEC, 0x31, 0xFC, 0x30, 0x7C, 0x30, 0x1C, 0x30, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 
+    0xFF, 0xFF, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 
+    0x1F, 0x00, 0xFF, 0x00, 0xF8, 0x07, 0xE0, 0x1F, 0x00, 0xFF, 0x00, 0xF8, 0x00, 0xE0, 0x00, 0x00, 
+    0x00, 0x00, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xE0, 0x01, 0xFC, 0x00, 0x1E, 0x00, 0x1E, 0x00, 
+    0xFC, 0x00, 0xE0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 
+    0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x1C, 0x60, 0x3E, 0x70, 0x3F, 0x30, 0x33, 0x30, 0x31, 0x30, 0x39, 0xF0, 0x1F, 0xF0, 0x3F, 
+    0xE0, 0x3F, 0x00, 0x30, 0xFE, 0x3F, 0xFE, 0x3F, 0xFE, 0x3F, 0x60, 0x38, 0x30, 0x30, 0x30, 0x30, 
+    0x70, 0x38, 0xF0, 0x3F, 0xE0, 0x1F, 0xC0, 0x07, 0x80, 0x07, 0xE0, 0x1F, 0xE0, 0x1F, 0x70, 0x38, 
+    0x30, 0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x20, 0x10, 0x80, 0x0F, 0xE0, 0x1F, 
+    0xF0, 0x3F, 0x70, 0x38, 0x30, 0x30, 0x30, 0x30, 0x70, 0x38, 0xFE, 0x3F, 0xFE, 0x3F, 0xFE, 0x3F, 
+    0x80, 0x0F, 0xE0, 0x1F, 0xE0, 0x1F, 0x70, 0x3B, 0x30, 0x33, 0x30, 0x33, 0x70, 0x33, 0xF0, 0x33, 
+    0xE0, 0x3B, 0xC0, 0x1B, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xFC, 0x3F, 0xFE, 0x3F, 0xFF, 0x3F, 
+    0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x63, 0x00, 0x80, 0x0F, 0xE0, 0x4F, 0xF0, 0xDF, 0x70, 0xDC, 
+    0x30, 0xD8, 0x30, 0xD8, 0x70, 0xD8, 0xF0, 0xFF, 0xF0, 0xFF, 0xF0, 0x7F, 0xFE, 0x3F, 0xFE, 0x3F, 
+    0xFE, 0x3F, 0x60, 0x00, 0x70, 0x00, 0x30, 0x00, 0x30, 0x00, 0xF0, 0x3F, 0xF0, 0x3F, 0xE0, 0x3F, 
+    0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0xF3, 0x3F, 0xF3, 0x3F, 0xF3, 0x3F, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x30, 0xE0, 0x30, 0xC0, 0x30, 0xC0, 0x30, 0xC0, 
+    0xF3, 0xFF, 0xF3, 0x7F, 0xF3, 0x3F, 0x00, 0x00, 0xFE, 0x3F, 0xFE, 0x3F, 0xFE, 0x3F, 0x80, 0x07, 
+    0xE0, 0x0F, 0xF0, 0x1F, 0x70, 0x3C, 0x30, 0x38, 0x10, 0x30, 0x00, 0x20, 0x00, 0x00, 0x06, 0x00, 
+    0x06, 0x00, 0x06, 0x00, 0x06, 0x00, 0xFE, 0x3F, 0xFE, 0x3F, 0xFE, 0x3F, 0x00, 0x00, 0x00, 0x00, 
+    0xF0, 0x3F, 0xF0, 0x3F, 0xF0, 0x3F, 0x70, 0x00, 0xF0, 0x3F, 0xE0, 0x3F, 0x70, 0x00, 0xF0, 0x3F, 
+    0xF0, 0x3F, 0xE0, 0x3F, 0xF0, 0x3F, 0xF0, 0x3F, 0xF0, 0x3F, 0x60, 0x00, 0x70, 0x00, 0x30, 0x00, 
+    0x30, 0x00, 0xF0, 0x3F, 0xF0, 0x3F, 0xE0, 0x3F, 0x80, 0x07, 0xE0, 0x1F, 0xE0, 0x1F, 0x70, 0x38, 
+    0x30, 0x30, 0x30, 0x30, 0x70, 0x38, 0xE0, 0x1F, 0xE0, 0x1F, 0x80, 0x07, 0xF0, 0xFF, 0xF0, 0xFF, 
+    0xF0, 0xFF, 0x70, 0x1C, 0x30, 0x18, 0x30, 0x18, 0x70, 0x1C, 0xF0, 0x1F, 0xE0, 0x0F, 0xC0, 0x07, 
+    0x80, 0x07, 0xE0, 0x0F, 0xF0, 0x1F, 0x70, 0x1C, 0x30, 0x18, 0x30, 0x18, 0x70, 0x1C, 0xF0, 0xFF, 
+    0xF0, 0xFF, 0xF0, 0xFF, 0x00, 0x00, 0xF0, 0x3F, 0xF0, 0x3F, 0xF0, 0x3F, 0x70, 0x00, 0x30, 0x00, 
+    0x30, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0xE0, 0x18, 0xF0, 0x39, 0xF0, 0x31, 0xB0, 0x33, 
+    0x30, 0x33, 0x30, 0x33, 0x30, 0x3F, 0x30, 0x1E, 0x00, 0x1C, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 
+    0x30, 0x00, 0xFC, 0x1F, 0xFC, 0x3F, 0xFC, 0x3F, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 
+    0xF0, 0x1F, 0xF0, 0x3F, 0xF0, 0x3F, 0x00, 0x30, 0x00, 0x30, 0x00, 0x38, 0x00, 0x18, 0xF0, 0x3F, 
+    0xF0, 0x3F, 0xF0, 0x3F, 0x10, 0x00, 0xF0, 0x00, 0xF0, 0x03, 0xE0, 0x1F, 0x00, 0x3F, 0x00, 0x3C, 
+    0xC0, 0x3F, 0xF0, 0x0F, 0xF0, 0x01, 0x30, 0x00, 0x30, 0x00, 0xF0, 0x0F, 0xE0, 0x3F, 0x00, 0x1E, 
+    0xC0, 0x03, 0xC0, 0x03, 0x00, 0x1E, 0xE0, 0x3F, 0xF0, 0x0F, 0x30, 0x00, 0x10, 0x20, 0x30, 0x30, 
+    0xF0, 0x3C, 0xF0, 0x1F, 0xC0, 0x07, 0xC0, 0x0F, 0xE0, 0x3F, 0xF0, 0x3C, 0x30, 0x30, 0x10, 0x20, 
+    0x10, 0x00, 0xF0, 0x00, 0xF0, 0xC3, 0xE0, 0xCF, 0x00, 0xFF, 0x00, 0x7F, 0xC0, 0x0F, 0xF0, 0x01, 
+    0xF0, 0x00, 0x10, 0x00, 0x30, 0x30, 0x30, 0x38, 0x30, 0x3C, 0x30, 0x3E, 0x30, 0x37, 0xB0, 0x33, 
+    0xF0, 0x31, 0xF0, 0x30, 0x70, 0x30, 0x30, 0x30, 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xFE, 0x7F, 
+    0xFF, 0xFF, 0x7F, 0xFE, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x7F, 0xFE, 0xFF, 0xFF, 0xFE, 0x7F, 0x80, 0x01, 
+    0x80, 0x01, 0x00, 0x00, 0x00, 0x03, 0x80, 0x03, 0x80, 0x01, 0x80, 0x01, 0x80, 0x03, 0x80, 0x03, 
+    0x00, 0x03, 0x00, 0x03, 0x80, 0x03, 0x80, 0x01, 0x00
+};
+
+const struct font_info font_fixed_16px PROGMEM = {2002,0x0A,0x10,0x20,0x7E,0,font_fixed_16px_data};
+
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_fixed_8px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_fixed_8px.c
new file mode 100644 (file)
index 0000000..849c7c4
--- /dev/null
@@ -0,0 +1,270 @@
+#include "../font.h"
+#ifdef FONTS_INCLUDE_font_fixed_8px
+
+
+//LCD Font by Benedikt K. http://www.mikrocontroller.net/topic/54860
+const uint8_t font_fixed_8px_data[] PROGMEM={
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x00
+0x00,0x3E,0x45,0x51,0x45,0x3E, // 0x01
+0x00,0x3E,0x6B,0x6F,0x6B,0x3E, // 0x02
+0x00,0x1C,0x3E,0x7C,0x3E,0x1C, // 0x03
+0x00,0x18,0x3C,0x7E,0x3C,0x18, // 0x04
+0x00,0x30,0x36,0x7F,0x36,0x30, // 0x05
+0x00,0x18,0x5C,0x7E,0x5C,0x18, // 0x06
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x07
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x08
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x09
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x0A
+0x00,0x30,0x48,0x4A,0x36,0x0E, // 0x0B
+0x00,0x06,0x29,0x79,0x29,0x06, // 0x0C
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x0D
+0x00,0x60,0x7E,0x0A,0x35,0x3F, // 0x0E
+0x00,0x2A,0x1C,0x36,0x1C,0x2A, // 0x0F
+0x00,0x00,0x7F,0x3E,0x1C,0x08, // 0x10
+0x00,0x08,0x1C,0x3E,0x7F,0x00, // 0x11
+0x00,0x14,0x36,0x7F,0x36,0x14, // 0x12
+0x00,0x00,0x5F,0x00,0x5F,0x00, // 0x13
+0x00,0x06,0x09,0x7F,0x01,0x7F, // 0x14
+0x00,0x22,0x4D,0x55,0x59,0x22, // 0x15
+0x00,0x60,0x60,0x60,0x60,0x00, // 0x16
+0x00,0x14,0xB6,0xFF,0xB6,0x14, // 0x17
+0x00,0x04,0x06,0x7F,0x06,0x04, // 0x18
+0x00,0x10,0x30,0x7F,0x30,0x10, // 0x19
+0x00,0x08,0x08,0x3E,0x1C,0x08, // 0x1A
+0x00,0x08,0x1C,0x3E,0x08,0x08, // 0x1B
+0x00,0x78,0x40,0x40,0x40,0x40, // 0x1C
+0x00,0x08,0x3E,0x08,0x3E,0x08, // 0x1D
+0x00,0x30,0x3C,0x3F,0x3C,0x30, // 0x1E
+0x00,0x03,0x0F,0x3F,0x0F,0x03, // 0x1F
+0x00,0x00,0x00,0x00,0x00,0x00, // 0x20
+0x00,0x00,0x06,0x5F,0x06,0x00, // 0x21
+0x00,0x07,0x03,0x00,0x07,0x03, // 0x22
+0x00,0x24,0x7E,0x24,0x7E,0x24, // 0x23
+0x00,0x24,0x2B,0x6A,0x12,0x00, // 0x24
+0x00,0x63,0x13,0x08,0x64,0x63, // 0x25
+0x00,0x36,0x49,0x56,0x20,0x50, // 0x26
+0x00,0x00,0x07,0x03,0x00,0x00, // 0x27
+0x00,0x00,0x3E,0x41,0x00,0x00, // 0x28
+0x00,0x00,0x41,0x3E,0x00,0x00, // 0x29
+0x00,0x08,0x3E,0x1C,0x3E,0x08, // 0x2A
+0x00,0x08,0x08,0x3E,0x08,0x08, // 0x2B
+0x00,0x00,0xE0,0x60,0x00,0x00, // 0x2C
+0x00,0x08,0x08,0x08,0x08,0x08, // 0x2D
+0x00,0x00,0x60,0x60,0x00,0x00, // 0x2E
+0x00,0x20,0x10,0x08,0x04,0x02, // 0x2F
+0x00,0x3E,0x51,0x49,0x45,0x3E, // 0x30
+0x00,0x00,0x42,0x7F,0x40,0x00, // 0x31
+0x00,0x62,0x51,0x49,0x49,0x46, // 0x32
+0x00,0x22,0x49,0x49,0x49,0x36, // 0x33
+0x00,0x18,0x14,0x12,0x7F,0x10, // 0x34
+0x00,0x2F,0x49,0x49,0x49,0x31, // 0x35
+0x00,0x3C,0x4A,0x49,0x49,0x30, // 0x36
+0x00,0x01,0x71,0x09,0x05,0x03, // 0x37
+0x00,0x36,0x49,0x49,0x49,0x36, // 0x38
+0x00,0x06,0x49,0x49,0x29,0x1E, // 0x39
+0x00,0x00,0x6C,0x6C,0x00,0x00, // 0x3A
+0x00,0x00,0xEC,0x6C,0x00,0x00, // 0x3B
+0x00,0x08,0x14,0x22,0x41,0x00, // 0x3C
+0x00,0x24,0x24,0x24,0x24,0x24, // 0x3D
+0x00,0x00,0x41,0x22,0x14,0x08, // 0x3E
+0x00,0x02,0x01,0x59,0x09,0x06, // 0x3F
+0x00,0x3E,0x41,0x5D,0x55,0x1E, // 0x40
+0x00,0x7E,0x11,0x11,0x11,0x7E, // 0x41
+0x00,0x7F,0x49,0x49,0x49,0x36, // 0x42
+0x00,0x3E,0x41,0x41,0x41,0x22, // 0x43
+0x00,0x7F,0x41,0x41,0x41,0x3E, // 0x44
+0x00,0x7F,0x49,0x49,0x49,0x41, // 0x45
+0x00,0x7F,0x09,0x09,0x09,0x01, // 0x46
+0x00,0x3E,0x41,0x49,0x49,0x7A, // 0x47
+0x00,0x7F,0x08,0x08,0x08,0x7F, // 0x48
+0x00,0x00,0x41,0x7F,0x41,0x00, // 0x49
+0x00,0x30,0x40,0x40,0x40,0x3F, // 0x4A
+0x00,0x7F,0x08,0x14,0x22,0x41, // 0x4B
+0x00,0x7F,0x40,0x40,0x40,0x40, // 0x4C
+0x00,0x7F,0x02,0x04,0x02,0x7F, // 0x4D
+0x00,0x7F,0x02,0x04,0x08,0x7F, // 0x4E
+0x00,0x3E,0x41,0x41,0x41,0x3E, // 0x4F
+0x00,0x7F,0x09,0x09,0x09,0x06, // 0x50
+0x00,0x3E,0x41,0x51,0x21,0x5E, // 0x51
+0x00,0x7F,0x09,0x09,0x19,0x66, // 0x52
+0x00,0x26,0x49,0x49,0x49,0x32, // 0x53
+0x00,0x01,0x01,0x7F,0x01,0x01, // 0x54
+0x00,0x3F,0x40,0x40,0x40,0x3F, // 0x55
+0x00,0x1F,0x20,0x40,0x20,0x1F, // 0x56
+0x00,0x3F,0x40,0x3C,0x40,0x3F, // 0x57
+0x00,0x63,0x14,0x08,0x14,0x63, // 0x58
+0x00,0x07,0x08,0x70,0x08,0x07, // 0x59
+0x00,0x71,0x49,0x45,0x43,0x00, // 0x5A
+0x00,0x00,0x7F,0x41,0x41,0x00, // 0x5B
+0x00,0x02,0x04,0x08,0x10,0x20, // 0x5C
+0x00,0x00,0x41,0x41,0x7F,0x00, // 0x5D
+0x00,0x04,0x02,0x01,0x02,0x04, // 0x5E
+0x80,0x80,0x80,0x80,0x80,0x80, // 0x5F
+0x00,0x00,0x03,0x07,0x00,0x00, // 0x60
+0x00,0x20,0x54,0x54,0x54,0x78, // 0x61
+0x00,0x7F,0x44,0x44,0x44,0x38, // 0x62
+0x00,0x38,0x44,0x44,0x44,0x28, // 0x63
+0x00,0x38,0x44,0x44,0x44,0x7F, // 0x64
+0x00,0x38,0x54,0x54,0x54,0x08, // 0x65
+0x00,0x08,0x7E,0x09,0x09,0x00, // 0x66
+0x00,0x18,0xA4,0xA4,0xA4,0x7C, // 0x67
+0x00,0x7F,0x04,0x04,0x78,0x00, // 0x68
+0x00,0x00,0x00,0x7D,0x40,0x00, // 0x69
+0x00,0x40,0x80,0x84,0x7D,0x00, // 0x6A
+0x00,0x7F,0x10,0x28,0x44,0x00, // 0x6B
+0x00,0x00,0x00,0x7F,0x40,0x00, // 0x6C
+0x00,0x7C,0x04,0x18,0x04,0x78, // 0x6D
+0x00,0x7C,0x04,0x04,0x78,0x00, // 0x6E
+0x00,0x38,0x44,0x44,0x44,0x38, // 0x6F
+0x00,0xFC,0x44,0x44,0x44,0x38, // 0x70
+0x00,0x38,0x44,0x44,0x44,0xFC, // 0x71
+0x00,0x44,0x78,0x44,0x04,0x08, // 0x72
+0x00,0x08,0x54,0x54,0x54,0x20, // 0x73
+0x00,0x04,0x3E,0x44,0x24,0x00, // 0x74
+0x00,0x3C,0x40,0x20,0x7C,0x00, // 0x75
+0x00,0x1C,0x20,0x40,0x20,0x1C, // 0x76
+0x00,0x3C,0x60,0x30,0x60,0x3C, // 0x77
+0x00,0x6C,0x10,0x10,0x6C,0x00, // 0x78
+0x00,0x9C,0xA0,0x60,0x3C,0x00, // 0x79
+0x00,0x64,0x54,0x54,0x4C,0x00, // 0x7A
+0x00,0x08,0x3E,0x41,0x41,0x00, // 0x7B
+0x00,0x00,0x00,0x77,0x00,0x00, // 0x7C
+0x00,0x00,0x41,0x41,0x3E,0x08, // 0x7D
+0x00,0x02,0x01,0x02,0x01,0x00, // 0x7E
+0x00,0x3C,0x26,0x23,0x26,0x3C, // 0x7F
+0x00,0x1E,0xA1,0xE1,0x21,0x12, // 0x80
+0x00,0x3D,0x40,0x20,0x7D,0x00, // 0x81
+0x00,0x38,0x54,0x54,0x55,0x09, // 0x82
+0x00,0x20,0x55,0x55,0x55,0x78, // 0x83
+0x00,0x20,0x55,0x54,0x55,0x78, // 0x84
+0x00,0x20,0x55,0x55,0x54,0x78, // 0x85
+0x00,0x20,0x57,0x55,0x57,0x78, // 0x86
+0x00,0x1C,0xA2,0xE2,0x22,0x14, // 0x87
+0x00,0x38,0x55,0x55,0x55,0x08, // 0x88
+0x00,0x38,0x55,0x54,0x55,0x08, // 0x89
+0x00,0x38,0x55,0x55,0x54,0x08, // 0x8A
+0x00,0x00,0x01,0x7C,0x41,0x00, // 0x8B
+0x00,0x00,0x01,0x7D,0x41,0x00, // 0x8C
+0x00,0x00,0x01,0x7C,0x40,0x00, // 0x8D
+0x00,0x70,0x29,0x24,0x29,0x70, // 0x8E
+0x00,0x78,0x2F,0x25,0x2F,0x78, // 0x8F
+0x00,0x7C,0x54,0x54,0x55,0x45, // 0x90
+0x00,0x34,0x54,0x7C,0x54,0x58, // 0x91
+0x00,0x7E,0x09,0x7F,0x49,0x49, // 0x92
+0x00,0x38,0x45,0x45,0x39,0x00, // 0x93
+0x00,0x38,0x45,0x44,0x39,0x00, // 0x94
+0x00,0x39,0x45,0x44,0x38,0x00, // 0x95
+0x00,0x3C,0x41,0x21,0x7D,0x00, // 0x96
+0x00,0x3D,0x41,0x20,0x7C,0x00, // 0x97
+0x00,0x9C,0xA1,0x60,0x3D,0x00, // 0x98
+0x00,0x3D,0x42,0x42,0x3D,0x00, // 0x99
+0x00,0x3C,0x41,0x40,0x3D,0x00, // 0x9A
+0x80,0x70,0x68,0x58,0x38,0x04, // 0x9B
+0x00,0x48,0x3E,0x49,0x49,0x62, // 0x9C
+0x00,0x7E,0x61,0x5D,0x43,0x3F, // 0x9D
+0x00,0x22,0x14,0x08,0x14,0x22, // 0x9E
+0x00,0x40,0x88,0x7E,0x09,0x02, // 0x9F
+0x00,0x20,0x54,0x55,0x55,0x78, // 0xA0
+0x00,0x00,0x00,0x7D,0x41,0x00, // 0xA1
+0x00,0x38,0x44,0x45,0x39,0x00, // 0xA2
+0x00,0x3C,0x40,0x21,0x7D,0x00, // 0xA3
+0x00,0x7A,0x09,0x0A,0x71,0x00, // 0xA4
+0x00,0x7A,0x11,0x22,0x79,0x00, // 0xA5
+0x00,0x08,0x55,0x55,0x55,0x5E, // 0xA6
+0x00,0x4E,0x51,0x51,0x4E,0x00, // 0xA7
+0x00,0x30,0x48,0x4D,0x40,0x20, // 0xA8
+0x3E,0x41,0x5D,0x4B,0x55,0x3E, // 0xA9
+0x04,0x04,0x04,0x04,0x04,0x1C, // 0xAA
+0x00,0x17,0x08,0x4C,0x6A,0x50, // 0xAB
+0x00,0x17,0x08,0x34,0x2A,0x78, // 0xAC
+0x00,0x00,0x30,0x7D,0x30,0x00, // 0xAD
+0x00,0x08,0x14,0x00,0x08,0x14, // 0xAE
+0x00,0x14,0x08,0x00,0x14,0x08, // 0xAF
+0x44,0x11,0x44,0x11,0x44,0x11, // 0xB0
+0xAA,0x55,0xAA,0x55,0xAA,0x55, // 0xB1
+0xBB,0xEE,0xBB,0xEE,0xBB,0xEE, // 0xB2
+0x00,0x00,0x00,0xFF,0x00,0x00, // 0xB3
+0x08,0x08,0x08,0xFF,0x00,0x00, // 0xB4
+0x00,0x70,0x28,0x25,0x29,0x70, // 0xB5
+0x00,0x70,0x29,0x25,0x29,0x70, // 0xB6
+0x00,0x70,0x29,0x25,0x28,0x70, // 0xB7
+0x3E,0x41,0x5D,0x55,0x41,0x3E, // 0xB8
+0x0A,0xFB,0x00,0xFF,0x00,0x00, // 0xB9
+0x00,0xFF,0x00,0xFF,0x00,0x00, // 0xBA
+0x0A,0xFA,0x02,0xFE,0x00,0x00, // 0xBB
+0x0A,0x0B,0x08,0x0F,0x00,0x00, // 0xBC
+0x00,0x18,0x24,0x66,0x24,0x00, // 0xBD
+0x00,0x29,0x2A,0x7C,0x2A,0x29, // 0xBE
+0x08,0x08,0x08,0xF8,0x00,0x00, // 0xBF
+0x00,0x00,0x00,0x0F,0x08,0x08, // 0xC0
+0x08,0x08,0x08,0x0F,0x08,0x08, // 0xC1
+0x08,0x08,0x08,0xF8,0x08,0x08, // 0xC2
+0x00,0x00,0x00,0xFF,0x08,0x08, // 0xC3
+0x08,0x08,0x08,0x08,0x08,0x08, // 0xC4
+0x08,0x08,0x08,0xFF,0x08,0x08, // 0xC5
+0x00,0x20,0x56,0x55,0x56,0x79, // 0xC6
+0x00,0x70,0x2A,0x25,0x2A,0x71, // 0xC7
+0x00,0x0F,0x08,0x0B,0x0A,0x0A, // 0xC8
+0x00,0xFE,0x02,0xFA,0x0A,0x0A, // 0xC9
+0x0A,0x0B,0x08,0x0B,0x0A,0x0A, // 0xCA
+0x0A,0xFA,0x02,0xFA,0x0A,0x0A, // 0xCB
+0x00,0xFF,0x00,0xFB,0x0A,0x0A, // 0xCC
+0x0A,0x0A,0x0A,0x0A,0x0A,0x0A, // 0xCD
+0x0A,0xFB,0x00,0xFB,0x0A,0x0A, // 0xCE
+0x00,0x5D,0x22,0x22,0x22,0x5D, // 0xCF
+0x00,0x22,0x55,0x59,0x30,0x00, // 0xD0
+0x00,0x08,0x7F,0x49,0x41,0x3E, // 0xD1
+0x00,0x7C,0x55,0x55,0x55,0x44, // 0xD2
+0x00,0x7C,0x55,0x54,0x55,0x44, // 0xD3
+0x00,0x7C,0x55,0x55,0x54,0x44, // 0xD4
+0x00,0x00,0x00,0x07,0x00,0x00, // 0xD5
+0x00,0x00,0x44,0x7D,0x45,0x00, // 0xD6
+0x00,0x00,0x45,0x7D,0x45,0x00, // 0xD7
+0x00,0x00,0x45,0x7C,0x45,0x00, // 0xD8
+0x08,0x08,0x08,0x0F,0x00,0x00, // 0xD9
+0x00,0x00,0x00,0xF8,0x08,0x08, // 0xDA
+0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // 0xDB
+0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, // 0xDC
+0x00,0x00,0x00,0x77,0x00,0x00, // 0xDD
+0x00,0x00,0x45,0x7D,0x44,0x00, // 0xDE
+0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, // 0xDF
+0x00,0x3C,0x42,0x43,0x3D,0x00, // 0xE0
+0x00,0xFE,0x4A,0x4A,0x34,0x00, // 0xE1
+0x00,0x3C,0x43,0x43,0x3D,0x00, // 0xE2
+0x00,0x3D,0x43,0x42,0x3C,0x00, // 0xE3
+0x00,0x32,0x49,0x4A,0x31,0x00, // 0xE4
+0x00,0x3A,0x45,0x46,0x39,0x00, // 0xE5
+0x00,0xFC,0x20,0x20,0x1C,0x00, // 0xE6
+0x00,0xFE,0xAA,0x28,0x10,0x00, // 0xE7
+0x00,0xFF,0xA5,0x24,0x18,0x00, // 0xE8
+0x00,0x3C,0x40,0x41,0x3D,0x00, // 0xE9
+0x00,0x3C,0x41,0x41,0x3D,0x00, // 0xEA
+0x00,0x3D,0x41,0x40,0x3C,0x00, // 0xEB
+0x00,0x9C,0xA0,0x61,0x3D,0x00, // 0xEC
+0x00,0x04,0x08,0x71,0x09,0x04, // 0xED
+0x00,0x00,0x02,0x02,0x02,0x00, // 0xEE
+0x00,0x00,0x07,0x03,0x00,0x00, // 0xEF
+0x00,0x00,0x08,0x08,0x08,0x00, // 0xF0
+0x00,0x00,0x24,0x2E,0x24,0x00, // 0xF1
+0x00,0x24,0x24,0x24,0x24,0x24, // 0xF2
+0x05,0x17,0x0A,0x34,0x2A,0x78, // 0xF3
+0x00,0x06,0x09,0x7F,0x01,0x7F, // 0xF4
+0x00,0x22,0x4D,0x55,0x59,0x22, // 0xF5
+0x00,0x08,0x08,0x2A,0x08,0x08, // 0xF6
+0x00,0x00,0x08,0x18,0x18,0x00, // 0xF7
+0x00,0x06,0x09,0x09,0x06,0x00, // 0xF8
+0x00,0x00,0x08,0x00,0x08,0x00, // 0xF9
+0x00,0x00,0x08,0x00,0x00,0x00, // 0xFA
+0x00,0x02,0x0F,0x00,0x00,0x00, // 0xFB
+0x00,0x09,0x0F,0x05,0x00,0x00, // 0xFC
+0x00,0x09,0x0D,0x0A,0x00,0x00, // 0xFD
+0x00,0x3C,0x3C,0x3C,0x3C,0x00, // 0xFE
+0x00,0x00,0x00,0x00,0x00,0x00  // 0xFF
+};
+
+//the main information about font
+const struct font_info font_fixed_8px PROGMEM = {256*6,6,8,0x00,0xFF,0,font_fixed_8px_data};
+
+
+#endif
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_proportional_16px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_proportional_16px.c
new file mode 100644 (file)
index 0000000..9d574f5
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : font_proportional_16px.c
+    Date                : 05.09.2010
+    Font size in bytes  : 0x0700, 1792
+    Font width          : 11
+    Font height         : 16
+    Font first char     : 0x20
+    Font last char      : 0xFC
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_font_proportional_16px
+
+
+
+const uint8_t font_proportional_16px_data[] PROGMEM = {
+    0x04, 0x02, 0x05, 0x08, 0x07, 0x09, 0x07, 0x02, 0x04, 0x04, 0x06, 0x07, 0x03, 0x05, 0x02, 0x07, 
+    0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x02, 0x03, 0x05, 0x08, 0x05, 0x06, 
+    0x09, 0x08, 0x07, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07, 0x04, 0x05, 0x07, 0x06, 0x08, 0x07, 0x07, 
+    0x07, 0x07, 0x07, 0x07, 0x06, 0x07, 0x08, 0x0A, 0x08, 0x08, 0x06, 0x04, 0x05, 0x04, 0x08, 0x08, 
+    0x03, 0x06, 0x06, 0x05, 0x06, 0x06, 0x05, 0x06, 0x06, 0x02, 0x03, 0x06, 0x02, 0x08, 0x06, 0x06, 
+    0x06, 0x06, 0x05, 0x06, 0x05, 0x06, 0x07, 0x08, 0x06, 0x07, 0x06, 0x06, 0x02, 0x06, 0x07, 0x00, 
+    0x07, 0x00, 0x03, 0x00, 0x06, 0x08, 0x07, 0x07, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x03, 0x03, 0x06, 0x06, 0x07, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 
+    0x06, 0x09, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x08, 0x0A, 0x0A, 0x0A, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 
+    0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x0D, 0xF8, 0x0D, 0x3C, 0x00, 0x3C, 0x00, 
+    0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, 0x03, 0x60, 0x0F, 0xE0, 0x03, 0x78, 0x03, 0x60, 0x0F, 
+    0xE0, 0x03, 0x78, 0x03, 0x60, 0x00, 0x70, 0x04, 0xF8, 0x08, 0x88, 0x08, 0xFC, 0x1F, 0x88, 0x08, 
+    0x88, 0x0F, 0x10, 0x07, 0xF8, 0x00, 0x88, 0x00, 0xF8, 0x0C, 0x00, 0x03, 0x80, 0x00, 0x60, 0x00, 
+    0x98, 0x0F, 0x80, 0x08, 0x80, 0x0F, 0x70, 0x07, 0xF8, 0x0F, 0x88, 0x08, 0xF8, 0x09, 0x70, 0x07, 
+    0x00, 0x0E, 0x00, 0x0B, 0x3C, 0x00, 0x3C, 0x00, 0xE0, 0x0F, 0xF8, 0x3F, 0x1C, 0x70, 0x04, 0x40, 
+    0x04, 0x40, 0x1C, 0x70, 0xF8, 0x3F, 0xE0, 0x0F, 0x28, 0x00, 0x10, 0x00, 0x7C, 0x00, 0x7C, 0x00, 
+    0x10, 0x00, 0x28, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xF0, 0x07, 0x80, 0x00, 0x80, 0x00, 
+    0x80, 0x00, 0x00, 0x18, 0x00, 0x1E, 0x00, 0x06, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 
+    0x80, 0x00, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x03, 0xC0, 0x00, 0x30, 0x00, 
+    0x0C, 0x00, 0x00, 0x00, 0xF0, 0x07, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0xF0, 0x07, 
+    0x10, 0x08, 0x10, 0x08, 0xF8, 0x0F, 0xF8, 0x0F, 0x00, 0x08, 0x00, 0x08, 0x30, 0x0C, 0x08, 0x0E, 
+    0x08, 0x0B, 0x88, 0x09, 0xF8, 0x08, 0x70, 0x08, 0x10, 0x04, 0x08, 0x08, 0x88, 0x08, 0x88, 0x08, 
+    0xF8, 0x0F, 0x70, 0x07, 0x80, 0x01, 0x60, 0x01, 0x10, 0x01, 0xF8, 0x0F, 0xF8, 0x0F, 0x00, 0x01, 
+    0x00, 0x04, 0x78, 0x08, 0x78, 0x08, 0x48, 0x08, 0xC8, 0x0F, 0x88, 0x07, 0xE0, 0x07, 0xF0, 0x0F, 
+    0x58, 0x08, 0x48, 0x08, 0xC8, 0x0F, 0x80, 0x07, 0x08, 0x00, 0x08, 0x0E, 0x88, 0x0F, 0xE8, 0x01, 
+    0x78, 0x00, 0x18, 0x00, 0x70, 0x07, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, 0xF8, 0x0F, 0x70, 0x07, 
+    0xF0, 0x00, 0xF8, 0x09, 0x08, 0x09, 0x08, 0x0D, 0xF8, 0x07, 0xF0, 0x03, 0x60, 0x0C, 0x60, 0x0C, 
+    0x00, 0x18, 0x30, 0x1E, 0x30, 0x06, 0x80, 0x01, 0xC0, 0x03, 0x60, 0x06, 0x30, 0x0C, 0x18, 0x18, 
+    0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 
+    0x18, 0x18, 0x30, 0x0C, 0x60, 0x06, 0xC0, 0x03, 0x80, 0x01, 0x10, 0x00, 0x08, 0x00, 0x88, 0x0D, 
+    0xC8, 0x0D, 0x78, 0x00, 0x30, 0x00, 0xE0, 0x07, 0x10, 0x08, 0xC8, 0x13, 0xE8, 0x17, 0x28, 0x14, 
+    0xE8, 0x13, 0xE8, 0x17, 0x10, 0x14, 0xE0, 0x03, 0x00, 0x0C, 0x80, 0x0F, 0xE0, 0x03, 0x38, 0x01, 
+    0x38, 0x01, 0xE0, 0x03, 0x80, 0x0F, 0x00, 0x0C, 0xF8, 0x0F, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, 
+    0x88, 0x08, 0xF8, 0x0F, 0x70, 0x07, 0xF0, 0x07, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 
+    0x08, 0x08, 0x30, 0x06, 0xF8, 0x0F, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x18, 0x0C, 0xF0, 0x07, 
+    0xE0, 0x03, 0xF8, 0x0F, 0xF8, 0x0F, 0x88, 0x08, 0x88, 0x08, 0x88, 0x08, 0x08, 0x08, 0xF8, 0x0F, 
+    0xF8, 0x0F, 0x88, 0x00, 0x88, 0x00, 0x88, 0x00, 0x08, 0x00, 0xF0, 0x07, 0xF8, 0x0F, 0x08, 0x08, 
+    0x08, 0x08, 0x88, 0x08, 0x88, 0x0F, 0xB0, 0x0F, 0xF8, 0x0F, 0xF8, 0x0F, 0x80, 0x00, 0x80, 0x00, 
+    0x80, 0x00, 0xF8, 0x0F, 0xF8, 0x0F, 0x08, 0x08, 0xF8, 0x0F, 0xF8, 0x0F, 0x08, 0x08, 0x00, 0x08, 
+    0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0xF8, 0x07, 0xF8, 0x0F, 0xF8, 0x0F, 0xC0, 0x01, 0x60, 0x03, 
+    0x30, 0x06, 0x18, 0x0C, 0x08, 0x08, 0xF8, 0x0F, 0xF8, 0x0F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 
+    0x00, 0x08, 0xF8, 0x0F, 0x78, 0x00, 0xE0, 0x01, 0x80, 0x07, 0x80, 0x01, 0x60, 0x00, 0xF8, 0x0F, 
+    0xF8, 0x0F, 0xF8, 0x0F, 0x18, 0x00, 0x78, 0x00, 0xE0, 0x01, 0x80, 0x07, 0x00, 0x0E, 0xF8, 0x0F, 
+    0xF0, 0x07, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xF8, 0x0F, 0xF0, 0x07, 0xF8, 0x0F, 
+    0xF8, 0x0F, 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0xF8, 0x01, 0xF0, 0x00, 0xF0, 0x07, 0xF8, 0x0F, 
+    0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0xF8, 0x1F, 0xF0, 0x17, 0xF8, 0x0F, 0xF8, 0x0F, 0x88, 0x00, 
+    0x88, 0x01, 0x88, 0x03, 0xF8, 0x06, 0x70, 0x0C, 0x70, 0x06, 0xF8, 0x08, 0x88, 0x08, 0x88, 0x08, 
+    0x88, 0x08, 0x88, 0x0F, 0x30, 0x07, 0x08, 0x00, 0x08, 0x00, 0xF8, 0x0F, 0xF8, 0x0F, 0x08, 0x00, 
+    0x08, 0x00, 0xF8, 0x07, 0xF8, 0x0F, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0xF8, 0x0F, 0xF8, 0x07, 
+    0x38, 0x00, 0xF8, 0x00, 0xC0, 0x03, 0x00, 0x0F, 0x00, 0x0F, 0xC0, 0x03, 0xF8, 0x00, 0x38, 0x00, 
+    0xF8, 0x03, 0xF8, 0x0F, 0x00, 0x0F, 0xC0, 0x03, 0xF0, 0x00, 0xF0, 0x00, 0xC0, 0x03, 0x00, 0x0F, 
+    0xF8, 0x0F, 0xF8, 0x03, 0x18, 0x0C, 0x38, 0x0E, 0x60, 0x03, 0xC0, 0x01, 0xC0, 0x01, 0x60, 0x03, 
+    0x38, 0x0E, 0x18, 0x0C, 0x18, 0x00, 0x78, 0x00, 0xE0, 0x00, 0x80, 0x0F, 0x80, 0x0F, 0xE0, 0x00, 
+    0x78, 0x00, 0x18, 0x00, 0x08, 0x0E, 0x08, 0x0F, 0x88, 0x09, 0xC8, 0x08, 0x78, 0x08, 0x38, 0x08, 
+    0xFC, 0x1F, 0xFC, 0x1F, 0x04, 0x10, 0x04, 0x10, 0x0C, 0x00, 0x30, 0x00, 0xC0, 0x00, 0x00, 0x03, 
+    0x00, 0x0C, 0x04, 0x10, 0x04, 0x10, 0xFC, 0x1F, 0xFC, 0x1F, 0x40, 0x00, 0x20, 0x00, 0x10, 0x00, 
+    0x08, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 
+    0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x04, 0x00, 0x0C, 0x00, 0x08, 0x00, 
+    0x00, 0x06, 0x40, 0x0F, 0x20, 0x09, 0x20, 0x09, 0xE0, 0x0F, 0xC0, 0x0F, 0xFC, 0x0F, 0xFC, 0x0F, 
+    0x40, 0x08, 0x20, 0x08, 0xE0, 0x0F, 0xC0, 0x07, 0xC0, 0x07, 0xE0, 0x0F, 0x20, 0x08, 0x20, 0x08, 
+    0x40, 0x04, 0xC0, 0x07, 0xE0, 0x0F, 0x20, 0x08, 0x20, 0x04, 0xFC, 0x0F, 0xFC, 0x0F, 0xC0, 0x07, 
+    0xE0, 0x0F, 0x20, 0x09, 0x20, 0x09, 0xE0, 0x09, 0xC0, 0x05, 0x20, 0x00, 0xF8, 0x0F, 0xFC, 0x0F, 
+    0x24, 0x00, 0x04, 0x00, 0xC0, 0x27, 0xE0, 0x4F, 0x20, 0x48, 0x20, 0x44, 0xE0, 0x7F, 0xE0, 0x3F, 
+    0xFC, 0x0F, 0xFC, 0x0F, 0x40, 0x00, 0x20, 0x00, 0xE0, 0x0F, 0xC0, 0x0F, 0xEC, 0x0F, 0xEC, 0x0F, 
+    0x20, 0x40, 0xEC, 0x7F, 0xEC, 0x3F, 0xFC, 0x0F, 0xFC, 0x0F, 0x80, 0x03, 0xC0, 0x06, 0x60, 0x0C, 
+    0x20, 0x08, 0xFC, 0x0F, 0xFC, 0x0F, 0xE0, 0x0F, 0xE0, 0x0F, 0x20, 0x00, 0xE0, 0x0F, 0xC0, 0x0F, 
+    0x20, 0x00, 0xE0, 0x0F, 0xC0, 0x0F, 0xE0, 0x0F, 0xE0, 0x0F, 0x40, 0x00, 0x20, 0x00, 0xE0, 0x0F, 
+    0xC0, 0x0F, 0xC0, 0x07, 0xE0, 0x0F, 0x20, 0x08, 0x20, 0x08, 0xE0, 0x0F, 0xC0, 0x07, 0xE0, 0x7F, 
+    0xE0, 0x7F, 0x40, 0x08, 0x20, 0x08, 0xE0, 0x0F, 0xC0, 0x07, 0xC0, 0x07, 0xE0, 0x0F, 0x20, 0x08, 
+    0x20, 0x04, 0xE0, 0x7F, 0xE0, 0x7F, 0xE0, 0x0F, 0xE0, 0x0F, 0x40, 0x00, 0x60, 0x00, 0x60, 0x00, 
+    0xC0, 0x04, 0xE0, 0x09, 0xA0, 0x09, 0x20, 0x0B, 0x20, 0x0F, 0x40, 0x06, 0x20, 0x00, 0xF8, 0x07, 
+    0xF8, 0x0F, 0x20, 0x08, 0x20, 0x08, 0xE0, 0x07, 0xE0, 0x0F, 0x00, 0x08, 0x00, 0x04, 0xE0, 0x0F, 
+    0xE0, 0x0F, 0xE0, 0x00, 0xE0, 0x03, 0x00, 0x0F, 0x00, 0x0C, 0x00, 0x0F, 0xE0, 0x03, 0xE0, 0x00, 
+    0xE0, 0x00, 0xE0, 0x07, 0x00, 0x0E, 0xC0, 0x03, 0xC0, 0x03, 0x00, 0x0E, 0xE0, 0x07, 0xE0, 0x00, 
+    0x60, 0x0C, 0xE0, 0x0E, 0x80, 0x03, 0x80, 0x03, 0xE0, 0x0E, 0x60, 0x0C, 0xE0, 0x00, 0xE0, 0x03, 
+    0x00, 0x6F, 0x00, 0x7C, 0x00, 0x1F, 0xE0, 0x03, 0xE0, 0x00, 0x20, 0x0C, 0x20, 0x0E, 0x20, 0x0B, 
+    0xA0, 0x09, 0xE0, 0x08, 0x60, 0x08, 0x80, 0x00, 0x80, 0x00, 0xF8, 0x1F, 0x7C, 0x3F, 0x04, 0x20, 
+    0x04, 0x20, 0xFC, 0x3F, 0xFC, 0x3F, 0x04, 0x20, 0x04, 0x20, 0x7C, 0x3F, 0xF8, 0x1F, 0x80, 0x00, 
+    0x80, 0x00, 0x80, 0x03, 0xC0, 0x00, 0xC0, 0x00, 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0xC0, 0x01, 
+    0xE0, 0x03, 0xF0, 0x07, 0x58, 0x0D, 0x48, 0x09, 0x48, 0x09, 0x48, 0x09, 0x10, 0x04, 0x00, 0x20, 
+    0x00, 0x3C, 0x00, 0x1C, 0x00, 0x20, 0x00, 0x3C, 0x00, 0x1C, 0x00, 0x20, 0x00, 0x3C, 0x00, 0x1C, 
+    0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x0C, 
+    0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0xFC, 0x07, 0xFC, 0x07, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 
+    0x10, 0x01, 0x10, 0x01, 0xFC, 0x07, 0xFC, 0x07, 0x10, 0x01, 0x10, 0x01, 0x00, 0x00, 0x08, 0x00, 
+    0x0C, 0x00, 0x04, 0x00, 0x0C, 0x00, 0x08, 0x00, 0x1C, 0x00, 0x3C, 0x00, 0x20, 0x00, 0x20, 0x00, 
+    0x3C, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0x3C, 0x00, 0x20, 0x00, 0x1C, 0x00, 0x3C, 0x00, 0x20, 0x00, 
+    0x20, 0x00, 0x3C, 0x00, 0x1C, 0x00, 0x20, 0x00, 0x3C, 0x00, 0x1C, 0x00, 0x00, 0x00, 0xC0, 0x03, 
+    0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xC0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 
+    0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0xC0, 0x03, 
+    0x60, 0x06, 0x00, 0x00, 0x80, 0x01, 0xC0, 0x03, 0x60, 0x06, 0x00, 0x00, 0x70, 0x00, 0x88, 0x00, 
+    0x88, 0x00, 0x88, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 
+    0xF0, 0x0F, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08, 0x00, 0x00, 0x10, 0x01, 0x88, 0x01, 0xC8, 0x01, 
+    0x78, 0x01, 0x30, 0x01, 0x00, 0x00, 0x90, 0x00, 0x08, 0x01, 0x28, 0x01, 0xF8, 0x01, 0xD0, 0x00, 
+    0xF0, 0x00, 0xF8, 0x01, 0x08, 0x01, 0x08, 0x01, 0xF8, 0x01, 0xF0, 0x00, 0x00, 0x00, 0x60, 0x06, 
+    0xC0, 0x03, 0x80, 0x01, 0x00, 0x00, 0x60, 0x06, 0xC0, 0x03, 0x80, 0x01, 0x10, 0x00, 0xF8, 0x09, 
+    0x00, 0x04, 0x00, 0x03, 0x80, 0x00, 0x60, 0x06, 0x10, 0x05, 0x88, 0x04, 0xC0, 0x0F, 0x00, 0x04, 
+    0x10, 0x00, 0xF8, 0x09, 0x00, 0x04, 0x00, 0x03, 0x80, 0x00, 0x60, 0x00, 0x90, 0x08, 0x48, 0x0C, 
+    0x40, 0x0A, 0x80, 0x09, 0x88, 0x00, 0xA8, 0x08, 0xD8, 0x04, 0x00, 0x02, 0x80, 0x01, 0x60, 0x06, 
+    0x10, 0x05, 0x88, 0x04, 0xC0, 0x0F, 0x00, 0x04, 0x00, 0x0C, 0x86, 0x0F, 0xE6, 0x03, 0x38, 0x01, 
+    0x38, 0x01, 0xE6, 0x03, 0x86, 0x0F, 0x00, 0x0C, 0xE0, 0x07, 0xF6, 0x0F, 0x16, 0x08, 0x10, 0x08, 
+    0x10, 0x08, 0x16, 0x08, 0xF6, 0x0F, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 
+    0x40, 0x01, 0x80, 0x00, 0x40, 0x01, 0x20, 0x02, 0xF0, 0x07, 0xF6, 0x0F, 0x06, 0x08, 0x00, 0x08, 
+    0x06, 0x08, 0xF6, 0x0F, 0xF0, 0x07, 0xF8, 0x0F, 0xFC, 0x0F, 0x04, 0x00, 0x44, 0x08, 0x7C, 0x08, 
+    0xF8, 0x0F, 0x80, 0x07, 0x00, 0x06, 0x4C, 0x0F, 0x2C, 0x09, 0x20, 0x09, 0x2C, 0x09, 0xEC, 0x0F, 
+    0xC0, 0x0F, 0xC0, 0x07, 0xEC, 0x0F, 0x2C, 0x08, 0x20, 0x08, 0x2C, 0x08, 0xEC, 0x0F, 0xC0, 0x07, 
+    0xC0, 0x17, 0xE0, 0x0F, 0x20, 0x0E, 0x20, 0x09, 0xE0, 0x08, 0xE0, 0x0F, 0xD0, 0x07, 0xE0, 0x07, 
+    0xEC, 0x0F, 0x0C, 0x08, 0x00, 0x08, 0x0C, 0x04, 0xEC, 0x0F, 0xE0, 0x0F
+};
+
+const struct font_info font_proportional_16px PROGMEM = {0x00+(0x07<<8),0x0B,0x10,0x20,0xFC,font_proportional_16px_data,(uint8_t*)font_proportional_16px_data+0xFC-0x20+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_proportional_8px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/font_proportional_8px.c
new file mode 100644 (file)
index 0000000..0d32ba8
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+    created with FontEditor written by H. Reddmann (HaReddmann at t-online dot de)
+    using template file by J. Michel (jan at mueschelsoft.de)
+
+    File Name           : font_proportional_8px.c
+    Date                : 05.07.2009
+    Font size in bytes  : 0x0458, 1112
+    Font width          : 8
+    Font height         : 8
+    Font first char     : 0x20
+    Font last char      : 0xFF
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_font_proportional_8px
+
+
+
+const uint8_t font_proportional_8px_data[] PROGMEM = {
+    0x02, 0x01, 0x03, 0x05, 0x05, 0x07, 0x05, 0x01, 0x03, 0x03, 0x05, 0x05, 0x02, 0x03, 0x01, 0x04, 
+    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x01, 0x01, 0x04, 0x05, 0x04, 0x04, 
+    0x07, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x03, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 
+    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x03, 0x04, 0x03, 0x05, 0x05, 
+    0x02, 0x05, 0x05, 0x04, 0x05, 0x05, 0x04, 0x05, 0x04, 0x01, 0x02, 0x04, 0x02, 0x05, 0x04, 0x04, 
+    0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 0x07, 0x05, 0x04, 0x04, 0x04, 0x02, 0x04, 0x05, 0x00, 
+    0x04, 0x05, 0x02, 0x00, 0x04, 0x08, 0x03, 0x03, 0x04, 0x09, 0x00, 0x03, 0x06, 0x00, 0x00, 0x00, 
+    0x00, 0x02, 0x02, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x06, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 
+    0x00, 0x00, 0x04, 0x04, 0x05, 0x05, 0x02, 0x04, 0x05, 0x06, 0x03, 0x05, 0x04, 0x03, 0x07, 0x05, 
+    0x04, 0x05, 0x03, 0x03, 0x02, 0x04, 0x05, 0x02, 0x03, 0x02, 0x04, 0x05, 0x06, 0x06, 0x06, 0x04, 
+    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 
+    0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 
+    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x03, 0x03, 
+    0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 
+    
+    0x00, 0x00, 0x5F, 0x07, 0x00, 0x07, 0x74, 0x1C, 0x77, 0x1C, 0x17, 0x2E, 0x6A, 0x3E, 0x2B, 0x3A, 
+    0x06, 0x49, 0x36, 0x08, 0x36, 0x49, 0x30, 0x36, 0x49, 0x59, 0x76, 0x48, 0x07, 0x3C, 0x42, 0x81, 
+    0x81, 0x42, 0x3C, 0x0A, 0x04, 0x1F, 0x04, 0x0A, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x80, 0x60, 0x08, 
+    0x08, 0x08, 0x40, 0xC0, 0x30, 0x0C, 0x03, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x44, 0x42, 0x7F, 0x40, 
+    0x40, 0x46, 0x61, 0x51, 0x49, 0x46, 0x22, 0x41, 0x49, 0x49, 0x36, 0x18, 0x14, 0x12, 0x7F, 0x10, 
+    0x27, 0x45, 0x45, 0x45, 0x39, 0x3E, 0x49, 0x49, 0x49, 0x30, 0x01, 0x01, 0x71, 0x0D, 0x03, 0x36, 
+    0x49, 0x49, 0x49, 0x36, 0x06, 0x49, 0x49, 0x29, 0x1E, 0x36, 0xD0, 0x08, 0x14, 0x22, 0x41, 0x14, 
+    0x14, 0x14, 0x14, 0x14, 0x41, 0x22, 0x14, 0x08, 0x02, 0x51, 0x09, 0x06, 0x3C, 0x42, 0x99, 0xA5, 
+    0xBD, 0x42, 0x1C, 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x3E, 0x41, 0x41, 
+    0x41, 0x22, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x7F, 0x09, 0x09, 0x09, 
+    0x01, 0x3E, 0x41, 0x49, 0x49, 0x7A, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x41, 0x7F, 0x41, 0x40, 0x41, 
+    0x41, 0x3F, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x06, 0x0C, 0x06, 
+    0x7F, 0x7F, 0x06, 0x08, 0x30, 0x7F, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x09, 0x09, 0x09, 0x06, 
+    0x3E, 0x41, 0x61, 0xC1, 0xBE, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x26, 0x49, 0x49, 0x49, 0x32, 0x01, 
+    0x01, 0x7F, 0x01, 0x01, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x07, 0x38, 0x40, 0x38, 0x07, 0x1F, 0x60, 
+    0x1F, 0x60, 0x1F, 0x63, 0x14, 0x08, 0x14, 0x63, 0x01, 0x06, 0x78, 0x06, 0x01, 0x61, 0x51, 0x49, 
+    0x45, 0x43, 0x7F, 0x41, 0x41, 0x03, 0x0C, 0x30, 0xC0, 0x41, 0x41, 0x7F, 0x04, 0x02, 0x01, 0x02, 
+    0x04, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01, 0x02, 0x20, 0x54, 0x54, 0x54, 0x78, 0x7F, 0x44, 0x44, 
+    0x44, 0x38, 0x38, 0x44, 0x44, 0x44, 0x38, 0x44, 0x44, 0x44, 0x7F, 0x38, 0x54, 0x54, 0x54, 0x58, 
+    0x08, 0x7E, 0x09, 0x01, 0x18, 0xA4, 0xA4, 0xA4, 0x78, 0x7F, 0x04, 0x04, 0x78, 0x7D, 0x80, 0x7D, 
+    0x7F, 0x10, 0x28, 0x44, 0x3F, 0x40, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x7C, 0x04, 0x04, 0x78, 0x38, 
+    0x44, 0x44, 0x38, 0xFC, 0x24, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x24, 0xFC, 0x7C, 0x08, 0x04, 
+    0x04, 0x48, 0x54, 0x54, 0x24, 0x04, 0x3F, 0x44, 0x40, 0x3C, 0x40, 0x40, 0x7C, 0x1C, 0x20, 0x40, 
+    0x20, 0x1C, 0x1C, 0x60, 0x60, 0x1C, 0x60, 0x60, 0x1C, 0x44, 0x28, 0x10, 0x28, 0x44, 0x9C, 0xA0, 
+    0x60, 0x1C, 0x64, 0x54, 0x54, 0x4C, 0x18, 0x7E, 0x81, 0x81, 0xFF, 0xFF, 0x81, 0x81, 0x7E, 0x18, 
+    0x18, 0x04, 0x08, 0x10, 0x0C, 0x14, 0x3E, 0x55, 0x55, 0xFF, 0x81, 0x81, 0x81, 0xFF, 0x80, 0x60, 
+    0x80, 0x60, 0x80, 0x60, 0x60, 0x60, 0x00, 0x60, 0x60, 0x00, 0x60, 0x60, 0x04, 0x7F, 0x04, 0x14, 
+    0x7F, 0x14, 0x02, 0x01, 0x01, 0x02, 0x46, 0x29, 0x16, 0x08, 0x34, 0x4A, 0x31, 0x48, 0x30, 0x00, 
+    0x18, 0x24, 0x3E, 0x41, 0x22, 0x7F, 0x49, 0x41, 0x03, 0x04, 0x04, 0x03, 0x03, 0x04, 0x03, 0x04, 
+    0x04, 0x03, 0x04, 0x03, 0x18, 0x3C, 0x3C, 0x18, 0x08, 0x08, 0x08, 0x08, 0x03, 0x01, 0x02, 0x03, 
+    0x02, 0x0E, 0x02, 0x0E, 0x06, 0x0E, 0x00, 0x48, 0x30, 0x38, 0x44, 0x38, 0x54, 0x48, 0x38, 0x44, 
+    0xFE, 0x44, 0x48, 0x7E, 0x49, 0x01, 0x44, 0x38, 0x28, 0x38, 0x44, 0x03, 0x14, 0x7C, 0x14, 0x03, 
+    0xE7, 0xE7, 0x4E, 0x55, 0x55, 0x39, 0x01, 0x01, 0x00, 0x01, 0x01, 0x1C, 0x2A, 0x55, 0x55, 0x22, 
+    0x1C, 0x1D, 0x15, 0x1E, 0x18, 0x24, 0x00, 0x18, 0x24, 0x08, 0x08, 0x08, 0x18, 0x08, 0x08, 0x08, 
+    0x3C, 0x42, 0xBD, 0x95, 0xA9, 0x42, 0x3C, 0x01, 0x01, 0x01, 0x01, 0x01, 0x06, 0x09, 0x09, 0x06, 
+    0x44, 0x44, 0x5F, 0x44, 0x44, 0x19, 0x15, 0x12, 0x15, 0x15, 0x0A, 0x02, 0x01, 0xFC, 0x20, 0x20, 
+    0x1C, 0x0E, 0x7F, 0x01, 0x7F, 0x01, 0x18, 0x18, 0x00, 0x80, 0x40, 0x02, 0x1F, 0x06, 0x09, 0x09, 
+    0x06, 0x24, 0x18, 0x00, 0x24, 0x18, 0x82, 0x4F, 0x30, 0x4C, 0x62, 0xF1, 0x82, 0x4F, 0x30, 0x0C, 
+    0xD2, 0xB1, 0x95, 0x5F, 0x30, 0x4C, 0x62, 0xF1, 0x30, 0x48, 0x45, 0x20, 0x60, 0x39, 0x2E, 0x38, 
+    0x60, 0x60, 0x38, 0x2E, 0x39, 0x60, 0x70, 0x1D, 0x13, 0x1D, 0x70, 0x72, 0x1D, 0x12, 0x1E, 0x71, 
+    0x70, 0x1D, 0x12, 0x1D, 0x70, 0x60, 0x3B, 0x25, 0x3B, 0x60, 0x7E, 0x11, 0x7F, 0x49, 0x41, 0x1E, 
+    0x21, 0x61, 0x92, 0x7C, 0x55, 0x56, 0x44, 0x7C, 0x56, 0x55, 0x44, 0x7C, 0x56, 0x55, 0x46, 0x7D, 
+    0x54, 0x54, 0x45, 0x45, 0x7E, 0x44, 0x44, 0x7E, 0x45, 0x46, 0x7D, 0x46, 0x45, 0x7C, 0x45, 0x08, 
+    0x7F, 0x49, 0x41, 0x3E, 0x7E, 0x09, 0x12, 0x22, 0x7D, 0x38, 0x45, 0x46, 0x44, 0x38, 0x38, 0x44, 
+    0x46, 0x45, 0x38, 0x38, 0x46, 0x45, 0x46, 0x38, 0x3A, 0x45, 0x45, 0x46, 0x39, 0x38, 0x45, 0x44, 
+    0x45, 0x38, 0x22, 0x14, 0x08, 0x14, 0x22, 0xBC, 0x62, 0x5A, 0x46, 0x3D, 0x3C, 0x41, 0x42, 0x3C, 
+    0x3C, 0x42, 0x41, 0x3C, 0x3C, 0x42, 0x41, 0x3E, 0x3D, 0x40, 0x40, 0x3D, 0x06, 0x08, 0xF2, 0x09, 
+    0x06, 0x7F, 0x22, 0x22, 0x1C, 0xFE, 0x09, 0x89, 0x76, 0x20, 0x55, 0x56, 0x78, 0x20, 0x56, 0x55, 
+    0x78, 0x22, 0x55, 0x55, 0x7A, 0x23, 0x55, 0x56, 0x7B, 0x20, 0x55, 0x54, 0x79, 0x27, 0x55, 0x57, 
+    0x78, 0x20, 0x54, 0x38, 0x54, 0x48, 0x38, 0x44, 0xC4, 0x38, 0x55, 0x56, 0x58, 0x38, 0x56, 0x55, 
+    0x58, 0x3A, 0x55, 0x55, 0x5A, 0x39, 0x54, 0x54, 0x59, 0x01, 0x7A, 0x7A, 0x01, 0x02, 0x79, 0x02, 
+    0x02, 0x78, 0x02, 0x60, 0x91, 0x92, 0x7C, 0x7B, 0x09, 0x0A, 0x73, 0x38, 0x45, 0x46, 0x38, 0x38, 
+    0x46, 0x45, 0x38, 0x3A, 0x45, 0x45, 0x3A, 0x3B, 0x45, 0x46, 0x3B, 0x39, 0x44, 0x44, 0x39, 0x08, 
+    0x08, 0x2A, 0x08, 0x08, 0xB8, 0x64, 0x4C, 0x3A, 0x3C, 0x41, 0x42, 0x7C, 0x3C, 0x42, 0x41, 0x7C, 
+    0x3A, 0x41, 0x41, 0x7A, 0x3D, 0x40, 0x40, 0x7D, 0x98, 0x62, 0x19, 0xFF, 0x42, 0x3C, 0x9A, 0x60, 
+    0x1A
+};
+
+const struct font_info font_proportional_8px PROGMEM = {0x58+(0x04<<8),0x08,0x08,0x20,0xFF,font_proportional_8px_data,(uint8_t*)font_proportional_8px_data+0xFF-0x20+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/symbols_16px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/symbols_16px.c
new file mode 100644 (file)
index 0000000..3ed4bd3
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : symbols_16px.c
+    Date                : 05.09.2010
+    Font size in bytes  : 0x0130, 304
+    Font width          : 20
+    Font height         : 16
+    Font first char     : 0x00
+    Font last char      : 0x09
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_symbols_16px
+
+
+
+const uint8_t symbols_16px_data[] PROGMEM = {
+    0x0F, 0x0F, 0x0D, 0x0D, 0x0D, 0x0D, 0x0D, 0x0E, 0x0F, 0x13, 
+    0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x84, 0x43, 0x8C, 0x63, 0x9C, 0x73, 
+    0xBC, 0x7B, 0xF8, 0x3F, 0xF0, 0x1F, 0xE0, 0x0F, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x01, 0x00, 0x01, 
+    0x80, 0x03, 0xC0, 0x07, 0xE0, 0x0F, 0xF0, 0x1F, 0xF8, 0x3F, 0xBC, 0x7B, 0x9C, 0x73, 0x8C, 0x63, 
+    0x84, 0x43, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x00, 0x0F, 0x80, 0x07, 
+    0xC0, 0x03, 0xE0, 0x01, 0xF0, 0x00, 0xF8, 0xFF, 0xFC, 0xFF, 0xF8, 0xFF, 0xF0, 0x00, 0xE0, 0x01, 
+    0xC0, 0x03, 0x80, 0x07, 0x00, 0x0F, 0xC0, 0x03, 0x80, 0x07, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x3C, 
+    0xFC, 0x7F, 0xFC, 0xFF, 0xFC, 0x7F, 0x00, 0x3C, 0x00, 0x1E, 0x00, 0x0F, 0x80, 0x07, 0xC0, 0x03, 
+    0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0xFC, 0x7F, 0xFC, 0x7F, 0xFC, 0x7F, 
+    0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 
+    0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 
+    0x80, 0x03, 0x80, 0x03, 0x00, 0x00, 0x00, 0x20, 0x30, 0x70, 0x78, 0x78, 0xF8, 0x3C, 0xE0, 0x1F, 
+    0x80, 0x0F, 0x80, 0x07, 0xC0, 0x0F, 0xE0, 0x1E, 0x70, 0x3C, 0x78, 0x38, 0x30, 0x18, 0x00, 0x04, 
+    0x00, 0x0E, 0x00, 0x3E, 0x00, 0xF8, 0x00, 0x78, 0x00, 0x3C, 0x00, 0x0E, 0x80, 0x03, 0xC0, 0x01, 
+    0x60, 0x00, 0x30, 0x00, 0x18, 0x00, 0x0C, 0x00, 0x02, 0x00, 0xE0, 0x0F, 0xF0, 0x1F, 0x10, 0x10, 
+    0x10, 0x10, 0x10, 0x10, 0xF0, 0x1F, 0xE0, 0x0F, 0x00, 0x00, 0xF0, 0x1F, 0xF0, 0x1F, 0x80, 0x03, 
+    0xC0, 0x06, 0x60, 0x0C, 0x30, 0x18, 0x10, 0x10, 0xF0, 0x1F, 0xF0, 0x1F, 0x10, 0x11, 0x10, 0x11, 
+    0x10, 0x10, 0x00, 0x00, 0xE0, 0x0C, 0xF0, 0x11, 0x10, 0x11, 0x10, 0x11, 0x10, 0x1F, 0x60, 0x0E, 
+    0x00, 0x00, 0xE0, 0x0F, 0xF0, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, 0x0C, 0x00
+};
+
+const struct font_info symbols_16px PROGMEM = {0x30+(0x01<<8),0x14,0x10,0x00,0x09,symbols_16px_data,(uint8_t*)symbols_16px_data+0x09-0x00+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/symbols_8px.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/symbols_8px.c
new file mode 100644 (file)
index 0000000..192113f
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : symbols_8px.c
+    Date                : 03.05.2010
+    Font size in bytes  : 0x008C, 140
+    Font width          : 11
+    Font height         : 8
+    Font first char     : 0x00
+    Font last char      : 0x0F
+    Font bits per pixel : 1
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_symbols_8px
+
+
+
+const uint8_t symbols_8px_data[] PROGMEM = {
+    0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x0A, 0x07, 0x04, 
+    
+    0x18, 0x18, 0x18, 0x99, 0xDB, 0x7E, 0x3C, 0x18, 0x18, 0x3C, 0x7E, 0xDB, 0x99, 0x18, 0x18, 0x18, 
+    0x18, 0x0C, 0x06, 0xFF, 0xFF, 0x06, 0x0C, 0x18, 0x18, 0x30, 0x60, 0xFF, 0xFF, 0x60, 0x30, 0x18, 
+    0x18, 0x18, 0x18, 0xFF, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 
+    0xC0, 0xE3, 0x77, 0x1C, 0x38, 0x6C, 0xE7, 0xC3, 0x30, 0x60, 0xC0, 0xE0, 0x38, 0x0C, 0x06, 0x03, 
+    0x3C, 0x42, 0x42, 0x3C, 0x00, 0x7E, 0x18, 0x66, 0x3C, 0x42, 0x95, 0xA1, 0xA1, 0x95, 0x42, 0x3C, 
+    0x3C, 0x42, 0xA5, 0x91, 0x91, 0xA5, 0x42, 0x3C, 0x3C, 0x42, 0xA5, 0xA1, 0xA1, 0xA5, 0x42, 0x3C, 
+    0x7E, 0x4A, 0x00, 0x44, 0x4A, 0x32, 0x00, 0x3C, 0x42, 0x42, 0x30, 0x78, 0xFC, 0xB4, 0x30, 0x3F, 
+    0x3F, 0xC3, 0x66, 0x3C, 0x18
+};
+
+const struct font_info symbols_8px PROGMEM = {0x8C+(0x00<<8),0x0B,0x08,0x00,0x0F,symbols_8px_data,(uint8_t*)symbols_8px_data+0x0F-0x00+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/Fonts/template_simplefont.c b/atmega32u4/stepmotorcontroller/lcdlib/Fonts/template_simplefont.c
new file mode 100644 (file)
index 0000000..650d72f
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+    created with FontEditor written by H. Reddmann   HaReddmann at t-online dot de
+    using template file by J. Michel     jan at mueschelsoft.de
+
+    File Name           : %0:s.c
+    Date                : %1:s
+    Font size in bytes  : 0x%2:0.2x%3:0.2x, %9:d
+    Font width          : %4:d
+    Font height         : %5:d
+    Font first char     : 0x%7:0.2x
+    Font last char      : 0x%8:0.2x
+    Font bits per pixel : %10:d
+*/
+
+#include "../font.h"
+#ifdef FONTS_INCLUDE_%0:s
+
+
+
+const uint8_t %0:s_data[] PROGMEM = {
+%12:s
+};
+
+const struct font_info %0:s PROGMEM = {0x%3:0.2x+(0x%2:0.2x<<8),0x%4:0.2x,0x%5:0.2x,0x%7:0.2x,0x%8:0.2x,%0:s_data,(uint8_t*)%0:s_data+0x%8:0.2x-0x%7:0.2x+1};
+
+#endif
+
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/README.md b/atmega32u4/stepmotorcontroller/lcdlib/README.md
new file mode 100644 (file)
index 0000000..67adfe1
--- /dev/null
@@ -0,0 +1,63 @@
+lcdlib
+======
+
+Library for EA-DOG LCDs, including font-generator (also usable with color LCD)
+Further information and discussion (in german) can be found at:
+http://www.mikrocontroller.net/topic/144500
+
+
+Files
+=====
+
+dogm-graphic .c/.h
+------------------
+
+Provides all basic functions to access the display for
+- EA-DOGS102  GLCD (102px x 64px)
+- EA-DOGM128  GLCD (128px x 64px)
+- EA-DOGM132  GLCD (132px x 32px)
+- EA-DOGL128  GLCD (128px x 64px)
+- EA-DOGXL160 GLCD (160px x 104px)
+- can be easily adapted for other displays with similar characteristics
+     
+Since no graphics ram is used, the memory footprint is rather small but
+also does not allow to change single pixels. Data written to the LCD can
+not be read back! Because of that, no drawing functions (lines, circles) 
+are included.
+Thanks to Oliver Schwaneberg for adding several functions to this library!
+font .c/.h
+----------
+Font Generator
+designed for GLCD with memory organized in vertical bytes
+
+Own character sets or symbols can easily be added:
+The structure of font data is compatible with Hagen Reddmanns FontEditor
+http://www.mikrocontroller.net/topic/99701#865331
+when using the attached template_simplefont.c and template_simplefont.h
+files, saving in uncompressed format and using font heights of multiples
+of 8.
+Fixed width fonts are treated as proportional fonts, but do not have a 
+table for the width of each character (D'OH!)
+
+When using with other GLCDs, make sure the byte orientation of the LCDs
+memory matches the design of the ea-dogm series or link the LCD access
+functions (see header file) to functions converting the data.
+
+lcd-color-graphic .c/.h
+-----------------------
+An alternative lcd library controlling a LCD with an ILI9341 driver in 
+16 Bit color mode using 4-wire SPI or any other display with similar
+features. Just use this file instead of dogm-graphic. The function
+lcd_write_font_byte() provides the conversion from the font-generator
+byte format to the format used by the display.
+
+Fonts/template_simplefont.c
+---------------------------
+A template file to be used with Hagen Reddmanns FontEditor to create 
+compatible fonts.
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/dogm-graphic.c b/atmega32u4/stepmotorcontroller/lcdlib/dogm-graphic.c
new file mode 100644 (file)
index 0000000..acb6962
--- /dev/null
@@ -0,0 +1,322 @@
+/******************************************************************************
+ * Display Library
+ * for EA-DOGS102  GLCD (102px x 64px)
+ *     EA-DOGM128  GLCD (128px x 64px)
+ *     EA-DOGM132  GLCD (132px x 32px)
+ *     EA-DOGL128  GLCD (128px x 64px)
+ *     EA-DOGXL160 GLCD (160px x 104px)
+ * 
+ * Provides all basic functions to access the display
+ * Since no graphics ram is used, the memory footprint is rather small but
+ * also does not allow to change single pixels. Data written to the LCD can
+ * not be read back!
+ * Text can be displayed using the attached font generator containing several
+ * character sets and font variants.
+ * Thanks to Oliver Schwaneberg for adding several functions to this library!
+ * 
+ * Author:  Jan Michel (jan at mueschelsoft dot de)
+ * License: GNU General Public License, version 3
+ * Version: v0.95a November 2012
+ * ****************************************************************************
+ * New features in v0.95
+ *   - added initialization for top-view 
+ *   - automatic shifting column addresses (e.g. top-view)
+ * New features in v0.94
+ *   - corrected order of arguments in lcd_clear_area_xy()
+ *   - added command definitions for DOGXL160
+ *   - cleaned up dogm_graphic.h command area
+ * New features in v0.93
+ *   - modified initialization for DOGM128 and DOGS102
+ * New features in v0.92
+ *   - Added initialization for DOGS102 and DOGL128
+ * New features in v0.91
+ *   - Control of chip select pin
+ *   - backlight & chip select are optional - can be turned of in header file
+ *   - added function lcd_draw_image_P 
+ *   - added function lcd_draw_image_xy_P
+ *   - added function lcd_clear_area
+ *   - added SPI initialization
+ *****************************************************************************/
+
+#include "dogm-graphic.h"
+
+//=============================================================================
+//keeping track of current position in ram - necessary for big fonts & bitmaps
+//=============================================================================
+
+uint8_t lcd_current_page = 0;
+uint8_t lcd_current_column = 0;
+
+
+
+/******************************************************************************
+ * Changes the internal cursor by s pages
+ * s             - number of pages to move
+ */ 
+uint8_t lcd_inc_page(int8_t s) {
+  uint8_t p = lcd_current_page;
+  p += s;
+  p %= LCD_RAM_PAGES;    //all lcd have lcd_ram_pages which is power of two
+  lcd_current_page = p;
+  return p;
+  }
+
+/******************************************************************************
+ * Changes the internal cursor by s columns, including wrapping (if selected)
+ * s             - number of columns to move
+ */ 
+uint8_t lcd_inc_column(int16_t s) {
+  uint16_t c = lcd_current_column;
+  c += s;
+#if LCD_WRAP_AROUND == 1
+  while (c >= LCD_WIDTH) {
+    if (s > 0) lcd_inc_page(1);
+    else       lcd_inc_page(-1);
+    if (s > 0) c -= LCD_WIDTH;
+    else       c += LCD_WIDTH;
+    }
+#endif
+  lcd_current_column = c;
+  return c;
+  }
+  
+  
+/******************************************************************************
+ * Moves the cursor to the given position
+ * pages         - page to move to
+ * columns       - column to move to
+ */ 
+void lcd_moveto_xy(uint8_t page, uint8_t column) {
+  LCD_GOTO_ADDRESS(page,column);
+  lcd_current_column = column; 
+  lcd_current_page = page;
+  }
+
+/******************************************************************************
+ * Moves the cursor relative to the current position
+ * pages         - number of pages to move
+ * columns       - number of columns to move
+ */  
+void lcd_move_xy(int8_t pages, int16_t columns) {
+  lcd_moveto_xy(lcd_inc_page(pages),lcd_inc_column(columns));
+  }
+
+
+//=============================================================================
+//Basic Byte Access to Display
+//=============================================================================
+
+/******************************************************************************
+ * Writes one data byte
+ * data          - the data byte
+ */
+void lcd_data(uint8_t data) {
+  LCD_SELECT();
+  LCD_DRAM();
+  spi_write(data);
+  LCD_UNSELECT();
+  lcd_inc_column(1);
+  }
+
+/******************************************************************************
+ * Writes one command byte
+ * cmd           - the command byte
+ */
+void lcd_command(uint8_t cmd) {
+  LCD_SELECT();
+  LCD_CMD();
+  spi_write(cmd);
+  LCD_UNSELECT();
+  }
+  
+
+//=============================================================================
+//Puts raw data from Flash to the Display
+//=============================================================================
+#if LCD_INCLUDE_GRAPHIC_FUNCTIONS >= 1
+/******************************************************************************
+ * This function draws a bitmap from the current position on the screen.
+ * Parameters:
+ * progmem_image - prog_uint8_t array of columns aka the bitmap image
+ * pages         - height of image in pages
+ * columns       - width of image in pixels (or columns)
+ * style         - Bit2: sets inverse mode
+ */  
+void lcd_draw_image_P(PGM_VOID_P progmem_image, uint8_t pages, uint8_t columns, uint8_t style) {
+       uint8_t i,j = 0;
+  uint8_t inv = (style & INVERT_BIT);
+       while(j<pages && (lcd_get_position_page() < LCD_RAM_PAGES)) {
+               for (i=0; i<columns && (lcd_get_position_column() < LCD_WIDTH); i++) {
+      uint8_t tmp = pgm_read_byte(progmem_image++);
+                       if(!inv)
+                               lcd_data(tmp);
+                       else
+                               lcd_data(~tmp);
+      }
+    if(++j != pages && lcd_get_position_column() != 0)
+      lcd_move_xy(1,-columns);
+    }
+  }
+
+  
+/******************************************************************************
+ * This function draws a bitmap at any xy-position on the screen. 
+ * Be aware that some pixels are deleted due to memory organization!
+ * Parameters:
+ * progmem_image - prog_uint8_t array of columns aka the bitmap image
+ * x             - x start coordinate on the screen (in pixel)
+ * y             - y start coordinate on the screen (in pixel)
+ * pages         - height of image in pages
+ * columns       - width of image in pixels
+ * style         - Bit2: sets inverse mode
+ */
+void lcd_draw_image_xy_P(PGM_VOID_P progmem_image, uint8_t x, uint8_t y, uint8_t pages, uint8_t columns, uint8_t style) {
+       uint16_t i,j;
+  uint8_t data   = 0;
+  uint8_t inv    = style & INVERT_BIT;
+       uint8_t offset = y & 0x7; //Optimized modulo 8
+       //If there is an offset, we must use an additional page
+       if(offset)  
+    pages++;
+  //If there is not enough vertical space -> cut image
+  if(pages > LCD_RAM_PAGES - lcd_get_position_page())   
+    pages = LCD_RAM_PAGES - lcd_get_position_page();
+  //Goto starting point and draw
+       lcd_moveto_xy((y>>3), x);
+       for (j=0; j<pages; j++) {
+               for (i=0; i<columns && (lcd_get_position_column() < LCD_WIDTH); i++){
+      data = 0;
+      if (!offset || j+1 != pages)
+        data = pgm_read_byte(progmem_image+j*columns + i) << offset;
+                       if(j > 0 && offset)
+                               data |= pgm_read_byte(progmem_image+(j-1)*columns + i) >> (8-offset);
+                       if(inv) lcd_data(~data);
+      else             lcd_data(data);
+                 }
+               if(j+1 != pages)
+                       lcd_move_xy(1,-columns);
+         }
+  }
+#endif
+
+
+/******************************************************************************
+ * This function clears an area of the screen
+ * pages         - height of area in pages
+ * columns       - width of area in pixels
+ * style         - Bit2: sets inverse mode
+ * Cursor is moved to start of area after clear
+ */
+void lcd_clear_area(uint8_t pages, uint8_t columns, uint8_t style) {
+  uint8_t i,j,max;
+  uint8_t inv = (style & INVERT_BIT)?0xFF:0;
+  
+  if(pages > (max = LCD_RAM_PAGES - lcd_get_position_page()))   
+    pages = max;
+  if(columns > (max = LCD_WIDTH - lcd_get_position_column()))   
+    columns = max;
+  
+  for(j=0; j<pages; j++) {
+    for(i=0; i<columns; i++) {
+      lcd_data(inv);
+      }
+    lcd_move_xy(1,-columns);
+    }
+  lcd_move_xy(-pages,0);
+  }
+
+/******************************************************************************
+ * This function clears an area of the screen starting at the given coordinates
+ * pages         - height of area in pages
+ * columns       - width of area in pixels
+ * style         - style modifier
+ * col           - column of upper left corner
+ * page          - page of upper left corner
+ * Cursor is moved to start of area after clear
+ */
+void lcd_clear_area_xy(uint8_t pages, uint8_t columns, uint8_t style, uint8_t page, uint8_t col) {
+  lcd_moveto_xy(page,col);
+  lcd_clear_area(pages,columns,style);
+  }
+  
+
+/******************************************************************************
+  * Initializes the display in 4x booster for 2.4-3.3V supply voltage
+  * scheme according to datasheet
+  * Suitable for all DOGS, DOGM, DOGL and DOGXL displays 
+  * in both bottom or top-view orientation.
+  */
+void lcd_init() {
+  LCD_SET_PIN_DIRECTIONS();  //set outputs
+  LCD_INIT_SPI();            //Initialize SPI Interface  
+  LCD_RESET();               //Apply Reset to the Display Controller
+  //Load settings
+  #if DISPLAY_TYPE == 160
+    LCD_SET_COM_END(103);               //set last COM electrode
+    #if ORIENTATION_UPSIDEDOWN = 0
+      LCD_SET_BOTTOM_VIEW();            //6 o'clock mode, normal orientation
+    #else
+      LCD_SET_TOP_VIEW();               //12 o'clock mode, reversed orientation
+    #endif
+    LCD_SET_START_LINE(0);              //set scrolling to 0
+    LCD_SET_PANEL_LOAD(3);              //set panel loading to 28-38nF
+    LCD_SET_BIAS_RATIO(3);              //set bias ratio
+    LCD_SET_VOLTAGE_BIAS(0x5F);         //set Vbias potentiometer for contrast
+    LCD_SET_RAM_ADDR_CTRL(1);           //set auto-increment
+  #endif
+  #if DISPLAY_TYPE == 132
+    LCD_SET_FIRST_LINE(0);              //first bit in RAM is on the first line of the LCD
+    #if ORIENTATION_UPSIDEDOWN == 0
+      LCD_SET_BOTTOM_VIEW();            //6 o'clock mode, normal orientation
+      LCD_ORIENTATION_NORMAL();
+    #else
+      LCD_SET_TOP_VIEW();               //12 o'clock mode, reversed orientation
+      LCD_ORIENTATION_UPSIDEDOWN();
+    #endif
+    LCD_SHOW_ALL_PIXELS_OFF();          //Normal Pixel mode
+    LCD_SET_MODE_POSITIVE();            //positive display
+    LCD_SET_BIAS_RATIO_1_9();           //bias 1/9
+    LCD_SET_POWER_CONTROL(7);           //power control mode: all features on
+    LCD_SET_BIAS_VOLTAGE(3);            //set voltage regulator R/R
+    LCD_SET_VOLUME_MODE(0x1F);          //volume mode set
+    LCD_SET_INDICATOR_OFF();            //switch indicator off, no blinking
+  #endif
+  #if DISPLAY_TYPE == 128
+    LCD_SET_FIRST_LINE(0);              //first bit in RAM is on the first line of the LCD
+    #if ORIENTATION_UPSIDEDOWN == 0
+      LCD_SET_BOTTOM_VIEW();            //6 o'clock mode, normal orientation
+      LCD_ORIENTATION_NORMAL();
+    #else
+      LCD_SET_TOP_VIEW();               //12 o'clock mode, reversed orientation
+      LCD_ORIENTATION_UPSIDEDOWN();
+    #endif
+    LCD_SHOW_ALL_PIXELS_OFF();          //Normal Pixel mode
+    LCD_SET_MODE_POSITIVE();            //positive display
+    LCD_SET_BIAS_RATIO_1_7();           //bias 1/7
+    LCD_SET_POWER_CONTROL(7);           //power control mode: all features on
+    LCD_SET_BIAS_VOLTAGE(7);            //set voltage regulator R/R
+    LCD_SET_VOLUME_MODE(0x06);          //volume mode set
+    LCD_SET_INDICATOR_OFF();            //switch indicator off, no blinking
+  #endif
+  #if DISPLAY_TYPE == 102
+    LCD_SET_FIRST_LINE(0);              //first bit in RAM is on the first line of the LCD
+    #if ORIENTATION_UPSIDEDOWN == 0
+      LCD_SET_BOTTOM_VIEW();            //6 o'clock mode, normal orientation
+      LCD_ORIENTATION_NORMAL();
+    #else
+      LCD_SET_TOP_VIEW();               //12 o'clock mode, reversed orientation
+      LCD_ORIENTATION_UPSIDEDOWN();
+    #endif
+    LCD_SHOW_ALL_PIXELS_OFF();          //Normal Pixel mode
+    LCD_SET_MODE_POSITIVE();            //positive display
+    LCD_SET_BIAS_RATIO_1_9();           //bias 1/9
+    LCD_SET_POWER_CONTROL(7);           //power control mode: all features on
+    LCD_SET_BIAS_VOLTAGE(7);            //set voltage regulator R/R
+    LCD_SET_VOLUME_MODE(0x9);           //volume mode set
+    LCD_SET_ADV_PROG_CTRL(LCD_TEMPCOMP_HIGH);
+  #endif
+  lcd_clear_area_xy(LCD_RAM_PAGES,LCD_WIDTH,NORMAL,0,0); //clear display content
+
+  LCD_SWITCH_ON();                    //Switch display on
+  return;
+  }
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/dogm-graphic.h b/atmega32u4/stepmotorcontroller/lcdlib/dogm-graphic.h
new file mode 100644 (file)
index 0000000..a1bb998
--- /dev/null
@@ -0,0 +1,418 @@
+#ifndef DOGMGRAPHIC_H_INCLUDED
+#define DOGMGRAPHIC_H_INCLUDED
+
+#include <avr/io.h>
+#include <inttypes.h>
+#include <string.h>
+#include <util/delay.h>
+#include <avr/pgmspace.h>
+#include "font.h"
+
+/*****************************************************************************
+ * BEGIN CONFIG BLOCK
+ *****************************************************************************/
+//Select the display type: DOGS102: 102, DOGM128/DOGL128: 128, DOGM132: 132, DOGXL160: 160
+#define DISPLAY_TYPE  132
+
+//Display Orientation: Normal (0) or upside-down (1)?
+#define ORIENTATION_UPSIDEDOWN 0
+
+//Should chip select (CS) be used?
+#define LCD_USE_CHIPSELECT  0
+
+//Use Backlight?  (0: no backlight, 1: backlight (on when pin is high), 2: backlight (on when pin is low))
+#define LCD_USE_BACKLIGHT   1
+
+//A0 Port (CD on DOGS & DOGXL)
+#define PORT_A0  PORTD
+#define DDR_A0   DDRD
+#define PIN_A0   2
+
+//Reset Port
+#define PORT_RST PORTD
+#define DDR_RST  DDRD
+#define PIN_RST  5
+
+//Backlight Port
+#if LCD_USE_BACKLIGHT != 0
+  #define PORT_LED PORTB
+  #define DDR_LED  DDRB
+  #define PIN_LED  4
+#endif
+
+//Chip select
+#if LCD_USE_CHIPSELECT == 1
+  #define PORT_CS  PORTC
+  #define DDR_CS   DDRC
+  #define PIN_CS   PORTC0
+#endif
+
+//SPI routines
+//Define a function that initializes  the SPI interface, see below for an example
+extern void init_spi_lcd(void);
+#define LCD_INIT_SPI() init_spi_lcd()
+
+//Define a function that waits until SPI interface is idle
+#define spi_wait_for_idle() while(! (UCSR1A & _BV(TXC1)));UCSR1A |= _BV(TXC1)
+
+//Define how to write to SPI data register
+#define spi_write(i) UDR1 = i
+
+//Define this if LCD Output should continue in next line when reaching edge of display
+//Used for all outputs. To enable this feature for text only, use the appropriate flag in font.h
+#define LCD_WRAP_AROUND  1
+
+//Include graphic functions, i.e. lcd_draw_image_P, lcd_draw_image_xy_P, lcd_clear_area ? 
+#define LCD_INCLUDE_GRAPHIC_FUNCTIONS  1
+
+/*Example SPI setup (Atmega162)
+ *init spi: msb first, update on falling edge , read on rising edge, 9 MHz
+ *void init_spi_lcd() {
+ *  SPCR = 0 << SPIE | 1 << SPE | 0 << DORD | 1 << MSTR | 1 << CPOL | 1 << CPHA | 0 << SPR1 | 0 << SPR0;
+ *  SPSR = 1 << SPI2X;
+ *  SPDR = LCD_NO_OP; //Do not use 0 here, only LCD_NOP is allowed!
+ *  }
+ */
+/*****************************************************************************
+ * END CONFIG BLOCK
+ *****************************************************************************/
+
+
+
+
+/*****************************************************************************
+ * Public Functions
+ *****************************************************************************/
+
+//initializes the display in standard settings
+//for DOGS, DOGM, DOGL and DOGXL
+void lcd_init(void);
+
+//write data word or command to the LCD
+void lcd_data     (uint8_t data);
+void lcd_command  (uint8_t cmd);
+
+
+//Function to read the current position
+extern uint8_t lcd_current_page;
+extern uint8_t lcd_current_column;
+static inline uint8_t lcd_get_position_page(void)   {return lcd_current_page;}
+static inline uint8_t lcd_get_position_column(void) {return lcd_current_column;}
+
+//User functions to write raw data from flash
+#if LCD_INCLUDE_GRAPHIC_FUNCTIONS >= 1
+  void lcd_draw_image_P(PGM_VOID_P progmem_image, uint8_t pages, uint8_t columns, uint8_t style);
+  void lcd_draw_image_xy_P(PGM_VOID_P progmem_image, uint8_t x, uint8_t y, uint8_t pages, uint8_t columns, uint8_t style);
+#endif
+
+void lcd_clear_area(uint8_t pages, uint8_t columns, uint8_t style);
+void lcd_clear_area_xy(uint8_t pages, uint8_t columns, uint8_t style, uint8_t page, uint8_t col);
+  
+
+//Move cursor
+void lcd_moveto_xy  (uint8_t page, uint8_t column);
+void lcd_move_xy    (int8_t pages, int16_t columns);
+
+
+
+//Text functions are included in font.c / font.h
+
+/*****************************************************************************
+ * LCD Size, based on type selection above
+ *****************************************************************************/
+#if DISPLAY_TYPE == 160
+  #define LCD_WIDTH            160 //width of the LCD
+  #define LCD_HEIGHT           104 //height of the LCD
+  #define LCD_RAM_PAGES        26  //size of LCD RAM
+  #define LCD_PIXEL_PER_BYTE   4   //using double pixels
+  #define LCD_DOUBLE_PIXEL     1   
+  #define SHIFT_ADDR_NORMAL    0   //column offset for normal orientation
+  #define SHIFT_ADDR_TOPVIEW   0   //column offset for bottom view orientation
+#endif
+ #if DISPLAY_TYPE == 132
+  #define LCD_WIDTH          132 //width of the LCD
+  #define LCD_HEIGHT         32  //height of the LCD
+  #define LCD_RAM_PAGES      4   //size of LCD RAM
+  #define LCD_PIXEL_PER_BYTE 8   //using single pixels
+  #define SHIFT_ADDR_NORMAL  0   //column offset for normal orientation
+  #define SHIFT_ADDR_TOPVIEW 0   //column offset for bottom view orientation
+#endif
+
+#if DISPLAY_TYPE == 128
+  #define LCD_WIDTH          128 //width of the LCD
+  #define LCD_HEIGHT         64  //height of the LCD
+  #define LCD_RAM_PAGES      8   //size of LCD RAM
+  #define LCD_PIXEL_PER_BYTE 8   //using single pixels
+  #define SHIFT_ADDR_NORMAL  0   //column offset for normal orientation
+  #define SHIFT_ADDR_TOPVIEW 4   //column offset for bottom view orientation
+#endif
+
+#if DISPLAY_TYPE == 102
+  #define LCD_WIDTH          102 //width of the LCD
+  #define LCD_HEIGHT         64  //height of the LCD
+  #define LCD_RAM_PAGES      8   //size of LCD RAM
+  #define LCD_PIXEL_PER_BYTE 8   //using single pixels
+  #define SHIFT_ADDR_NORMAL  0   //column offset for normal orientation
+  #define SHIFT_ADDR_TOPVIEW 30  //column offset for bottom view orientation
+#endif
+
+#if ORIENTATION_UPSIDEDOWN == 0
+  #define SHIFT_ADDR   SHIFT_ADDR_NORMAL
+#endif
+
+#if ORIENTATION_UPSIDEDOWN == 1
+  #define SHIFT_ADDR   SHIFT_ADDR_TOPVIEW
+#endif
+
+/*****************************************************************************
+ * Command Codes
+ *****************************************************************************/
+#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 || DISPLAY_TYPE == 102
+  #define LCD_DISPLAY_ENABLE    0xAE  //1: Display on/off
+  #define LCD_START_LINE        0x40  //2: display start line set 
+  #define LCD_PAGE_ADDRESS      0xB0  //3: Page address set (lower 4 bits select one of the pages)
+  #define LCD_COL_ADDRESS       0x10  //4: column address 
+  #define LCD_BOTTOMVIEW        0xA0  //8: select orientation 
+  #define LCD_DISPLAY_INVERT    0xA6  //9: inverted display
+  #define LCD_ALL_PIXEL         0xA4  //10: show memory content or switch all pixels on
+  #define LCD_BIAS              0xA2  //11: lcd bias set
+  #define LCD_RESET_CMD         0xE2  //14: Reset Controller
+  #define LCD_SCAN_DIR          0xC0  //15: output mode select (turns display upside-down)
+  #define LCD_POWER_CONTROL     0x28  //16: power control set 
+  #define LCD_VOLTAGE           0x20  //17: voltage regulator resistor ratio set 
+  #define LCD_VOLUME_MODE       0x81  //18: Volume mode set 
+  #define LCD_NO_OP             0xE3  //22: NOP command
+#endif
+
+#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132
+  #define LCD_INDICATOR         0xAC  //19: static indicator (2-byte command)
+  #define LCD_BOOSTER_SET       0xF8  //20: booster ratio set
+#endif
+  
+#if DISPLAY_TYPE == 102
+  #define LCD_ADV_PROG_CTRL     0xFA  //25: advanced program control 
+  #define LCD_ADV_PROG_CTRL2    0x10  //25: advanced program control 
+#endif
+
+#if DISPLAY_TYPE == 160
+  #define LCD_COL_ADDRESS       0x10  //4: column address 
+  #define LCD_TEMP_COMP         0x24  //5: Set Temperature Compensation
+  #define LCD_PANEL_LOAD        0x28  //6: Set Panel loading
+  #define LCD_PUMP_CTRL         0x2C  //7: Set pump control
+  #define LCD_ADV_PROG_CTRL     0x30  //8: advanced program control first word
+  #define LCD_START_LINE        0x40  //9: display scroll line set LSB
+  #define LCD_START_LINE2       0x50  //9: display scroll line set MSB
+  #define LCD_PAGE_ADDRESS      0x60  //10: Page address set
+  #define LCD_VOLTAGE_BIAS      0x81  //11: Bias set
+  #define LCD_PARTIAL_CTRL      0x84  //12: Set partial display control
+  #define LCD_RAM_ADDR_CTRL     0x88  //13: Set RAM address control
+  #define LCD_FIXED_LINES       0x90  //14: Set display fixed lines
+  #define LCD_LINE_RATE         0xA0  //15: Set line rate
+  #define LCD_ALL_PIXEL         0xA4  //16: show all points
+  #define LCD_INVERSE           0xA6  //17: Inverse display
+  #define LCD_DISPLAY_ENABLE    0xAE  //18: Display enable
+  #define LCD_MAPPING_CTRL      0xC0  //19: LCD mapping control
+  #define LCD_GRAY_SHADE        0xD0  //20: LCD gray shade
+  #define LCD_RESET_CMD         0xE2  //21: System reset
+  #define LCD_NO_OP             0xE3  //22: NOP
+  #define LCD_BIAS_RATIO        0xE8  //24: Bias Ratio
+  #define LCD_CURSOR_MODE_RESET 0xEE  //25: Reset cursor update mode
+  #define LCD_CURSOR_MODE_SET   0xEF  //26: Set cursor update mode
+  #define LCD_COM_END           0xF1  //27: Set COM End
+  #define LCD_PARTIAL_START     0xF2  //28: Set partial display start
+  #define LCD_PARTIAL_END       0xF3  //29: Set partial display end
+  #define LCD_WINDOW_START_COL  0xF4  //30: Window program start column
+  #define LCD_WINDOW_START_PAGE 0xF5  //31: Window program start column
+  #define LCD_WINDOW_END_COL    0xF6  //32: Window program start column
+  #define LCD_WINDOW_END_PAGE   0xF7  //33: Window program start column
+  #define LCD_WINDOW_PROGRAM    0xF8  //34: Enable window programming
+#endif 
+
+/*****************************************************************************
+ * Makros to execute commands 
+ *****************************************************************************/
+ #if DISPLAY_TYPE == 160
+  #define LCD_SET_TEMP_COMP(i)          lcd_command(LCD_TEMP_COMP | ((i) & 0x3))
+  #define LCD_SET_PANEL_LOAD(i)         lcd_command(LCD_PANEL_LOAD | ((i) & 0x3))
+  #define LCD_SET_PUMP_CTRL(i)          lcd_command(LCD_PUMP_CTRL | ((i) & 0x3))
+  #define LCD_SET_ADV_PROG_CTRL(i)      lcd_command(LCD_ADV_PROG_CTRL); \
+                                        lcd_command((i)&0x3F)  
+  #define LCD_SET_START_LINE(i)         lcd_command(LCD_START_LINE | ((i)&0xF)); \
+                                        lcd_command(LCD_START_LINE2 | (((i)>>4)&0x7))
+  #define LCD_SET_VOLTAGE_BIAS(i)       lcd_command(LCD_VOLTAGE_BIAS); \
+                                        lcd_command((i)&0xFF)
+  #define LCD_SET_PARTIAL_DISPLAY_CTRL(i) lcd_command(LCD_PARTIAL_CTRL | ((i) & 0x3))
+  #define LCD_SET_RAM_ADDR_CTRL(i)      lcd_command(LCD_RAM_ADDR_CTRL | ((i) & 0x7))
+  #define LCD_SET_FIXED_LINES(i)        lcd_command(LCD_FIXED_LINES | ((i) & 0xF))
+  #define LCD_SET_LINE_RATE(i)          lcd_command(LCD_LINE_RATE | ((i) & 0x3))
+  #define LCD_SHOW_ALL_PIXELS_ON()      lcd_command(LCD_ALL_PIXEL | 1)  
+  #define LCD_SHOW_ALL_PIXELS_OFF()     lcd_command(LCD_ALL_PIXEL | 0)  
+  #define LCD_INVERT_DISPLAY(i)         lcd_command(LCD_INVERSE | ((i)&1))
+  #define LCD_SWITCH_ON()               lcd_command(LCD_DISPLAY_ENABLE | 1)
+  #define LCD_SWITCH_OFF()              lcd_command(LCD_DISPLAY_ENABLE | 0)
+  #define LCD_SET_MAPPING_CTRL(i)       lcd_command(LCD_MAPPING_CTRL | ((i) & 0x7))  
+  #define LCD_SET_BOTTOM_VIEW()         lcd_command(LCD_MAPPING_CTRL | 0)  
+  #define LCD_SET_TOP_VIEW()            lcd_command(LCD_MAPPING_CTRL | 6)  
+  #define LCD_SET_GRAY_SHADE(i)         lcd_command(LCD_GRAY_SHADE | ((i) & 0x3))
+  #define LCD_SET_PAGE_ADDR(i)          lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x1F))
+  #define LCD_SET_COLUMN_ADDR(col)      lcd_command(LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR)>>4) & 0x0F)); \
+                                        lcd_command((((col)+SHIFT_ADDR) & 0x0F))
+  #define LCD_GOTO_ADDRESS(page,col)    lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x1F)); \
+                                        lcd_command(LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR)>>4) & 0x0F)); \
+                                        lcd_command((((col)+SHIFT_ADDR) & 0x0F))
+
+  #define LCD_NOP()                     lcd_command(LCD_NO_OP)
+  #define LCD_SET_BIAS_RATIO(i)         lcd_command(LCD_BIAS_RATIO | ((i) & 0x3))
+  #define LCD_SET_CURSOR_UPDATE_MODE    lcd_command(LCD_CURSOR_MODE_SET)
+  #define LCD_RESET_CURSOR_UPDATE_MODE  lcd_command(LCD_CURSOR_MODE_RESET)
+  #define LCD_SET_COM_END(i)            lcd_command(LCD_COM_END); \
+                                        lcd_command(i)
+  #define LCD_SET_PARTIAL_DISPLAY(start,end) \
+                                        lcd_command(LCD_PARTIAL_START); \
+                                        lcd_command((start) & 0x7F) \
+                                        lcd_command(LCD_PARTIAL_END); \
+                                        lcd_command((end) & 0x7F)
+  #define LCD_SET_PROGRAM_WINDOW(startpage,startcol,endpage,endcol) \
+                                        lcd_command(LCD_WINDOW_START_PAGE); \
+                                        lcd_command(startpage); \
+                                        lcd_command(LCD_WINDOW_START_COL); \
+                                        lcd_command(startcol); \
+                                        lcd_command(LCD_WINDOW_END_PAGE); \
+                                        lcd_command(endpage); \
+                                        lcd_command(LCD_WINDOW_END_COL); \
+                                        lcd_command(endcol)
+  #define LCD_ENABLE_WINDOW_PROGRAM     lcd_command(LCD_WINDOW_PROGRAM | 1)
+  #define LCD_DISABLE_WINDOW_PROGRAM    lcd_command(LCD_WINDOW_PROGRAM | 0)
+#endif 
+#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132 || DISPLAY_TYPE == 102
+  #define LCD_SWITCH_ON()              lcd_command(LCD_DISPLAY_ENABLE | 1)
+  #define LCD_SWITCH_OFF()             lcd_command(LCD_DISPLAY_ENABLE | 0)
+  #define LCD_SET_FIRST_LINE(i)        lcd_command(LCD_START_LINE | ((i) & 0x3F))
+  #define LCD_SET_BOTTOM_VIEW()        lcd_command(LCD_BOTTOMVIEW | 1)
+  #define LCD_SET_TOP_VIEW()           lcd_command(LCD_BOTTOMVIEW | 0)
+  #define LCD_SET_MODE_POSITIVE()      lcd_command(LCD_DISPLAY_INVERT | 0)
+  #define LCD_SET_MODE_INVERTED()      lcd_command(LCD_DISPLAY_INVERT | 1)
+  #define LCD_SHOW_ALL_PIXELS_ON()     lcd_command(LCD_ALL_PIXEL | 1)
+  #define LCD_SHOW_ALL_PIXELS_OFF()    lcd_command(LCD_ALL_PIXEL | 0)
+  #define LCD_SET_BIAS_RATIO_1_7()     lcd_command(LCD_BIAS | 1)
+  #define LCD_SET_BIAS_RATIO_1_9()     lcd_command(LCD_BIAS | 0)
+  #define LCD_SEND_RESET()             lcd_command(LCD_RESET_CMD)
+  #define LCD_ORIENTATION_NORMAL()     lcd_command(LCD_SCAN_DIR | 0x0)
+  #define LCD_ORIENTATION_UPSIDEDOWN() lcd_command(LCD_SCAN_DIR | 0x8)
+  #define LCD_SET_POWER_CONTROL(i)     lcd_command(LCD_POWER_CONTROL | ((i) & 0x07))
+  #define LCD_SET_LOW_POWER()          lcd_command(LCD_POWER_CONTROL | 0x7)
+  #define LCD_SET_WIDE_RANGE()         lcd_command(LCD_POWER_CONTROL | 0x7)
+  #define LCD_SET_LOW_VOLTAGE()        lcd_command(LCD_POWER_CONTROL | 0x3)
+  #define LCD_SET_BIAS_VOLTAGE(i)      lcd_command(LCD_VOLTAGE | ((i) & 0x07))                                   
+  #define LCD_SET_VOLUME_MODE(i)       lcd_command(LCD_VOLUME_MODE); \
+                                       lcd_command(((i) & 0x3F))       
+  #define LCD_NOP()                    lcd_command(LCD_NO_OP)
+#endif
+
+#if DISPLAY_TYPE == 128 || DISPLAY_TYPE == 132
+  #define LCD_SET_PAGE_ADDR(i)         lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x0F))
+  #define LCD_SET_COLUMN_ADDR(col)     lcd_command(LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR)>>4) & 0x0F)); \
+                                       lcd_command((((col)+SHIFT_ADDR) & 0x0F))
+  #define LCD_GOTO_ADDRESS(page,col)   lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x1F)); \
+                                       lcd_command(LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR)>>4) & 0x0F)); \
+                                       lcd_command((((col)+SHIFT_ADDR) & 0x0F))
+  #define LCD_SET_INDICATOR_OFF()      lcd_command(LCD_INDICATOR | 0); \
+                                       lcd_command(0x00)
+  #define LCD_SET_INDICATOR_STATIC()   lcd_command(LCD_INDICATOR | 1); \
+                                       lcd_command(0x11)
+  #define LCD_SET_INDICATOR_1HZ()      lcd_command(LCD_INDICATOR | 1); \
+                                       lcd_command(0x01)
+  #define LCD_SET_INDICATOR_2HZ()      lcd_command(LCD_INDICATOR | 1); \
+                                       lcd_command(0x10)
+  #define LCD_SET_INDICATOR(i,j)       lcd_command(LCD_INDICATOR | ((i) & 1)); \
+                                       lcd_command(((j) & 2))
+  #define LCD_SET_BOOSTER_MODE(i)      lcd_command(LCD_BOOSTER_SET); \
+                                       lcd_command(((i) & 0x03))  
+  #define LCD_SET_BOOSTER_MODE_234     lcd_command(LCD_BOOSTER_SET); \
+                                       lcd_command(0x0)  
+  #define LCD_SET_BOOSTER_MODE_5       lcd_command(LCD_BOOSTER_SET); \
+                                       lcd_command(0x1)  
+  #define LCD_SET_BOOSTER_MODE_6       lcd_command(LCD_BOOSTER_SET); \
+                                       lcd_command(0x3)  
+  #define LCD_SLEEP_MODE               lcd_command(LCD_INDICATOR_OFF); \
+                                       lcd_command(LCD_DISPLAY_ENABLE | 0); \
+                                       lcd_command(LCD_ALL_PIXEL | 1)
+#endif
+
+#if DISPLAY_TYPE == 102
+  #define LCD_SET_PAGE_ADDR(i)         lcd_command(LCD_PAGE_ADDRESS | ((i) & 0x0F))
+  #define LCD_SET_COLUMN_ADDR(col)     lcd_command((((col)+SHIFT_ADDR) & 0x0F)); \
+                                       lcd_command(LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR)>>4) & 0x0F))
+  #define LCD_GOTO_ADDRESS(page,col)   lcd_command(LCD_PAGE_ADDRESS | ((page) & 0x1F)); \
+                                       lcd_command((((col)+SHIFT_ADDR) & 0x0F)); \
+                                       lcd_command(LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR)>>4) & 0x0F))
+  #define LCD_TEMPCOMP_HIGH  0x80
+  #define LCD_COLWRAP        0x02
+  #define LCD_PAGEWRAP       0x01
+  #define LCD_SET_ADV_PROG_CTRL(i)     lcd_command(LCD_ADV_PROG_CTRL); \
+                                       lcd_command(LCD_ADV_PROG_CTRL2 | i)
+#endif
+
+
+
+
+/*****************************************************************************
+ * Output pin controlling makros
+ *****************************************************************************/
+
+//Control A0 input of LCD
+#define LCD_DRAM()            PORT_A0 |= _BV(PIN_A0)
+#define LCD_CMD()             PORT_A0 &= ~_BV(PIN_A0)
+#define LCD_SET_OUTPUT_A0()   DDR_A0  |= _BV(PIN_A0)
+
+//Control reset input of LCD
+#define LCD_RESET_OFF()       PORT_RST |= _BV(PIN_RST)
+#define LCD_RESET_ON()        PORT_RST &= ~_BV(PIN_RST)
+#define LCD_SET_OUTPUT_RST()  DDR_RST |= _BV(PIN_RST)
+#define LCD_RESET()           LCD_RESET_ON();  _delay_ms(1); LCD_RESET_OFF();  _delay_ms(1)
+
+//Control pin for Backlight
+#if LCD_USE_BACKLIGHT == 1      //normal
+  #define LCD_SET_OUTPUT_LED() DDR_LED |= _BV(PIN_LED)
+  #define BACKLIGHT_ON()       PORT_LED |= (1<<PIN_LED)
+  #define BACKLIGHT_OFF()      PORT_LED &= ~(1<<PIN_LED)
+#elif LCD_USE_BACKLIGHT == 2    //inverted
+  #define LCD_SET_OUTPUT_LED() DDR_LED |= _BV(PIN_LED)
+  #define BACKLIGHT_ON()       PORT_LED &= ~(1<<PIN_LED)
+  #define BACKLIGHT_OFF()      PORT_LED |= (1<<PIN_LED)
+#else
+  #define LCD_SET_OUTPUT_LED() 
+  #define BACKLIGHT_ON()   
+  #define BACKLIGHT_OFF()    
+#endif
+
+//Control pin for chip select
+#if LCD_USE_CHIPSELECT == 1
+  #define LCD_SET_OUTPUT_CS()  DDR_CS  |= _BV(PIN_CS)
+  #define LCD_SELECT()         PORT_CS &= ~_BV(PIN_CS)
+  #define LCD_UNSELECT()       spi_wait_for_idle(); PORT_CS |= _BV(PIN_CS)
+#else
+  #define LCD_SET_OUTPUT_CS()  
+  #define LCD_SELECT()         spi_wait_for_idle();
+  #define LCD_UNSELECT()   
+#endif
+
+//combined direction selection for all pins
+#define LCD_SET_PIN_DIRECTIONS()   LCD_SET_OUTPUT_A0(); \
+                                   LCD_SET_OUTPUT_RST(); \
+                                   LCD_SET_OUTPUT_LED(); \
+                                   LCD_SET_OUTPUT_CS()
+
+
+//Bit positions for style settings
+#define NORMAL      0
+#define INVERT      4
+#define INVERT_BIT  4
+
+
+#endif
+
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/font.c b/atmega32u4/stepmotorcontroller/lcdlib/font.c
new file mode 100644 (file)
index 0000000..78f6f72
--- /dev/null
@@ -0,0 +1,398 @@
+/******************************************************************************
+ * Font Generator
+ * designed for GLCD with memory organized in vertical bytes
+ * 
+ * Own character sets or symbols can easily be added:
+ * The structure of font data is compatible with Hagen Reddmanns FontEditor
+ * http://www.mikrocontroller.net/topic/99701#865331
+ * when using the attached template_simplefont.c and template_simplefont.h
+ * files, saving in uncompressed format and using font heights of multiples
+ * of 8.
+ * 
+ * Fixed width fonts are treated as proportional fonts, but do not have a 
+ * table for the width of each character (D'OH!)
+ * 
+ * When using with other GLCDs, make sure the byte orientation of the LCDs
+ * memory matches the design of the ea-dogm series or link the LCD access
+ * functions (see header file) to functions converting the data.
+ * 
+ * My thanks go to Hagen Reddmann for his Font Editor software
+ * (http://www.mikrocontroller.net/topic/99701#865331)
+ * and Benedikt K. for his various LCD fonts 
+ * (http://www.mikrocontroller.net/topic/54860)
+ * as well as Oliver Schwaneberg for adding several new functions
+ * 
+ * Author:  Jan Michel (jan at mueschelsoft dot de)
+ * License: GNU General Public License, version 3
+ * Version: v0.94 October 2011
+ * ****************************************************************************
+ * New features in v0.94
+ *   - Characters may now be bigger than 128 Byte and occupy more than 1024 Pixels each
+ *   - Added 32px high digits (4 digits plus colon plus large spacing = 128px)
+ * New features in v0.93
+ *   - output functions for long / int / float depend on global font setting
+ *     (removing the two additional parameters made usage much easier I think)
+ *   - fixed bug in font_proportional_16px regarding space
+ *   - fixed symbol_16px
+ * New features in v0.92
+ *   - font and style setting can be stored globally (lcd_set_font)
+ *   - simple put functions: lcd_putc, lcd_putstr, lcd_putstr_P
+ *   - added 24px high, 16px wide digit font
+ *   - added underline to font styles
+ * New features in v0.91
+ *   - text can be displayed in inverted mode
+ *   - text can automatically wrap to the next line (if selected)
+ *   - direct output of long / int / float
+ *   - put_string and put_char functions now return the total width of the
+ *     text in pixel
+ *****************************************************************************/
+
+#include "font.h"
+
+/******************************************************************************
+ * Global storage for easy-to-use putc functions
+ *****************************************************************************/
+FONT_P global_font_select;
+uint8_t global_font_style;
+
+/******************************************************************************
+ * Stores the default font type and style in a global variable
+ * font          - Font identifier
+ * style         - Style Modifier
+ */
+inline void lcd_set_font(FONT_P font, uint8_t style){
+  global_font_select = font;
+  global_font_style = style;
+}
+
+/******************************************************************************
+ * Helper Functions to find, retrieve and display characters
+ *****************************************************************************/
+
+/******************************************************************************
+ * Loads the pointer to the selected fonts data
+ */
+inline PGM_P font_data(FONT_P font) {
+  PGM_P tmp;
+  if (sizeof(tmp) == 2)
+    tmp = (PGM_P)pgm_read_word(&(font->data));
+  else
+    memcpy_P((char*)&tmp,&(font->data),sizeof(tmp));
+  return tmp;
+  }
+
+
+/******************************************************************************
+ * Loads the pointer to the width table for the selected font
+ */
+inline PGM_P font_widthtable(FONT_P font) {
+  PGM_P tmp;
+  if (sizeof(tmp) == 2)
+    tmp = (PGM_P)pgm_read_word(&(font->widthtable));
+  else
+    memcpy_P((char*)&tmp,&(font->widthtable),sizeof(tmp));
+  return tmp;
+  }
+
+
+/******************************************************************************
+ * Loads the height (in bytes) of the given font
+ */
+inline uint8_t font_get_height_bytes(FONT_P font) {
+  FONT_P tmp = font;
+  uint8_t t = pgm_read_byte(&tmp->height);
+  return (((uint8_t)(t-1)>>3)+1);
+  }
+
+
+
+
+/******************************************************************************
+ * Get the number of the character in the given font
+ */
+inline int16_t font_get_char_number(FONT_P font, char character) {
+  FONT_P tmp = font;
+  if (character > pgm_read_byte(&tmp->lastchar)) 
+    return -1;
+  uint8_t first = pgm_read_byte(&tmp->firstchar);
+  if (character < first) 
+    return -1;
+  return character - first;
+  }
+
+
+/******************************************************************************
+ * Read the width of the selected character from the font width table
+ */
+inline uint8_t font_get_char_width(FONT_P font, char character) {
+  PGM_P table = font_widthtable(font);
+  if (table)
+    return pgm_read_byte(table+font_get_char_number(font,character));
+  else
+    return pgm_read_byte(&font->width);
+  }
+
+
+/******************************************************************************
+ * Calculate the pointer to the requested character inside the Flash ROM
+ */
+PGM_P font_get_char_position(FONT_P font, char character) {
+  uint16_t ret         = 0;
+  int16_t  charnum_ret = font_get_char_number(font, character);
+  uint8_t  charnum     = charnum_ret;
+  PGM_P    base        = font_widthtable(font);
+
+  if (charnum_ret < 0)     //char not found
+    return 0;
+  if(base == 0)            //fixed width
+    return font_data(font) + (uint16_t)charnum * (uint8_t)(font_get_height_bytes(font) * font_get_char_width(font,character));
+  if (charnum)             //proportional width
+    while(charnum--)
+      ret += (uint8_t) pgm_read_byte(base++);
+  return (font_data(font))+ret*font_get_height_bytes(font);
+  }
+
+
+/******************************************************************************
+ * Doubles the bytes of either the upper of lower nibble of the given byte
+ * part = 0:  abcdefgh -> eeffgghh
+ * part = 1:  abcdefgh -> aabbccdd
+ * Used for double height font
+ */
+inline unsigned char double_bits(uint8_t part, char c) {
+  uint8_t t = 0;
+  if (part) c = c>>4;
+  if (c & 0x08) t  = 0xC0;
+  if (c & 0x04) t |= 0x30;
+  if (c & 0x02) t |= 0x0C;
+  if (c & 0x01) t |= 0x03;
+  return t;
+  }
+
+/******************************************************************************
+ * Output functions for characters and strings
+ *****************************************************************************/
+
+/******************************************************************************
+ * Outputs a character on the display, using the given font and style
+ */
+uint8_t lcd_put_char(FONT_P font, uint8_t style, char character) {
+  uint16_t  i;
+  uint8_t row  = 0;                             //current row of char
+  #ifdef LCD_DOUBLE_PIXEL
+    uint8_t hc   = 1;                           //height forced
+  #else
+    uint8_t hc   = (style & DOUBLE_HEIGHT)?1:0; //height changed
+  #endif
+  uint8_t wc   = (style & DOUBLE_WIDTH)?1:0;    //width changed
+  uint8_t ul   = (style & UNDERLINE)?0x80:0x00; //underline
+  uint8_t inv  = (style & INVERT)?0xFF:0;       //inverted
+  uint8_t spc  = (style & SPACING)?3:1;         //spacing
+  uint8_t tmp;
+
+  //load information about character
+   uint8_t char_width    = font_get_char_width(font,character); 
+   uint8_t font_height   = font_get_height_bytes(font);
+   uint8_t free_space    = spc;
+   PGM_P   tableposition = font_get_char_position(font,character);
+
+  //final size of character
+  uint8_t char_final_width  = (uint8_t)(char_width+free_space) << wc;
+  uint8_t char_final_height = (uint8_t)font_height << hc; 
+
+  //check for avail. space on display
+  if ((style & WRAP) && (LCD_CURRENT_COL() + char_final_width > LCD_WIDTH)) {
+    LCD_MOVE_TO(LCD_CURRENT_PAGE()+char_final_height,0);
+    if (character == ' ') return 0;
+    }
+  
+  //write character
+  uint8_t cont = 0;
+  do {
+    for(i=(row>>hc); i<char_width*font_height; i+=font_height) {
+      tmp = pgm_read_byte(tableposition+i);
+      if(ul && row == char_final_height-1) 
+        tmp |= ul;
+      if(hc)
+        tmp = double_bits((row&1),tmp);
+      if(inv)
+        tmp = ~tmp;
+      LCD_WRITE(tmp,cont);
+      cont = 1;
+      if(wc) 
+        LCD_WRITE(tmp,cont);
+      }
+    if (free_space) {
+      uint8_t c = inv;
+      if(row == char_final_height-1) {
+        c ^= ul; 
+        if(hc)
+          c ^= ul>>1;      
+          }
+           for(uint8_t x = free_space<<wc; x>0;x--) {
+        LCD_WRITE(c,cont);
+                   }               
+      }
+    LCD_MOVE(1,-char_final_width);
+    cont = 0;
+    } while (++row < char_final_height);
+
+  //move cursor to upper right corner of character
+  LCD_MOVE(-char_final_height,char_final_width);
+  return char_final_width;
+  }
+
+
+/******************************************************************************
+ * Outputs a string on the display, loading it from the program memory,
+ * using the given font and style
+ */
+uint16_t lcd_put_string_P(FONT_P font, uint8_t style, PGM_P str) {
+  unsigned char t;
+  uint16_t length = 0;
+  while((t = pgm_read_byte(str++))) 
+    length += lcd_put_char(font,style,t);
+  return length;
+  }
+
+  
+/******************************************************************************
+ * Outputs a string on the display, using the given font and style
+ */
+uint16_t lcd_put_string(FONT_P font, uint8_t style, char* str) {
+  unsigned char t;
+  uint16_t length = 0;
+  while((t = *str++))
+    length += lcd_put_char(font,style,t);
+  return length;
+  }
+
+  
+/******************************************************************************
+ * Outputs a string on the display, using the given font and style, reading
+ * length characters from the memory
+ */ 
+uint16_t lcd_put_string_length(FONT_P font, uint8_t style, char* str, uint8_t length) {
+  unsigned char t;
+  uint16_t total_len = 0;
+  for(t=0;t<length;t++)
+    total_len += lcd_put_char(font,style,*str++);
+  return total_len;
+  }
+
+  
+/******************************************************************************
+ * Outputs a string on the display, using the given font and style, reading
+ * the string from program memory. The position of the string on the display
+ * is selected by page / col.
+ */ 
+uint16_t lcd_put_string_xy_P(FONT_P font, uint8_t style, PGM_P str,uint16_t page, uint16_t col) {
+  LCD_MOVE_TO(page,col);
+  return lcd_put_string_P(font,style,str);
+  }
+  
+  
+/******************************************************************************
+ * Outputs a string on the display, using the given font and style, reading
+ * the string from main memory. The position of the string on the display
+ * is selected by page / col.
+ */ 
+uint8_t lcd_put_char_xy(FONT_P font, uint8_t style, char character, uint16_t page, uint16_t col) {
+  LCD_MOVE_TO(page,col);
+  return lcd_put_char(font,style,character);
+  }
+
+
+/******************************************************************************
+ * Outputs a character on the display, using the global font and style
+ */ 
+uint8_t  lcd_putc(char c) {
+  return lcd_put_char(global_font_select, global_font_style, c);
+  }
+
+/******************************************************************************
+ * Outputs a character on the display, using the global font and style
+ */ 
+uint8_t  lcd_putc_xy(char c, uint16_t page, uint16_t col) {
+  return lcd_put_char_xy(global_font_select, global_font_style, c, page, col);
+  }  
+  
+  
+/******************************************************************************
+ * Outputs a string on the display, using the global font and style
+ */   
+uint16_t lcd_putstr(char* str) {
+  return lcd_put_string(global_font_select, global_font_style, str);
+  }
+
+  
+  
+/******************************************************************************
+ * Outputs a string stored in program memory on the display, using the global 
+ * font and style
+ */   
+uint16_t lcd_putstr_P(PGM_P str) {
+  return lcd_put_string_P(global_font_select, global_font_style, str);
+  }
+
+  
+/******************************************************************************
+ * Outputs a string on the display, using the global font and style at the 
+ * given position
+ */   
+uint16_t lcd_putstr_xy_P(PGM_P  str, uint16_t page, uint16_t col) {
+  return lcd_put_string_xy_P(global_font_select, global_font_style, str, page, col);
+  }  
+  
+
+#if INCLUDE_INTEGER_OUTPUT == 1
+/******************************************************************************
+ * Outputs a 32bit signed integer on the display // Added by Olli S.
+ */ 
+uint16_t lcd_put_long  (int32_t integer) {
+  char buffer[10];
+       ltoa(integer, buffer, 10);
+       return lcd_put_string(global_font_select, global_font_style, buffer);
+  }
+
+  
+/******************************************************************************
+ * Outputs a 16bit signed integer on the display // Added by Olli S.
+ */   
+uint16_t lcd_put_int (int16_t integer) {
+  char buffer[10];
+       itoa(integer, buffer, 10);
+       return lcd_put_string(global_font_select, global_font_style, buffer);
+  }  
+
+  
+/******************************************************************************
+ * Outputs a 16bit unsigned integer on the display // Added by Olli S.
+ */   
+uint16_t lcd_put_uint  (uint16_t integer) {
+  char buffer[10];
+       utoa(integer, buffer, 10);
+       return lcd_put_string(global_font_select, global_font_style, buffer);
+  }  
+  
+/******************************************************************************
+ * Outputs a 8bit signed integer on the display
+ */   
+uint16_t lcd_put_short (int8_t integer) {
+  char buffer[10];
+       itoa(integer, buffer, 10);
+       return lcd_put_string(global_font_select, global_font_style, buffer);
+  }    
+  
+#endif
+
+#if INCLUDE_FLOAT_OUTPUT == 1
+/******************************************************************************
+ * Outputs a float on the display // Added by Olli S.
+ */ 
+uint16_t lcd_put_float  (float fvalue) {
+  char buffer[10];
+       dtostrf(fvalue, 2, 1, buffer);
+       return lcd_put_string(global_font_select, global_font_style, buffer);
+  }
+#endif
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/font.h b/atmega32u4/stepmotorcontroller/lcdlib/font.h
new file mode 100644 (file)
index 0000000..cc83932
--- /dev/null
@@ -0,0 +1,200 @@
+#ifndef FONT_H_INCLUDED
+#define FONT_H_INCLUDED
+
+#include <avr/io.h>
+#include <avr/pgmspace.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+//Include your LCD graphics library here
+#include "lcd-color-graphic.h"
+//declare font info structure defined below
+struct font_info;
+typedef const struct font_info * FONT_P;
+
+/*****************************************************************************
+ * BEGIN CONFIG BLOCK
+ *****************************************************************************/
+
+//Select which of the available features will be included
+//If a font is not needed, then you don't need to put it to the Flash 
+//Just comment one of the defines below
+
+#define FONTS_INCLUDE_font_proportional_16px    font_proportional_16px
+//#define FONTS_INCLUDE_font_proportional_8px     font_proportional_8px
+//#define FONTS_INCLUDE_font_fixed_8px            font_fixed_8px
+#define FONTS_INCLUDE_font_fixed_16px           font_fixed_16px
+// #define FONTS_INCLUDE_symbols_8px               symbols_8px
+// #define FONTS_INCLUDE_symbols_16px              symbols_16px
+// #define FONTS_INCLUDE_digits_24px               digits_24px
+#define FONTS_INCLUDE_digits_32px               digits_32px
+
+//Set to 1 to include functions for direct output of integer & float values
+// #define INCLUDE_FLOAT_OUTPUT     1
+#define INCLUDE_INTEGER_OUTPUT   1
+
+
+/*****************************************************************************
+ * All font structures + verbose name defines
+ *****************************************************************************/
+#ifdef FONTS_INCLUDE_font_fixed_8px
+  extern const struct font_info font_fixed_8px PROGMEM ;
+  #define FONT_FIXED_8 &font_fixed_8px
+#endif
+
+#ifdef FONTS_INCLUDE_font_fixed_16px
+  extern const struct font_info font_fixed_16px PROGMEM ;
+  #define FONT_FIXED_16 &font_fixed_16px
+#endif
+
+#ifdef FONTS_INCLUDE_font_proportional_16px
+  extern const struct font_info font_proportional_16px PROGMEM ;
+  #define FONT_PROP_16 &font_proportional_16px
+#endif
+
+#ifdef FONTS_INCLUDE_font_proportional_8px
+  extern const struct font_info font_proportional_8px PROGMEM;
+  #define FONT_PROP_8 &font_proportional_8px
+#endif
+
+#ifdef FONTS_INCLUDE_symbols_8px
+  extern const struct font_info symbols_8px PROGMEM;
+  #define FONT_SYMBOL_8 &symbols_8px
+#endif
+
+#ifdef FONTS_INCLUDE_symbols_16px
+  extern const struct font_info symbols_16px PROGMEM;
+  #define FONT_SYMBOL_16 &symbols_16px
+#endif
+
+#ifdef FONTS_INCLUDE_digits_24px
+  extern const struct font_info digits_24px PROGMEM;
+  #define FONT_DIGITS_24 &digits_24px
+#endif
+
+#ifdef FONTS_INCLUDE_digits_32px
+  extern const struct font_info digits_32px PROGMEM;
+  #define FONT_DIGITS_32 &digits_32px
+#endif
+
+//Assign real functions, provided by the LCD library to these macros 
+//used within the font generator
+
+#define LCD_MOVE(x,y)      lcd_move_xy((x),(y))     //relative cursor movement
+#define LCD_MOVE_TO(x,y)   lcd_moveto_xy((x),(y))   //absolute cursor movement
+#define LCD_WRITE(x,c)       lcd_write_font_byte(x,c)   //lcd_data((x))            //write data to display
+
+//Functions to read the current position as provided by the LCD library
+#define LCD_CURRENT_COL()   lcd_get_position_column()
+#define LCD_CURRENT_PAGE()  lcd_get_position_page()
+
+
+/******************************************************************************
+ * END CONFIG BLOCK
+ *****************************************************************************/
+
+
+
+
+/******************************************************************************
+ * Internal Functions to locate and display characters
+ *****************************************************************************/
+/*
+PGM_P   font_data              (FONT_P font);
+PGM_P   font_widthtable        (FONT_P font);
+uint8_t font_get_height_bytes  (FONT_P font);
+uint8_t font_get_type          (FONT_P font);
+uint8_t font_get_char_width    (FONT_P font, char character);
+int16_t font_get_char_number   (FONT_P font, char character);
+PGM_P   font_get_char_position (FONT_P font, char character);
+*/
+
+
+/******************************************************************************
+ * Functions to display characters and strings
+ *****************************************************************************/
+//where font is a pointer to a FONT_P struct,
+//style is one or more of the defines for different font sizes & styles shown below
+//and str and c are the string or the character to be displayed
+
+uint16_t lcd_put_string       (FONT_P font, uint8_t style, char* str);
+uint16_t lcd_put_string_length(FONT_P font, uint8_t style, char* str,      uint8_t length);
+uint16_t lcd_put_string_P     (FONT_P font, uint8_t style, PGM_P str);
+uint8_t  lcd_put_char         (FONT_P font, uint8_t style, char c);
+uint16_t lcd_put_string_xy_P  (FONT_P font, uint8_t style, PGM_P str,      uint16_t page, uint16_t col);
+uint8_t  lcd_put_char_xy      (FONT_P font, uint8_t style, char character, uint16_t page, uint16_t col);
+
+void     lcd_set_font         (FONT_P font, uint8_t style);
+uint8_t  lcd_putc             (char c);
+uint8_t  lcd_putc_xy          (char c, uint16_t page, uint16_t col);
+uint16_t lcd_putstr           (char* str);
+uint16_t lcd_putstr_P         (PGM_P str);
+uint16_t lcd_putstr_xy_P      (PGM_P  str, uint16_t page, uint16_t col);
+
+#if INCLUDE_INTEGER_OUTPUT == 1
+uint16_t lcd_put_long (int32_t integer);
+uint16_t lcd_put_int  (int16_t integer);
+uint16_t lcd_put_uint (uint16_t integer);
+uint16_t lcd_put_short(int8_t  integer);
+#endif
+#if INCLUDE_FLOAT_OUTPUT == 1
+uint16_t lcd_put_float (float integer);
+#endif
+
+
+
+/******************************************************************************
+ * Define font styles
+ * These names are used as the style attribute to above put* functions
+ *****************************************************************************/
+
+#define NORMAL        0
+#define NORMAL_SIZE   0
+#define DOUBLE_HEIGHT 1    //double the height of each character 
+#define DOUBLE_WIDTH  2    //double the width of each character 
+#define DOUBLE_SIZE   3    //double height and double width
+#define INVERT        4    //draw white letters with black background
+#define WRAP          8    //wrap around text that does not fit in the current line
+#define UNDERLINE    16    //underline the text
+#define SPACING      32    //increase spacing between character
+
+
+//used for internal functions:
+#define DOUBLE_HEIGHT_BIT 1
+#define DOUBLE_WIDTH_BIT  2
+#define INVERT_BIT        4
+#define WRAP_BIT          8
+#define UNDERLINE_BIT    16
+
+/******************************************************************************
+ * Documentation: Example Font File
+ * A c-template to use with Hagen Reddmanns font generator is 
+ * included (template_simplefont.c)
+ *****************************************************************************/
+/*
+#include "font.h"
+#ifdef %FONT INCLUDE IDENTIFIER%
+const char fontname_length[] PROGMEM = {...}
+const char fontname_data[] PROGMEM = {...}   
+const struct font_info fontname PROGMEM = {...};
+#endif
+*/
+
+
+/******************************************************************************
+ * Structure holds information about fonts 
+ *****************************************************************************/
+struct font_info {
+    uint16_t size;       //size of data array
+    uint8_t  width;      //(maximum) width of character
+    uint8_t  height;     //height of character
+    uint8_t  firstchar;  //the number of the first included character (often 0x20)
+    uint8_t  lastchar;   //the last included character (often 0xFF)
+    PGM_VOID_P    widthtable; //Pointer to the table holding character widths (NULL for monospaced fonts)
+    PGM_VOID_P    data;       //Pointer to data arrray
+    };
+
+
+
+#endif
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/lcd-color-graphic.c b/atmega32u4/stepmotorcontroller/lcdlib/lcd-color-graphic.c
new file mode 100644 (file)
index 0000000..a3b1c52
--- /dev/null
@@ -0,0 +1,286 @@
+/******************************************************************************
+ * Display Library
+ * for an LCD with ILI9341 driver in 16 Bit color mode using 4-wire SPI
+ * New features in v0.01
+ *   - well... everything.
+ *****************************************************************************/
+
+#include "lcd-color-graphic.h"
+
+
+/******************************************************************************
+  * Global variables for color handling
+  * Foreground is the normal drawing color
+  * Background is used as background, e.g. when writing fonts.
+  */
+
+color_t foreground;
+color_t background;
+
+
+/******************************************************************************
+  * Initializes the display
+  */
+void lcd_init() {
+  LCD_SET_PIN_DIRECTIONS();  //set outputs
+  _delay_ms(1);
+  LCD_INIT_SPI();            //Initialize SPI Interface  
+  LCD_UNSELECT();
+  _delay_ms(50);
+  LCD_RESET_ON();            //Apply Reset to the Display Controller  
+  _delay_ms(100); 
+  LCD_RESET_OFF();  
+  _delay_ms(100);
+  LCD_SELECT();               //Switches chip select on
+  lcd_command(LCD_SLEEP_OUT); //Wake up LCD
+  _delay_ms(70);
+  lcd_command_1(LCD_COLOR_MODE,LCD_16BIT);
+  return;
+  }
+
+  
+/******************************************************************************
+  * Sends a command to the display
+  */
+// inline void lcd_command(uint8_t c) {
+//   spi_wait_for_idle();
+//   LCD_CMD();
+//   spi_write(c);
+//   }
+
+  
+/******************************************************************************
+  * Sends a data word to the display
+  */
+// inline void lcd_data(uint8_t c) {
+//   spi_wait_for_idle();
+//   LCD_DATA();
+//   spi_write(c);
+// }  
+
+
+/******************************************************************************
+  * Sends a command with one argument
+  */
+inline void lcd_command_1(uint8_t c, uint8_t data) {
+  lcd_command(c);
+  lcd_data(data);
+}  
+
+/******************************************************************************
+  * Stores the main drawing color for later use
+  */
+inline void lcd_set_foreground(uint8_t r, uint8_t g, uint8_t b) {
+  uint16_t t = r<<11 | g<<5 | b;
+  foreground.c1 = t>>8;
+  foreground.c2 = t;
+  }
+inline void lcd_use_foreground(color_t color) {
+  foreground.c1 = color.c1;
+  foreground.c2 = color.c2;
+  }
+
+
+/******************************************************************************
+  * Stores the background color for later use
+  */
+inline void lcd_set_background(uint8_t r, uint8_t g, uint8_t b) {
+  uint16_t t = r<<11 | g<<5 | b;
+  background.c1 = t>>8;
+  background.c2 = t;
+  }
+inline void lcd_use_background(color_t color) {
+  background.c1 = color.c1;
+  background.c2 = color.c2;
+  }
+  
+/******************************************************************************
+  * Stores the background color for later use
+  */
+inline void lcd_set_color(color_t* color, uint8_t r, uint8_t g, uint8_t b) {
+  uint16_t t = r<<11 | g<<5 | b;
+  color->c1 = t>>8;
+  color->c2 = t;
+  }  
+  
+
+/******************************************************************************
+  * Sets the column range used for the next write operation
+  */
+inline void lcd_set_column(uint16_t start, uint16_t end) {
+  lcd_command(LCD_SET_COLUMN);
+  lcd_data(start >> 8);
+  lcd_data_cont(start);
+  lcd_data_cont(end >> 8);
+  lcd_data_cont(end);
+  }
+inline void lcd_set_column_short(uint16_t start) {
+  lcd_command(LCD_SET_COLUMN);
+  lcd_data(start >> 8);
+  lcd_data_cont(start);
+  }
+  
+/******************************************************************************
+  * Sets the page range used for the next write operation
+  */
+inline void lcd_set_page(uint16_t start, uint16_t end) {
+  lcd_command(LCD_SET_PAGE);
+  lcd_data(start >> 8);
+  lcd_data_cont(start);
+  lcd_data_cont(end >> 8);
+  lcd_data_cont(end);
+  }
+inline void lcd_set_page_short(uint16_t start) {
+  lcd_command(LCD_SET_PAGE);
+  lcd_data(start >> 8);
+  lcd_data_cont(start);
+  }
+
+/******************************************************************************
+  * Writes a pixel to the display using 16 Bit color mode
+  */
+inline void lcd_send_pixel(color_t c) {
+  lcd_data(c.c1);
+  lcd_data_cont(c.c2);
+  }  
+  
+/******************************************************************************
+  * Sets a pixel at a given position
+  */
+inline void lcd_set_pixel_xy(uint16_t column, uint16_t page) {
+  lcd_set_page(page,page);
+  lcd_set_column(column,column);
+  lcd_command(LCD_WRITE_MEM);
+  lcd_send_pixel(foreground);
+  }    
+
+/******************************************************************************
+  * Sets a pixel at a given position
+  */
+inline void lcd_set_pixel_col_xy(uint16_t column, uint16_t page, color_t col) {
+  lcd_set_page_short(page);
+  lcd_set_column_short(column);
+  lcd_command(LCD_WRITE_MEM);
+  lcd_send_pixel(col);
+  }   
+  
+/******************************************************************************
+ * This function sets an area of the screen to a given color
+ * col0          - left edge of the area
+ * col1          - right edge of the area
+ * page0         - top edge of the area
+ * page1         - bottom edge of the area
+ * r,g,b         - the color to be used
+ */
+void lcd_set_area_xy(uint16_t col0, uint16_t col1, uint16_t page0, uint16_t page1) {
+  lcd_set_column(col0,col1);
+  lcd_set_page(page0,page1);
+  lcd_command(LCD_WRITE_MEM);
+  for(uint16_t y = page0; y <= page1; y++)
+    for(uint16_t x = col0; x <= col1; x++) {
+      lcd_send_pixel(background);
+      }
+  }
+  
+  
+  
+//=============================================================================
+//Compatibility functions to accept output of font generator
+// Pages are counted in units of 8 pixels!
+//=============================================================================
+
+uint16_t lcd_current_page = 0;
+uint16_t lcd_current_column = 0;
+
+
+/******************************************************************************
+ * Changes the internal cursor by s pages
+ * s             - number of pages to move
+ */ 
+uint16_t lcd_inc_page(int16_t s) {
+  uint16_t p = lcd_current_page;
+  p += s;
+  if (p > LCD_HEIGHT)
+    p = 0;
+  lcd_current_page = p;
+  
+  return p;
+  }
+
+/******************************************************************************
+ * Changes the internal cursor by s columns, including wrapping (if selected)
+ * s             - number of columns to move
+ */ 
+uint16_t lcd_inc_column(int16_t s) {
+  uint16_t c = lcd_current_column;
+  c += s;
+  if (c > LCD_WIDTH) 
+    c = 0;
+  lcd_current_column = c;
+  return c;
+  }
+  
+  
+/******************************************************************************
+ * Moves the cursor to the given position
+ * pages         - page to move to
+ * columns       - column to move to
+ */ 
+void lcd_moveto_xy(uint16_t page, uint16_t column) {
+  lcd_current_column = column; 
+  lcd_current_page = page;
+  }
+
+/******************************************************************************
+ * Moves the cursor relative to the current position
+ * pages         - number of pages to move
+ * columns       - number of columns to move
+ * for use with the font library only
+ */  
+void lcd_move_xy(int16_t pages, int16_t columns) {
+  lcd_moveto_xy(lcd_inc_page(pages*8),lcd_inc_column(columns));
+  }
+
+
+/******************************************************************************
+ * Takes a vertical byte from the font generator and prints it on the display
+ * b             - Bit pattern to display
+ * c             - continue writing in same page
+ */ 
+void lcd_write_font_byte(uint8_t b, uint8_t c) {
+  if(!c) {
+    lcd_set_page(lcd_current_page,lcd_current_page+8);
+    }
+  lcd_set_column(lcd_current_column,lcd_current_column);
+  lcd_command(LCD_WRITE_MEM);
+  for(uint8_t i=0;i<8;i++) {
+    if(b&1)
+      lcd_send_pixel(foreground);
+    else
+      lcd_send_pixel(background);
+    b = b>>1;
+    }
+  lcd_inc_column(1);
+  }
+
+  
+/******************************************************************************
+ * Draws a line according to Bresenham (from wikipedia)
+ */   
+void lcd_draw_line(uint16_t x0, uint16_t x1, uint16_t y0, uint16_t y1) {
+  int16_t dx =  abs(x1-x0);
+  int16_t sx = x0<x1 ? 1 : -1;
+  int16_t dy = -abs(y1-y0);
+  int16_t sy = y0<y1 ? 1 : -1;
+  int16_t err = dx+dy, e2; /* error value e_xy */
+  for(;;){  /* loop */
+    lcd_set_pixel_xy(x0,y0);
+    if (x0==x1 && y0==y1) break;
+    e2 = 2*err;
+    if (e2 > dy) { err += dy; x0 += sx; } /* e_xy+e_x > 0 */
+    if (e2 < dx) { err += dx; y0 += sy; } /* e_xy+e_y < 0 */
+    }  
+  }
+
+  
\ No newline at end of file
diff --git a/atmega32u4/stepmotorcontroller/lcdlib/lcd-color-graphic.h b/atmega32u4/stepmotorcontroller/lcdlib/lcd-color-graphic.h
new file mode 100644 (file)
index 0000000..3c7e64f
--- /dev/null
@@ -0,0 +1,196 @@
+#ifndef LCD_H_INCLUDED
+#define LCD_H_INCLUDED
+
+#include <avr/io.h>
+#include <inttypes.h>
+#include <string.h>
+#include <util/delay.h>
+#include <avr/pgmspace.h>
+#include <stdlib.h>
+
+/*****************************************************************************
+ * BEGIN CONFIG BLOCK
+ *****************************************************************************/
+#define LCD_WIDTH   320
+#define LCD_HEIGHT  240
+
+//Should chip select (CS) be used?
+#define LCD_USE_CHIPSELECT  1
+
+//CD Port
+#define PORT_DC  PORTB
+#define DDR_DC   DDRB
+#define PIN_DC   0
+
+//Reset Port
+#define PORT_RST PORTB
+#define DDR_RST  DDRB
+#define PIN_RST  4
+
+//Chip select
+#if LCD_USE_CHIPSELECT == 1
+  #define PORT_CS  PORTE
+  #define DDR_CS   DDRE
+  #define PIN_CS   6
+#endif
+
+//SPI routines
+//Define a function that initializes the SPI interface, see below for an example
+//extern void init_spi_lcd(void);
+#define LCD_INIT_SPI()
+//init_spi_lcd()
+
+//Define a function that waits until SPI interface is idle
+#define spi_wait_for_idle() asm volatile ("nop");while(! (SPSR & _BV(SPIF)));
+
+//Define how to write to SPI data register
+#define spi_write(i) SPDR = i
+
+/*Example SPI setup (Atmega162)
+ *init spi: msb first, update on falling edge , read on rising edge, 9 MHz
+ *void init_spi_lcd() {
+ *  SPCR = 0 << SPIE | 1 << SPE | 0 << DORD | 1 << MSTR | 1 << CPOL | 1 << CPHA | 0 << SPR1 | 0 << SPR0;
+ *  SPSR = 1 << SPI2X;
+ *  SPDR = LCD_NO_OP; //Do not use 0 here, only LCD_NOP is allowed!
+ *  }
+ */
+/*****************************************************************************
+ * END CONFIG BLOCK
+ *****************************************************************************/
+
+//In case of an color LCD, this struct will keep the necessary information
+//Color struct - no bit fields are used for better performance (i.e. bit shifts
+//can be done while waiting for SPI, not while preparing to write the pixel)
+typedef struct {
+    uint8_t c1;
+    uint8_t c2;
+    } color_t;
+
+
+#define lcd_data(c) spi_wait_for_idle();LCD_DATA();spi_write(c)
+#define lcd_data_cont(c) spi_wait_for_idle();spi_write(c)
+#define lcd_command(c) spi_wait_for_idle();LCD_CMD();spi_write(c)
+
+  color_t foreground;
+  color_t background;
+    
+/*****************************************************************************
+ * Public Functions
+ *****************************************************************************/
+//initializes the display in standard settings
+ void lcd_init(void);
+
+//write data word or command to the LCD
+//  void lcd_data      (uint8_t data) ;
+//  void lcd_command   (uint8_t cmd);
+ void lcd_command_1 (uint8_t cmd, uint8_t data);
+
+//Set the drawing and background colors
+ void lcd_set_foreground(uint8_t r, uint8_t g, uint8_t b);
+ void lcd_set_background(uint8_t r, uint8_t g, uint8_t b);
+ void lcd_set_color(color_t* color, uint8_t r, uint8_t g, uint8_t b);
+ void lcd_use_foreground(color_t color);
+ void lcd_use_background(color_t color);
+  
+//set display area for next write accesses
+ void lcd_set_page(uint16_t start, uint16_t end);
+ void lcd_set_column(uint16_t start, uint16_t end);
+
+//write pixel data in 16 bit color mode. Display must be in write mode
+ void lcd_send_pixel(color_t c);
+
+//Set a pixel at a given location to the foreground color
+ void lcd_set_pixel_xy(uint16_t column, uint16_t page); 
+ void lcd_set_pixel_col_xy(uint16_t column, uint16_t page, color_t col);
+//Set an area to the background color
+ void lcd_set_area_xy(uint16_t col0, uint16_t col1, uint16_t page0, uint16_t page1);
+
+//Draw a straight line 
+ void lcd_draw_line(uint16_t x1, uint16_t x2, uint16_t y1, uint16_t y2);
+//Text functions are included in font.c / font.h
+//These functions provide compatibility to the old font generator
+ uint16_t lcd_inc_page(int16_t s);
+ uint16_t lcd_inc_column(int16_t s);
+ void lcd_moveto_xy(uint16_t page, uint16_t column);
+ void lcd_move_xy(int16_t pages, int16_t columns);
+//Function to read the current position
+ extern uint16_t lcd_current_page;
+ extern uint16_t lcd_current_column;
+ static inline uint16_t lcd_get_position_page(void)   {return lcd_current_page;}
+ static inline uint16_t lcd_get_position_column(void) {return lcd_current_column;}
+ void lcd_write_font_byte(uint8_t b, uint8_t c);
+
+
+/*****************************************************************************
+ * Command Codes
+ *****************************************************************************/
+  #define LCD_NOP               0x00
+  #define LCD_SOFT_RESET        0x01
+  #define LCD_SLEEP_ENTER       0x10
+  #define LCD_SLEEP_OUT         0x11
+  #define LCD_OFF               0x28
+  #define LCD_ON                0x29
+  #define LCD_SET_COLUMN        0x2A
+  #define LCD_SET_PAGE          0x2B
+  #define LCD_WRITE_MEM         0x2C
+  #define LCD_MIRROR            0x36
+  #define LCD_IDLE_MODE_OFF     0x38
+  #define LCD_IDLE_MODE_ON      0x39
+  #define LCD_COLOR_MODE        0x3A
+  #define LCD_WRITE_CONTINUE    0x3C  
+
+/*****************************************************************************
+ * Commands  Arguments
+ *****************************************************************************/
+  #define LCD_16BIT             0x55
+  #define LCD_18BIT             0x66
+
+//Settings for LCD_MIRROR (0x36)
+  #define LCD_MIRROR_Y          0x80
+  #define LCD_MIRROR_X          0x40
+  #define LCD_FLIP_XY           0x20
+  #define LCD_BGR               0x08
+
+
+
+/*****************************************************************************
+ * Output pin controlling makros
+ *****************************************************************************/
+
+//Control A0 input of LCD
+#define LCD_DATA()            PORT_DC |= _BV(PIN_DC)
+#define LCD_CMD()             PORT_DC &= ~_BV(PIN_DC)
+#define LCD_SET_OUTPUT_DC()   DDR_DC  |= _BV(PIN_DC)
+
+//Control reset input of LCD
+#define LCD_RESET_OFF()       PORT_RST |= _BV(PIN_RST)
+#define LCD_RESET_ON()        PORT_RST &= ~_BV(PIN_RST)
+#define LCD_SET_OUTPUT_RST()  DDR_RST |= _BV(PIN_RST)
+
+
+//Control pin for chip select
+#if LCD_USE_CHIPSELECT == 1
+  #define LCD_SET_OUTPUT_CS()  DDR_CS  |= _BV(PIN_CS)
+  #define LCD_SELECT()         PORT_CS &= ~_BV(PIN_CS)
+  #define LCD_UNSELECT()       spi_wait_for_idle(); PORT_CS |= _BV(PIN_CS)
+#else
+  #define LCD_SET_OUTPUT_CS()  
+  #define LCD_SELECT()         spi_wait_for_idle();
+  #define LCD_UNSELECT()   
+#endif
+
+//combined direction selection for all pins
+#define LCD_SET_PIN_DIRECTIONS()   LCD_SET_OUTPUT_DC(); \
+                                   LCD_SET_OUTPUT_RST(); \
+                                   LCD_SET_OUTPUT_CS()
+
+
+
+
+
+#endif
+
diff --git a/atmega32u4/stepmotorcontroller/main.c b/atmega32u4/stepmotorcontroller/main.c
new file mode 100644 (file)
index 0000000..3acdf68
--- /dev/null
@@ -0,0 +1,316 @@
+
+
+// #include <avr/eeprom.h>
+#include <avr/interrupt.h>
+#include <avr/io.h>
+#include <string.h>
+#include <usb_serial.h>
+#include <util/delay.h>
+#include "lcdlib/lcd-color-graphic.h"
+#include "lcdlib/font.h"
+
+
+void getdata(uint8_t buf);
+
+
+#define FIRMWARE_VERSION 0x001
+
+#define KP_C1_ON()   PORTD |=  (1 << PD7)
+#define KP_C1_OFF()  PORTD &= ~(1 << PD7)
+#define KP_C2_ON()   PORTC |=  (1 << PC6)
+#define KP_C2_OFF()  PORTC &= ~(1 << PC6)
+#define KP_C3_ON()   PORTC |=  (1 << PC7)
+#define KP_C3_OFF()  PORTC &= ~(1 << PC7)
+#define KP_C4_ON()   PORTE |=  (1 << PE2)
+#define KP_C4_OFF()  PORTE &= ~(1 << PE2)
+
+#define KP_R1() ((PIND & (1<<PD3))?1:0)
+#define KP_R2() ((PIND & (1<<PD5))?1:0)
+#define KP_R3() ((PIND & (1<<PD6))?1:0)
+#define KP_R4() ((PIND & (1<<PD4))?1:0)
+
+#define ENABLE_M2()  PORTF |=  (1 << PF0)
+#define DISABLE_M2() PORTF &= ~(1 << PF0)
+
+#define ENABLE_M1()  PORTF |=  (1 << PF7)
+#define DISABLE_M1() PORTF &= ~(1 << PF7)
+
+#define PULSE_HIGH_M2()  PORTF |=  (1 << PF4)
+#define PULSE_LOW_M2()   PORTF &= ~(1 << PF4)
+
+#define PULSE_HIGH_M1()  PORTF |=  (1 << PF5)
+#define PULSE_LOW_M1()   PORTF &= ~(1 << PF5)
+
+#define DIRECTION_FORWARD_M2()   PORTF |=  (1 << PF1)
+#define DIRECTION_BACKWARD_M2()  PORTF &= ~(1 << PF1)
+
+#define DIRECTION_FORWARD_M1()   PORTF |=  (1 << PF6)
+#define DIRECTION_BACKWARD_M1()  PORTF &= ~(1 << PF6)
+
+
+volatile int32_t  M1_STEPS = 0;
+volatile int32_t  M2_STEPS = 0;
+
+volatile uint8_t  M1_ACTIVE = 0;
+volatile uint8_t  M2_ACTIVE = 0;
+
+volatile uint8_t  M1_ENABLE = 0;
+volatile uint8_t  M2_ENABLE = 0;
+
+volatile uint8_t  M1_SWITCH_LOW = 0;
+volatile uint8_t  M2_SWITCH_LOW = 0;
+volatile uint8_t  M1_SWITCH_HIGH = 0;
+volatile uint8_t  M2_SWITCH_HIGH = 0;
+volatile uint8_t  switch_changed = 0;
+
+
+uint16_t time;
+uint8_t rxcnt = 0, txpoint = 0;
+uint8_t rxbuf[15];
+uint8_t txbuf[15];
+color_t colors[6];
+color_t topback;
+uint8_t keypad[16] = {0};
+
+/*****************************************************************
+ * Command Handling
+ *****************************************************************/
+
+// convert integer or nibbles into hex value
+uint8_t nib_to_hex(uint32_t in, uint8_t nib) {
+  uint8_t t = (in >> (nib * 4)) & 0xF;
+  if (t <= 9) {
+    return t + 0x30;
+    }
+  return t - 10 + 0x61;
+  }
+
+// convert hex value to integer,  assumes valid number
+uint8_t hex_to_int(uint8_t h) {
+  if (h < 0x40) return h - 0x30;
+  if (h < 0x50) return h - 0x41 + 10;
+                return h - 0x61 + 10;
+  }
+
+
+uint32_t hex_to_int32(uint8_t * buf) {
+  uint32_t value = 0;
+  for(uint8_t i = 0;i < 8; i++) {
+    value <<= 4;
+    value += hex_to_int(*buf);
+    buf++;
+    }
+  return value;
+  }
+
+void send_answer_buf(uint8_t *b) { UCSR1B |= (1 << UDRIE1); }
+  // activate transmit interupt "ISR(USART1_UDRE_vect)"
+
+//compose response string
+void send_answer_hex(uint8_t *rxbuf, uint32_t v) {
+  txbuf[0] = 'A';
+  txbuf[1] = rxbuf[1];
+  txbuf[2] = rxbuf[2];
+  txbuf[3] = nib_to_hex(v, 7);
+  txbuf[4] = nib_to_hex(v, 6);
+  txbuf[5] = nib_to_hex(v, 5);
+  txbuf[6] = nib_to_hex(v, 4);
+  txbuf[7] = nib_to_hex(v, 3);
+  txbuf[8] = nib_to_hex(v, 2);
+  txbuf[9] = nib_to_hex(v, 1);
+  txbuf[10] =nib_to_hex(v, 0);
+  txbuf[11] = '\n';
+  txbuf[12] = 0;
+  send_answer_buf(txbuf,12);
+  }
+
+
+ /*****************************************************************
+ * Setting functions
+ *****************************************************************/
+
+
+
+ /*****************************************************************
+ * Interrupts
+ *****************************************************************/
+ISR(TIMER0_OVF_vect) {
+  // interupt for time, watchdog, keypad
+  time++;
+
+  KP_C1_ON(); asm volatile("nop");
+  uint8_t t = 0;
+  keypad[0] += KP_R1();
+  keypad[1] += KP_R2();
+  keypad[2] += KP_R3();
+  keypad[3] += KP_R4();
+  KP_C1_OFF(); asm volatile("nop");
+  KP_C2_ON(); asm volatile("nop");
+  uint8_t t = 0;
+  keypad[4] += KP_R1();
+  keypad[5] += KP_R2();
+  keypad[6] += KP_R3();
+  keypad[7] += KP_R4();
+  KP_C2_OFF(); asm volatile("nop");
+  KP_C3_ON(); asm volatile("nop");
+  uint8_t t = 0;
+  keypad[8] += KP_R1();
+  keypad[9] += KP_R2();
+  keypad[10] += KP_R3();
+  keypad[11] += KP_R4();
+  KP_C3_OFF(); asm volatile("nop");
+  KP_C4_ON(); asm volatile("nop");
+  uint8_t t = 0;
+  keypad[12] += KP_R1();
+  keypad[13] += KP_R2();
+  keypad[14] += KP_R3();
+  keypad[15] += KP_R4();
+  KP_C4_OFF(); asm volatile("nop");
+
+  asm volatile("wdr");
+}
+
+
+ISR(PCINT0_vect) {
+  // interupt for switches
+  M1_SWITCH_LOW  = (PINB & (1<<PB6))? 1 : 0;
+  M1_SWITCH_HIGH = (PINB & (1<<PB5))? 1 : 0;
+  M2_SWITCH_LOW  = (PINB & (1<<PB4))? 1 : 0;
+  M2_SWITCH_HIGH = (PINB & (1<<PB7))? 1 : 0;
+  switch_changed = 1;
+}
+
+ /*****************************************************************
+ * Communication
+ *****************************************************************/
+void getdata(uint8_t buf) {
+
+  if (rxcnt != 0 || (buf == 'W' || buf == 'R')) {
+    rxbuf[rxcnt++] = buf;
+    }
+  if (buf == '\n' || buf == '\r') { // End of Command
+    if (rxcnt == 12) {
+      uint8_t regnumber = hex_to_int(rxbuf[2]) + hex_to_int(rxbuf[1])*16;
+
+      if (rxbuf[0] == 'R') {
+        if (regnumber == 1) {        //Register 1: PIN
+          send_answer_hex(&rxbuf[0], 0xabcd1234);
+          }
+
+      }
+      if (rxbuf[0] == 'W') {
+        uint32_t value = hex_to_int32(&rxbuf[3]);
+        if (regnumber == 0) {
+          send_answer_hex(&rxbuf[0], value);
+          }
+        }
+      }
+    }
+
+  if (rxcnt >= 12 || buf == '\n' || buf == '\r') {
+    rxcnt = 0;
+    }
+  }
+
+
+ /*****************************************************************
+ * Main function
+ *****************************************************************/
+
+__attribute__((naked)) void main(void) {
+  // initialize the board
+
+  CLKPR = (1 << CLKPCE); // prescaler 2 = 8 MHz
+  CLKPR = (1 << CLKPS0); // prescaler 2
+
+  // Configure ports
+
+  MCUCR |= (1 << JTD);
+  MCUCR |= (1 << JTD); // yes, twice
+
+  //--------------------------------------------------------//
+  // DDRx  : 0 = Input; 1 = Output
+  // PORTx : Input  ->  0: no PullUp    1: Pullup
+  //        Output ->  0: LOW          1: HIGH
+
+  PORTB = 0b11110000;
+  DDRB  = 0b00001111;
+
+  PORTC = 0b00000000;
+  DDRC  = 0b11000000;
+
+  PORTD = 0b01111000;
+  DDRD  = 0b10000100;
+
+  PORTE = 0b00000000;
+  DDRE  = 0b01000100;
+
+  PORTF = 0b00000000;
+  DDRF  = 0b11110011;
+
+  // Timer0 at 30 Hz overflow
+  TCCR0B = (5 << CS00);
+  TIMSK0 = (1 << TOIE0); // Overflow interrupt`
+
+  //SPI for display
+  SPCR = 0 << SPIE | 1 << SPE | 0 << DORD | 1 << MSTR | 1 << CPOL | 1 << CPHA | 0 << SPR1 | 0 << SPR0;
+  SPSR = 1 << SPI2X;
+  SPDR = LCD_NOP; //Do not use 0 here, only LCD_NOP is allowed!
+
+  //Interrupt for switches
+  PCICR = (1 << PCIE0);
+  PCMSK0 = 0xf0;
+
+  //Timer for motor Controller
+
+  //I2C for current monitor
+
+
+  _delay_ms(200);
+  lcd_init();
+  lcd_set_color(colors+0,0x1f,0x3f,0x0e); //yellow 1st
+  lcd_set_color(colors+1,0x1f,0x3f,0x0e); //yellow 2nd
+  lcd_set_color(colors+2,0x1f,0x3f,0x1f); //second curve
+  lcd_set_color(colors+3,0x0e,0x3f,0x0f); //green
+  lcd_set_color(colors+4,0x0e,0x1f,0x1f); //blue cool
+  lcd_set_color(colors+5,0x1f,0x09,0x01); //red heat
+
+  lcd_set_color(&topback,0x03,0x04,0x05);
+
+  // lcd_command_1(LCD_MIRROR, LCD_BGR | LCD_FLIP_XY);
+  lcd_command(LCD_ON);
+  lcd_use_background(topback);
+  lcd_set_area_xy(0, 0x13F, 0, 0xEF);
+  lcd_set_font(font_proportional_16px,SPACING);
+  lcd_use_background(topback);
+  lcd_putstr_xy_P(PSTR("Step Motor Controller"),32,0);
+
+
+  uint16_t lasttime = 0;
+
+  while (1) {
+    //     int n = usb_serial_getchar();
+    //     if (n >= 0) {
+    //      isMaster = 1;
+    //      //SELECT_MASTER();
+    //      getdata(n);
+    //    }
+
+    if ((time != lasttime)) {
+      if(switch_changed) {
+        lcd_set_font(font_fixed_16px,SPACING);
+        uint8_t[6] text;
+        text[0] = M1_SWITCH_LOW ? '_':'X';
+        text[1] = M1_SWITCH_HIGH ? '_':'X';
+        text[2] = ' ';
+        text[3] = M2_SWITCH_LOW ? '_':'X';
+        text[4] = M2_SWITCH_HIGH ? '_':'X';
+        text[5] = 0;
+        lcd_putstr_xy(text,32,0);
+        }
+    }
+
+
+    lasttime = time;
+  }
+}
diff --git a/atmega32u4/stepmotorcontroller/usb_serial.c b/atmega32u4/stepmotorcontroller/usb_serial.c
new file mode 100644 (file)
index 0000000..708bc54
--- /dev/null
@@ -0,0 +1,937 @@
+/* USB Serial Example for Teensy USB Development Board
+ * http://www.pjrc.com/teensy/usb_serial.html
+ * Copyright (c) 2008,2010,2011 PJRC.COM, LLC
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+// Version 1.0: Initial Release
+// Version 1.1: support Teensy++
+// Version 1.2: fixed usb_serial_available
+// Version 1.3: added transmit bandwidth test
+// Version 1.4: added usb_serial_write
+// Version 1.5: add support for Teensy 2.0
+// Version 1.6: fix zero length packet bug
+// Version 1.7: fix usb_serial_set_control
+
+#define USB_SERIAL_PRIVATE_INCLUDE
+#include "usb_serial.h"
+
+
+/**************************************************************************
+ *
+ *  Configurable Options
+ *
+ **************************************************************************/
+
+// You can change these to give your code its own name.  On Windows,
+// these are only used before an INF file (driver install) is loaded.
+#define STR_MANUFACTURER        L"Xmatter"
+#define STR_PRODUCT                L"DCDC_Test"
+
+// All USB serial devices are supposed to have a serial number
+// (according to Microsoft).  On windows, a new COM port is created
+// for every unique serial/vendor/product number combination.  If
+// you program 2 identical boards with 2 different serial numbers
+// and they are assigned COM7 and COM8, each will always get the
+// same COM port number because Windows remembers serial numbers.
+//
+// On Mac OS-X, a device file is created automatically which
+// incorperates the serial number, eg, /dev/cu-usbmodem12341
+//
+// Linux by default ignores the serial number, and creates device
+// files named /dev/ttyACM0, /dev/ttyACM1... in the order connected.
+// Udev rules (in /etc/udev/rules.d) can define persistent device
+// names linked to this serial number, as well as permissions, owner
+// and group settings.
+//#define STR_SERIAL_NUMBER        L ## NUMBER
+
+
+// Mac OS-X and Linux automatically load the correct drivers.  On
+// Windows, even though the driver is supplied by Microsoft, an
+// INF file is needed to load the driver.  These numbers need to
+// match the INF file.
+#define VENDOR_ID                0x16C0
+#define PRODUCT_ID                0x047A
+
+// When you write data, it goes into a USB endpoint buffer, which
+// is transmitted to the PC when it becomes full, or after a timeout
+// with no more writes.  Even if you write in exactly packet-size
+// increments, this timeout is used to send a "zero length packet"
+// that tells the PC no more data is expected and it should pass
+// any buffered data to the application that may be waiting.  If
+// you want data sent immediately, call usb_serial_flush_output().
+#define TRANSMIT_FLUSH_TIMEOUT        5   /* in milliseconds */
+
+// If the PC is connected but not "listening", this is the length
+// of time before usb_serial_getchar() returns with an error.  This
+// is roughly equivilant to a real UART simply transmitting the
+// bits on a wire where nobody is listening, except you get an error
+// code which you can ignore for serial-like discard of data, or
+// use to know your data wasn't sent.
+#define TRANSMIT_TIMEOUT        25   /* in milliseconds */
+
+// USB devices are supposed to implment a halt feature, which is
+// rarely (if ever) used.  If you comment this line out, the halt
+// code will be removed, saving 116 bytes of space (gcc 4.3.0).
+// This is not strictly USB compliant, but works with all major
+// operating systems.
+//#define SUPPORT_ENDPOINT_HALT
+
+
+
+/**************************************************************************
+ *
+ *  Endpoint Buffer Configuration
+ *
+ **************************************************************************/
+
+// These buffer sizes are best for most applications, but perhaps if you
+// want more buffering on some endpoint at the expense of others, this
+// is where you can make such changes.  The AT90USB162 has only 176 bytes
+// of DPRAM (USB buffers) and only endpoints 3 & 4 can double buffer.
+
+#define ENDPOINT0_SIZE                16
+#define CDC_ACM_ENDPOINT        2
+#define CDC_RX_ENDPOINT                3
+#define CDC_TX_ENDPOINT                4
+#if defined(__AVR_AT90USB162__)
+#define CDC_ACM_SIZE                16
+#define CDC_ACM_BUFFER                EP_SINGLE_BUFFER
+#define CDC_RX_SIZE                32
+#define CDC_RX_BUFFER                 EP_DOUBLE_BUFFER
+#define CDC_TX_SIZE                32
+#define CDC_TX_BUFFER                EP_DOUBLE_BUFFER
+#else
+#define CDC_ACM_SIZE                16
+#define CDC_ACM_BUFFER                EP_SINGLE_BUFFER
+#define CDC_RX_SIZE                64
+#define CDC_RX_BUFFER                 EP_DOUBLE_BUFFER
+#define CDC_TX_SIZE                64
+#define CDC_TX_BUFFER                EP_DOUBLE_BUFFER
+#endif
+
+static const uint8_t PROGMEM endpoint_config_table[] = {
+        0,
+        1, EP_TYPE_INTERRUPT_IN,  EP_SIZE(CDC_ACM_SIZE) | CDC_ACM_BUFFER,
+        1, EP_TYPE_BULK_OUT,      EP_SIZE(CDC_RX_SIZE) | CDC_RX_BUFFER,
+        1, EP_TYPE_BULK_IN,       EP_SIZE(CDC_TX_SIZE) | CDC_TX_BUFFER
+};
+
+
+/**************************************************************************
+ *
+ *  Descriptor Data
+ *
+ **************************************************************************/
+
+// Descriptors are the data that your computer reads when it auto-detects
+// this USB device (called "enumeration" in USB lingo).  The most commonly
+// changed items are editable at the top of this file.  Changing things
+// in here should only be done by those who've read chapter 9 of the USB
+// spec and relevant portions of any USB class specifications!
+
+static const uint8_t PROGMEM device_descriptor[] = {
+        18,                                        // bLength
+        1,                                        // bDescriptorType
+        0x00, 0x02,                                // bcdUSB
+        2,                                        // bDeviceClass
+        0,                                        // bDeviceSubClass
+        0,                                        // bDeviceProtocol
+        ENDPOINT0_SIZE,                                // bMaxPacketSize0
+        LSB(VENDOR_ID), MSB(VENDOR_ID),                // idVendor
+        LSB(PRODUCT_ID), MSB(PRODUCT_ID),        // idProduct
+        0x00, 0x01,                                // bcdDevice
+        1,                                        // iManufacturer
+        2,                                        // iProduct
+        3,                                        // iSerialNumber
+        1                                        // bNumConfigurations
+};
+
+#define CONFIG1_DESC_SIZE (9+9+5+5+4+5+7+9+7+7)
+static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = {
+        // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10
+        9,                                         // bLength;
+        2,                                        // bDescriptorType;
+        LSB(CONFIG1_DESC_SIZE),                        // wTotalLength
+        MSB(CONFIG1_DESC_SIZE),
+        2,                                        // bNumInterfaces
+        1,                                        // bConfigurationValue
+        0,                                        // iConfiguration
+        0xC0,                                        // bmAttributes
+        50,                                        // bMaxPower
+        // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
+        9,                                        // bLength
+        4,                                        // bDescriptorType
+        0,                                        // bInterfaceNumber
+        0,                                        // bAlternateSetting
+        1,                                        // bNumEndpoints
+        0x02,                                        // bInterfaceClass
+        0x02,                                        // bInterfaceSubClass
+        0x01,                                        // bInterfaceProtocol
+        0,                                        // iInterface
+        // CDC Header Functional Descriptor, CDC Spec 5.2.3.1, Table 26
+        5,                                        // bFunctionLength
+        0x24,                                        // bDescriptorType
+        0x00,                                        // bDescriptorSubtype
+        0x10, 0x01,                                // bcdCDC
+        // Call Management Functional Descriptor, CDC Spec 5.2.3.2, Table 27
+        5,                                        // bFunctionLength
+        0x24,                                        // bDescriptorType
+        0x01,                                        // bDescriptorSubtype
+        0x01,                                        // bmCapabilities
+        1,                                        // bDataInterface
+        // Abstract Control Management Functional Descriptor, CDC Spec 5.2.3.3, Table 28
+        4,                                        // bFunctionLength
+        0x24,                                        // bDescriptorType
+        0x02,                                        // bDescriptorSubtype
+        0x06,                                        // bmCapabilities
+        // Union Functional Descriptor, CDC Spec 5.2.3.8, Table 33
+        5,                                        // bFunctionLength
+        0x24,                                        // bDescriptorType
+        0x06,                                        // bDescriptorSubtype
+        0,                                        // bMasterInterface
+        1,                                        // bSlaveInterface0
+        // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
+        7,                                        // bLength
+        5,                                        // bDescriptorType
+        CDC_ACM_ENDPOINT | 0x80,                // bEndpointAddress
+        0x03,                                        // bmAttributes (0x03=intr)
+        CDC_ACM_SIZE, 0,                        // wMaxPacketSize
+        64,                                        // bInterval
+        // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12
+        9,                                        // bLength
+        4,                                        // bDescriptorType
+        1,                                        // bInterfaceNumber
+        0,                                        // bAlternateSetting
+        2,                                        // bNumEndpoints
+        0x0A,                                        // bInterfaceClass
+        0x00,                                        // bInterfaceSubClass
+        0x00,                                        // bInterfaceProtocol
+        0,                                        // iInterface
+        // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
+        7,                                        // bLength
+        5,                                        // bDescriptorType
+        CDC_RX_ENDPOINT,                        // bEndpointAddress
+        0x02,                                        // bmAttributes (0x02=bulk)
+        CDC_RX_SIZE, 0,                                // wMaxPacketSize
+        0,                                        // bInterval
+        // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13
+        7,                                        // bLength
+        5,                                        // bDescriptorType
+        CDC_TX_ENDPOINT | 0x80,                        // bEndpointAddress
+        0x02,                                        // bmAttributes (0x02=bulk)
+        CDC_TX_SIZE, 0,                                // wMaxPacketSize
+        0                                        // bInterval
+};
+
+// If you're desperate for a little extra code memory, these strings
+// can be completely removed if iManufacturer, iProduct, iSerialNumber
+// in the device desciptor are changed to zeros.
+struct usb_string_descriptor_struct {
+        uint8_t bLength;
+        uint8_t bDescriptorType;
+        int16_t wString[];
+};
+static const struct usb_string_descriptor_struct PROGMEM string0 = {
+        4,
+        3,
+        {0x0409}
+};
+static const struct usb_string_descriptor_struct PROGMEM string1 = {
+        sizeof(STR_MANUFACTURER),
+        3,
+        STR_MANUFACTURER
+};
+static const struct usb_string_descriptor_struct PROGMEM string2 = {
+        sizeof(STR_PRODUCT),
+        3,
+        STR_PRODUCT
+};
+static const struct usb_string_descriptor_struct PROGMEM string3 = {
+        sizeof(STR_SERIAL_NUMBER),
+        3,
+        STR_SERIAL_NUMBER
+};
+
+// This table defines which descriptor data is sent for each specific
+// request from the host (in wValue and wIndex).
+static const struct descriptor_list_struct {
+        uint16_t        wValue;
+        uint16_t        wIndex;
+        const uint8_t        *addr;
+        uint8_t                length;
+} PROGMEM descriptor_list[] = {
+        {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)},
+        {0x0200, 0x0000, config1_descriptor, sizeof(config1_descriptor)},
+        {0x0300, 0x0000, (const uint8_t *)&string0, 4},
+        {0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)},
+        {0x0302, 0x0409, (const uint8_t *)&string2, sizeof(STR_PRODUCT)},
+        {0x0303, 0x0409, (const uint8_t *)&string3, sizeof(STR_SERIAL_NUMBER)}
+};
+#define NUM_DESC_LIST (sizeof(descriptor_list)/sizeof(struct descriptor_list_struct))
+
+
+/**************************************************************************
+ *
+ *  Variables - these are the only non-stack RAM usage
+ *
+ **************************************************************************/
+
+// zero when we are not configured, non-zero when enumerated
+static volatile uint8_t usb_configuration=0;
+
+// the time remaining before we transmit any partially full
+// packet, or send a zero length packet.
+static volatile uint8_t transmit_flush_timer=0;
+static uint8_t transmit_previous_timeout=0;
+
+// serial port settings (baud rate, control signals, etc) set
+// by the PC.  These are ignored, but kept in RAM.
+static uint8_t cdc_line_coding[7]={0x00, 0xE1, 0x00, 0x00, 0x00, 0x00, 0x08};
+static uint8_t cdc_line_rtsdtr=0;
+
+
+/**************************************************************************
+ *
+ *  Public Functions - these are the API intended for the user
+ *
+ **************************************************************************/
+
+// initialize USB serial
+void usb_init(void)
+{
+        HW_CONFIG();
+        USB_FREEZE();                                // enable USB
+        PLL_CONFIG();                                // config PLL, 16 MHz xtal
+        while (!(PLLCSR & (1<<PLOCK))) ;        // wait for PLL lock
+        USB_CONFIG();                                // start USB clock
+        UDCON = 0;                                // enable attach resistor
+        usb_configuration = 0;
+        cdc_line_rtsdtr = 0;
+        UDIEN = (1<<EORSTE)|(1<<SOFE);
+        sei();
+}
+
+// return 0 if the USB is not configured, or the configuration
+// number selected by the HOST
+uint8_t usb_configured(void)
+{
+        return usb_configuration;
+}
+
+// get the next character, or -1 if nothing received
+int16_t usb_serial_getchar(void)
+{
+        uint8_t c, intr_state;
+
+        // interrupts are disabled so these functions can be
+        // used from the main program or interrupt context,
+        // even both in the same program!
+        intr_state = SREG;
+        cli();
+        if (!usb_configuration) {
+                SREG = intr_state;
+                return -1;
+        }
+        UENUM = CDC_RX_ENDPOINT;
+        retry:
+        c = UEINTX;
+        if (!(c & (1<<RWAL))) {
+                // no data in buffer
+                if (c & (1<<RXOUTI)) {
+                        UEINTX = 0x6B;
+                        goto retry;
+                }        
+                SREG = intr_state;
+                return -1;
+        }
+        // take one byte out of the buffer
+        c = UEDATX;
+        // if buffer completely used, release it
+        if (!(UEINTX & (1<<RWAL))) UEINTX = 0x6B;
+        SREG = intr_state;
+        return c;
+}
+
+// number of bytes available in the receive buffer
+uint8_t usb_serial_available(void)
+{
+        uint8_t n=0, i, intr_state;
+
+        intr_state = SREG;
+        cli();
+        if (usb_configuration) {
+                UENUM = CDC_RX_ENDPOINT;
+                n = UEBCLX;
+                if (!n) {
+                        i = UEINTX;
+                        if (i & (1<<RXOUTI) && !(i & (1<<RWAL))) UEINTX = 0x6B;
+                }
+        }
+        SREG = intr_state;
+        return n;
+}
+
+// discard any buffered input
+void usb_serial_flush_input(void)
+{
+        uint8_t intr_state;
+
+        if (usb_configuration) {
+                intr_state = SREG;
+                cli();
+                UENUM = CDC_RX_ENDPOINT;
+                while ((UEINTX & (1<<RWAL))) {
+                        UEINTX = 0x6B; 
+                }
+                SREG = intr_state;
+        }
+}
+
+// transmit a character.  0 returned on success, -1 on error
+int8_t usb_serial_putchar(uint8_t c)
+{
+        uint8_t timeout, intr_state;
+
+        // if we're not online (enumerated and configured), error
+        if (!usb_configuration) return -1;
+        // interrupts are disabled so these functions can be
+        // used from the main program or interrupt context,
+        // even both in the same program!
+        intr_state = SREG;
+        cli();
+        UENUM = CDC_TX_ENDPOINT;
+        // if we gave up due to timeout before, don't wait again
+        if (transmit_previous_timeout) {
+                if (!(UEINTX & (1<<RWAL))) {
+                        SREG = intr_state;
+                        return -1;
+                }
+                transmit_previous_timeout = 0;
+        }
+        // wait for the FIFO to be ready to accept data
+        timeout = UDFNUML + TRANSMIT_TIMEOUT;
+        while (1) {
+                // are we ready to transmit?
+                if (UEINTX & (1<<RWAL)) break;
+                SREG = intr_state;
+                // have we waited too long?  This happens if the user
+                // is not running an application that is listening
+                if (UDFNUML == timeout) {
+                        transmit_previous_timeout = 1;
+                        return -1;
+                }
+                // has the USB gone offline?
+                if (!usb_configuration) return -1;
+                // get ready to try checking again
+                intr_state = SREG;
+                cli();
+                UENUM = CDC_TX_ENDPOINT;
+        }
+        // actually write the byte into the FIFO
+        UEDATX = c;
+        // if this completed a packet, transmit it now!
+        if (!(UEINTX & (1<<RWAL))) UEINTX = 0x3A;
+        transmit_flush_timer = TRANSMIT_FLUSH_TIMEOUT;
+        SREG = intr_state;
+        return 0;
+}
+
+
+// transmit a character, but do not wait if the buffer is full,
+//   0 returned on success, -1 on buffer full or error 
+int8_t usb_serial_putchar_nowait(uint8_t c)
+{
+        uint8_t intr_state;
+
+        if (!usb_configuration) return -1;
+        intr_state = SREG;
+        cli();
+        UENUM = CDC_TX_ENDPOINT;
+        if (!(UEINTX & (1<<RWAL))) {
+                // buffer is full
+                SREG = intr_state;
+                return -1;
+        }
+        // actually write the byte into the FIFO
+        UEDATX = c;
+                // if this completed a packet, transmit it now!
+        if (!(UEINTX & (1<<RWAL))) UEINTX = 0x3A;
+        transmit_flush_timer = TRANSMIT_FLUSH_TIMEOUT;
+        SREG = intr_state;
+        return 0;
+}
+
+// transmit a buffer.
+//  0 returned on success, -1 on error
+// This function is optimized for speed!  Each call takes approx 6.1 us overhead
+// plus 0.25 us per byte.  12 Mbit/sec USB has 8.67 us per-packet overhead and
+// takes 0.67 us per byte.  If called with 64 byte packet-size blocks, this function
+// can transmit at full USB speed using 43% CPU time.  The maximum theoretical speed
+// is 19 packets per USB frame, or 1216 kbytes/sec.  However, bulk endpoints have the
+// lowest priority, so any other USB devices will likely reduce the speed.  Speed
+// can also be limited by how quickly the PC-based software reads data, as the host
+// controller in the PC will not allocate bandwitdh without a pending read request.
+// (thanks to Victor Suarez for testing and feedback and initial code)
+
+int8_t usb_serial_write(const uint8_t *buffer, uint16_t size)
+{
+        uint8_t timeout, intr_state, write_size;
+
+        // if we're not online (enumerated and configured), error
+        if (!usb_configuration) return -1;
+        // interrupts are disabled so these functions can be
+        // used from the main program or interrupt context,
+        // even both in the same program!
+        intr_state = SREG;
+        cli();
+        UENUM = CDC_TX_ENDPOINT;
+        // if we gave up due to timeout before, don't wait again
+        if (transmit_previous_timeout) {
+                if (!(UEINTX & (1<<RWAL))) {
+                        SREG = intr_state;
+                        return -1;
+                }
+                transmit_previous_timeout = 0;
+        }
+        // each iteration of this loop transmits a packet
+        while (size) {
+                // wait for the FIFO to be ready to accept data
+                timeout = UDFNUML + TRANSMIT_TIMEOUT;
+                while (1) {
+                        // are we ready to transmit?
+                        if (UEINTX & (1<<RWAL)) break;
+                        SREG = intr_state;
+                        // have we waited too long?  This happens if the user
+                        // is not running an application that is listening
+                        if (UDFNUML == timeout) {
+                                transmit_previous_timeout = 1;
+                                return -1;
+                        }
+                        // has the USB gone offline?
+                        if (!usb_configuration) return -1;
+                        // get ready to try checking again
+                        intr_state = SREG;
+                        cli();
+                        UENUM = CDC_TX_ENDPOINT;
+                }
+
+                // compute how many bytes will fit into the next packet
+                write_size = CDC_TX_SIZE - UEBCLX;
+                if (write_size > size) write_size = size;
+                size -= write_size;
+
+                // write the packet
+                switch (write_size) {
+                        #if (CDC_TX_SIZE == 64)
+                        case 64: UEDATX = *buffer++;
+                        case 63: UEDATX = *buffer++;
+                        case 62: UEDATX = *buffer++;
+                        case 61: UEDATX = *buffer++;
+                        case 60: UEDATX = *buffer++;
+                        case 59: UEDATX = *buffer++;
+                        case 58: UEDATX = *buffer++;
+                        case 57: UEDATX = *buffer++;
+                        case 56: UEDATX = *buffer++;
+                        case 55: UEDATX = *buffer++;
+                        case 54: UEDATX = *buffer++;
+                        case 53: UEDATX = *buffer++;
+                        case 52: UEDATX = *buffer++;
+                        case 51: UEDATX = *buffer++;
+                        case 50: UEDATX = *buffer++;
+                        case 49: UEDATX = *buffer++;
+                        case 48: UEDATX = *buffer++;
+                        case 47: UEDATX = *buffer++;
+                        case 46: UEDATX = *buffer++;
+                        case 45: UEDATX = *buffer++;
+                        case 44: UEDATX = *buffer++;
+                        case 43: UEDATX = *buffer++;
+                        case 42: UEDATX = *buffer++;
+                        case 41: UEDATX = *buffer++;
+                        case 40: UEDATX = *buffer++;
+                        case 39: UEDATX = *buffer++;
+                        case 38: UEDATX = *buffer++;
+                        case 37: UEDATX = *buffer++;
+                        case 36: UEDATX = *buffer++;
+                        case 35: UEDATX = *buffer++;
+                        case 34: UEDATX = *buffer++;
+                        case 33: UEDATX = *buffer++;
+                        #endif
+                        #if (CDC_TX_SIZE >= 32)
+                        case 32: UEDATX = *buffer++;
+                        case 31: UEDATX = *buffer++;
+                        case 30: UEDATX = *buffer++;
+                        case 29: UEDATX = *buffer++;
+                        case 28: UEDATX = *buffer++;
+                        case 27: UEDATX = *buffer++;
+                        case 26: UEDATX = *buffer++;
+                        case 25: UEDATX = *buffer++;
+                        case 24: UEDATX = *buffer++;
+                        case 23: UEDATX = *buffer++;
+                        case 22: UEDATX = *buffer++;
+                        case 21: UEDATX = *buffer++;
+                        case 20: UEDATX = *buffer++;
+                        case 19: UEDATX = *buffer++;
+                        case 18: UEDATX = *buffer++;
+                        case 17: UEDATX = *buffer++;
+                        #endif
+                        #if (CDC_TX_SIZE >= 16)
+                        case 16: UEDATX = *buffer++;
+                        case 15: UEDATX = *buffer++;
+                        case 14: UEDATX = *buffer++;
+                        case 13: UEDATX = *buffer++;
+                        case 12: UEDATX = *buffer++;
+                        case 11: UEDATX = *buffer++;
+                        case 10: UEDATX = *buffer++;
+                        case  9: UEDATX = *buffer++;
+                        #endif
+                        case  8: UEDATX = *buffer++;
+                        case  7: UEDATX = *buffer++;
+                        case  6: UEDATX = *buffer++;
+                        case  5: UEDATX = *buffer++;
+                        case  4: UEDATX = *buffer++;
+                        case  3: UEDATX = *buffer++;
+                        case  2: UEDATX = *buffer++;
+                        default:
+                        case  1: UEDATX = *buffer++;
+                        case  0: break;
+                }
+                // if this completed a packet, transmit it now!
+                if (!(UEINTX & (1<<RWAL))) UEINTX = 0x3A;
+                transmit_flush_timer = TRANSMIT_FLUSH_TIMEOUT;
+                SREG = intr_state;
+        }
+        return 0;
+}
+
+
+// immediately transmit any buffered output.
+// This doesn't actually transmit the data - that is impossible!
+// USB devices only transmit when the host allows, so the best
+// we can do is release the FIFO buffer for when the host wants it
+void usb_serial_flush_output(void)
+{
+        uint8_t intr_state;
+
+        intr_state = SREG;
+        cli();
+        if (transmit_flush_timer) {
+                UENUM = CDC_TX_ENDPOINT;
+                UEINTX = 0x3A;
+                transmit_flush_timer = 0;
+        }
+        SREG = intr_state;
+}
+
+// functions to read the various async serial settings.  These
+// aren't actually used by USB at all (communication is always
+// at full USB speed), but they are set by the host so we can
+// set them properly if we're converting the USB to a real serial
+// communication
+uint32_t usb_serial_get_baud(void)
+{
+        return *(uint32_t *)cdc_line_coding;
+}
+uint8_t usb_serial_get_stopbits(void)
+{
+        return cdc_line_coding[4];
+}
+uint8_t usb_serial_get_paritytype(void)
+{
+        return cdc_line_coding[5];
+}
+uint8_t usb_serial_get_numbits(void)
+{
+        return cdc_line_coding[6];
+}
+uint8_t usb_serial_get_control(void)
+{
+        return cdc_line_rtsdtr;
+}
+// write the control signals, DCD, DSR, RI, etc
+// There is no CTS signal.  If software on the host has transmitted
+// data to you but you haven't been calling the getchar function,
+// it remains buffered (either here or on the host) and can not be
+// lost because you weren't listening at the right time, like it
+// would in real serial communication.
+int8_t usb_serial_set_control(uint8_t signals)
+{
+        uint8_t intr_state;
+
+        intr_state = SREG;
+        cli();
+        if (!usb_configuration) {
+                // we're not enumerated/configured
+                SREG = intr_state;
+                return -1;
+        }
+
+        UENUM = CDC_ACM_ENDPOINT;
+        if (!(UEINTX & (1<<RWAL))) {
+                // unable to write
+                // TODO; should this try to abort the previously
+                // buffered message??
+                SREG = intr_state;
+                return -1;
+        }
+        UEDATX = 0xA1;
+        UEDATX = 0x20;
+        UEDATX = 0;
+        UEDATX = 0;
+        UEDATX = 0; // 0 seems to work nicely.  what if this is 1??
+        UEDATX = 0;
+        UEDATX = 1;
+        UEDATX = 0;
+        UEDATX = signals;
+        UEINTX = 0x3A;
+        SREG = intr_state;
+        return 0;
+}
+
+
+
+/**************************************************************************
+ *
+ *  Private Functions - not intended for general user consumption....
+ *
+ **************************************************************************/
+
+
+// USB Device Interrupt - handle all device-level events
+// the transmit buffer flushing is triggered by the start of frame
+//
+ISR(USB_GEN_vect)
+{
+        uint8_t intbits, t;
+
+        intbits = UDINT;
+        UDINT = 0;
+        if (intbits & (1<<EORSTI)) {
+                UENUM = 0;
+                UECONX = 1;
+                UECFG0X = EP_TYPE_CONTROL;
+                UECFG1X = EP_SIZE(ENDPOINT0_SIZE) | EP_SINGLE_BUFFER;
+                UEIENX = (1<<RXSTPE);
+                usb_configuration = 0;
+                cdc_line_rtsdtr = 0;
+        }
+        if (intbits & (1<<SOFI)) {
+                if (usb_configuration) {
+                        t = transmit_flush_timer;
+                        if (t) {
+                                transmit_flush_timer = --t;
+                                if (!t) {
+                                        UENUM = CDC_TX_ENDPOINT;
+                                        UEINTX = 0x3A;
+                                }
+                        }
+                }
+        }
+}
+
+
+// Misc functions to wait for ready and send/receive packets
+static inline void usb_wait_in_ready(void)
+{
+        while (!(UEINTX & (1<<TXINI))) ;
+}
+static inline void usb_send_in(void)
+{
+        UEINTX = ~(1<<TXINI);
+}
+static inline void usb_wait_receive_out(void)
+{
+        while (!(UEINTX & (1<<RXOUTI))) ;
+}
+static inline void usb_ack_out(void)
+{
+        UEINTX = ~(1<<RXOUTI);
+}
+
+
+
+// USB Endpoint Interrupt - endpoint 0 is handled here.  The
+// other endpoints are manipulated by the user-callable
+// functions, and the start-of-frame interrupt.
+//
+ISR(USB_COM_vect)
+{
+        uint8_t intbits;
+        const uint8_t *list;
+        const uint8_t *cfg;
+        uint8_t i, n, len, en;
+        uint8_t *p;
+        uint8_t bmRequestType;
+        uint8_t bRequest;
+        uint16_t wValue;
+        uint16_t wIndex;
+        uint16_t wLength;
+        uint16_t desc_val;
+        const uint8_t *desc_addr;
+        uint8_t        desc_length;
+
+        UENUM = 0;
+        intbits = UEINTX;
+        if (intbits & (1<<RXSTPI)) {
+                bmRequestType = UEDATX;
+                bRequest = UEDATX;
+                wValue = UEDATX;
+                wValue |= (UEDATX << 8);
+                wIndex = UEDATX;
+                wIndex |= (UEDATX << 8);
+                wLength = UEDATX;
+                wLength |= (UEDATX << 8);
+                UEINTX = ~((1<<RXSTPI) | (1<<RXOUTI) | (1<<TXINI));
+                if (bRequest == GET_DESCRIPTOR) {
+                        list = (const uint8_t *)descriptor_list;
+                        for (i=0; ; i++) {
+                                if (i >= NUM_DESC_LIST) {
+                                        UECONX = (1<<STALLRQ)|(1<<EPEN);  //stall
+                                        return;
+                                }
+                                desc_val = pgm_read_word(list);
+                                if (desc_val != wValue) {
+                                        list += sizeof(struct descriptor_list_struct);
+                                        continue;
+                                }
+                                list += 2;
+                                desc_val = pgm_read_word(list);
+                                if (desc_val != wIndex) {
+                                        list += sizeof(struct descriptor_list_struct)-2;
+                                        continue;
+                                }
+                                list += 2;
+                                desc_addr = (const uint8_t *)pgm_read_word(list);
+                                list += 2;
+                                desc_length = pgm_read_byte(list);
+                                break;
+                        }
+                        len = (wLength < 256) ? wLength : 255;
+                        if (len > desc_length) len = desc_length;
+                        do {
+                                // wait for host ready for IN packet
+                                do {
+                                        i = UEINTX;
+                                } while (!(i & ((1<<TXINI)|(1<<RXOUTI))));
+                                if (i & (1<<RXOUTI)) return;        // abort
+                                // send IN packet
+                                n = len < ENDPOINT0_SIZE ? len : ENDPOINT0_SIZE;
+                                for (i = n; i; i--) {
+                                        UEDATX = pgm_read_byte(desc_addr++);
+                                }
+                                len -= n;
+                                usb_send_in();
+                        } while (len || n == ENDPOINT0_SIZE);
+                        return;
+                }
+                if (bRequest == SET_ADDRESS) {
+                        usb_send_in();
+                        usb_wait_in_ready();
+                        UDADDR = wValue | (1<<ADDEN);
+                        return;
+                }
+                if (bRequest == SET_CONFIGURATION && bmRequestType == 0) {
+                        usb_configuration = wValue;
+                        cdc_line_rtsdtr = 0;
+                        transmit_flush_timer = 0;
+                        usb_send_in();
+                        cfg = endpoint_config_table;
+                        for (i=1; i<5; i++) {
+                                UENUM = i;
+                                en = pgm_read_byte(cfg++);
+                                UECONX = en;
+                                if (en) {
+                                        UECFG0X = pgm_read_byte(cfg++);
+                                        UECFG1X = pgm_read_byte(cfg++);
+                                }
+                        }
+                        UERST = 0x1E;
+                        UERST = 0;
+                        return;
+                }
+                if (bRequest == GET_CONFIGURATION && bmRequestType == 0x80) {
+                        usb_wait_in_ready();
+                        UEDATX = usb_configuration;
+                        usb_send_in();
+                        return;
+                }
+                if (bRequest == CDC_GET_LINE_CODING && bmRequestType == 0xA1) {
+                        usb_wait_in_ready();
+                        p = cdc_line_coding;
+                        for (i=0; i<7; i++) {
+                                UEDATX = *p++;
+                        }
+                        usb_send_in();
+                        return;
+                }
+                if (bRequest == CDC_SET_LINE_CODING && bmRequestType == 0x21) {
+                        usb_wait_receive_out();
+                        p = cdc_line_coding;
+                        for (i=0; i<7; i++) {
+                                *p++ = UEDATX;
+                        }
+                        usb_ack_out();
+                        usb_send_in();
+                        return;
+                }
+                if (bRequest == CDC_SET_CONTROL_LINE_STATE && bmRequestType == 0x21) {
+                        cdc_line_rtsdtr = wValue;
+                        usb_wait_in_ready();
+                        usb_send_in();
+                        return;
+                }
+                if (bRequest == GET_STATUS) {
+                        usb_wait_in_ready();
+                        i = 0;
+                        #ifdef SUPPORT_ENDPOINT_HALT
+                        if (bmRequestType == 0x82) {
+                                UENUM = wIndex;
+                                if (UECONX & (1<<STALLRQ)) i = 1;
+                                UENUM = 0;
+                        }
+                        #endif
+                        UEDATX = i;
+                        UEDATX = 0;
+                        usb_send_in();
+                        return;
+                }
+                #ifdef SUPPORT_ENDPOINT_HALT
+                if ((bRequest == CLEAR_FEATURE || bRequest == SET_FEATURE)
+                  && bmRequestType == 0x02 && wValue == 0) {
+                        i = wIndex & 0x7F;
+                        if (i >= 1 && i <= MAX_ENDPOINT) {
+                                usb_send_in();
+                                UENUM = i;
+                                if (bRequest == SET_FEATURE) {
+                                        UECONX = (1<<STALLRQ)|(1<<EPEN);
+                                } else {
+                                        UECONX = (1<<STALLRQC)|(1<<RSTDT)|(1<<EPEN);
+                                        UERST = (1 << i);
+                                        UERST = 0;
+                                }
+                                return;
+                        }
+                }
+                #endif
+        }
+        UECONX = (1<<STALLRQ) | (1<<EPEN);        // stall
+}
+
+
diff --git a/atmega32u4/stepmotorcontroller/usb_serial.h b/atmega32u4/stepmotorcontroller/usb_serial.h
new file mode 100644 (file)
index 0000000..14c5b1a
--- /dev/null
@@ -0,0 +1,124 @@
+#ifndef usb_serial_h__
+#define usb_serial_h__
+
+#include <stdint.h>
+
+// setup
+void usb_init(void);                   // initialize everything
+uint8_t usb_configured(void);          // is the USB port configured
+
+// receiving data
+int16_t usb_serial_getchar(void);      // receive a character (-1 if timeout/error)
+uint8_t usb_serial_available(void);    // number of bytes in receive buffer
+void usb_serial_flush_input(void);     // discard any buffered input
+
+// transmitting data
+int8_t usb_serial_putchar(uint8_t c);  // transmit a character
+int8_t usb_serial_putchar_nowait(uint8_t c);  // transmit a character, do not wait
+int8_t usb_serial_write(const uint8_t *buffer, uint16_t size); // transmit a buffer
+void usb_serial_flush_output(void);    // immediately transmit any buffered output
+
+// serial parameters
+uint32_t usb_serial_get_baud(void);    // get the baud rate
+uint8_t usb_serial_get_stopbits(void); // get the number of stop bits
+uint8_t usb_serial_get_paritytype(void);// get the parity type
+uint8_t usb_serial_get_numbits(void);  // get the number of data bits
+uint8_t usb_serial_get_control(void);  // get the RTS and DTR signal state
+int8_t usb_serial_set_control(uint8_t signals); // set DSR, DCD, RI, etc
+
+// constants corresponding to the various serial parameters
+#define USB_SERIAL_DTR                 0x01
+#define USB_SERIAL_RTS                 0x02
+#define USB_SERIAL_1_STOP              0
+#define USB_SERIAL_1_5_STOP            1
+#define USB_SERIAL_2_STOP              2
+#define USB_SERIAL_PARITY_NONE         0
+#define USB_SERIAL_PARITY_ODD          1
+#define USB_SERIAL_PARITY_EVEN         2
+#define USB_SERIAL_PARITY_MARK         3
+#define USB_SERIAL_PARITY_SPACE                4
+#define USB_SERIAL_DCD                 0x01
+#define USB_SERIAL_DSR                 0x02
+#define USB_SERIAL_BREAK               0x04
+#define USB_SERIAL_RI                  0x08
+#define USB_SERIAL_FRAME_ERR           0x10
+#define USB_SERIAL_PARITY_ERR          0x20
+#define USB_SERIAL_OVERRUN_ERR         0x40
+
+// This file does not include the HID debug functions, so these empty
+// macros replace them with nothing, so users can compile code that
+// has calls to these functions.
+#define usb_debug_putchar(c)
+#define usb_debug_flush_output()
+
+
+
+// Everything below this point is only intended for usb_serial.c
+#ifdef USB_SERIAL_PRIVATE_INCLUDE
+#include <avr/io.h>
+#include <avr/pgmspace.h>
+#include <avr/interrupt.h>
+
+#define EP_TYPE_CONTROL                        0x00
+#define EP_TYPE_BULK_IN                        0x81
+#define EP_TYPE_BULK_OUT               0x80
+#define EP_TYPE_INTERRUPT_IN           0xC1
+#define EP_TYPE_INTERRUPT_OUT          0xC0
+#define EP_TYPE_ISOCHRONOUS_IN         0x41
+#define EP_TYPE_ISOCHRONOUS_OUT                0x40
+#define EP_SINGLE_BUFFER               0x02
+#define EP_DOUBLE_BUFFER               0x06
+#define EP_SIZE(s)     ((s) == 64 ? 0x30 :     \
+                       ((s) == 32 ? 0x20 :     \
+                       ((s) == 16 ? 0x10 :     \
+                                    0x00)))
+
+#define MAX_ENDPOINT           4
+
+#define LSB(n) (n & 255)
+#define MSB(n) ((n >> 8) & 255)
+
+#if defined(__AVR_AT90USB162__)
+#define HW_CONFIG() 
+#define PLL_CONFIG() (PLLCSR = ((1<<PLLE)|(1<<PLLP0)))
+#define USB_CONFIG() (USBCON = (1<<USBE))
+#define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
+#elif defined(__AVR_ATmega32U4__)
+#define HW_CONFIG() (UHWCON = 0x01)
+#define PLL_CONFIG() (PLLCSR = 0x12)
+#define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE)))
+#define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
+#elif defined(__AVR_AT90USB646__)
+#define HW_CONFIG() (UHWCON = 0x81)
+#define PLL_CONFIG() (PLLCSR = 0x1A)
+#define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE)))
+#define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
+#elif defined(__AVR_AT90USB1286__)
+#define HW_CONFIG() (UHWCON = 0x81)
+#define PLL_CONFIG() (PLLCSR = 0x16)
+#define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE)))
+#define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK)))
+#endif
+
+// standard control endpoint request types
+#define GET_STATUS                     0
+#define CLEAR_FEATURE                  1
+#define SET_FEATURE                    3
+#define SET_ADDRESS                    5
+#define GET_DESCRIPTOR                 6
+#define GET_CONFIGURATION              8
+#define SET_CONFIGURATION              9
+#define GET_INTERFACE                  10
+#define SET_INTERFACE                  11
+// HID (human interface device)
+#define HID_GET_REPORT                 1
+#define HID_GET_PROTOCOL               3
+#define HID_SET_REPORT                 9
+#define HID_SET_IDLE                   10
+#define HID_SET_PROTOCOL               11
+// CDC (communication class device)
+#define CDC_SET_LINE_CODING            0x20
+#define CDC_GET_LINE_CODING            0x21
+#define CDC_SET_CONTROL_LINE_STATE     0x22
+#endif
+#endif