summaryrefslogtreecommitdiffstats
path: root/stm32
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2020-06-18 13:26:56 +0100
committerfishsoupisgood <github@madingley.org>2020-06-18 13:26:56 +0100
commite41764fceeabb1cdb6a7a299e00f2166a6f6ac32 (patch)
treec58c73d742bf990ec692d61ca8d911dd43fab8c6 /stm32
parentf7b7cf9e80200cade938d47527e39034c75b9b6d (diff)
downloadrobs_speedo-e41764fceeabb1cdb6a7a299e00f2166a6f6ac32.tar.gz
robs_speedo-e41764fceeabb1cdb6a7a299e00f2166a6f6ac32.tar.bz2
robs_speedo-e41764fceeabb1cdb6a7a299e00f2166a6f6ac32.zip
moved stm32 into directory added noddy pcb
Diffstat (limited to 'stm32')
-rw-r--r--stm32/Makefile8
-rw-r--r--stm32/Makefile.include45
-rw-r--r--stm32/Makefile.rules261
-rw-r--r--stm32/app/.gitignore5
-rw-r--r--stm32/app/Makefile69
-rw-r--r--stm32/app/font21x32.c135
-rw-r--r--stm32/app/font8x16.c1071
-rw-r--r--stm32/app/font8x8.c288
-rw-r--r--stm32/app/gauge.c161
-rw-r--r--stm32/app/gdb.script2
-rw-r--r--stm32/app/i2c.c21
-rw-r--r--stm32/app/i2c.h2
-rw-r--r--stm32/app/i2c_hw.c360
-rw-r--r--stm32/app/led.c42
-rw-r--r--stm32/app/main.c85
-rw-r--r--stm32/app/not/i2c_bb.c164
-rw-r--r--stm32/app/not/lcd.c477
-rw-r--r--stm32/app/oled.c190
-rw-r--r--stm32/app/oled.h49
-rw-r--r--stm32/app/oled1.c124
-rw-r--r--stm32/app/oled2.c124
-rw-r--r--stm32/app/pins.h55
-rw-r--r--stm32/app/project.h42
-rw-r--r--stm32/app/prototypes.h92
-rw-r--r--stm32/app/ring.c69
-rw-r--r--stm32/app/ring.h6
-rw-r--r--stm32/app/speedo.ld38
-rw-r--r--stm32/app/tacho.c66
-rw-r--r--stm32/app/tacho.h5
-rw-r--r--stm32/app/ticker.c75
-rw-r--r--stm32/app/usart.c119
-rw-r--r--stm32/doc/cs32g103.pdfbin0 -> 3091285 bytes
-rw-r--r--stm32/doc/rm0008.pdfbin0 -> 13016697 bytes
-rw-r--r--stm32/doc/stm32f103c8.pdfbin0 -> 1697666 bytes
-rw-r--r--stm32/doc/stm32f103c8t6_pinout_voltage01.pngbin0 -> 679565 bytes
m---------stm32/libopencm30
36 files changed, 4250 insertions, 0 deletions
diff --git a/stm32/Makefile b/stm32/Makefile
new file mode 100644
index 0000000..e1cd497
--- /dev/null
+++ b/stm32/Makefile
@@ -0,0 +1,8 @@
+
+default:
+ make -C libopencm3
+ make -C app
+
+clean:
+ make -C libopencm3 clean
+ make -C app clean
diff --git a/stm32/Makefile.include b/stm32/Makefile.include
new file mode 100644
index 0000000..636c314
--- /dev/null
+++ b/stm32/Makefile.include
@@ -0,0 +1,45 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
+##
+## This library is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this library. If not, see <http://www.gnu.org/licenses/>.
+##
+
+LIBNAME = opencm3_stm32f1
+DEFS = -DSTM32F1
+
+FP_FLAGS ?= -msoft-float
+ARCH_FLAGS = -mthumb -mcpu=cortex-m3 $(FP_FLAGS) -mfix-cortex-m3-ldrd
+
+################################################################################
+# OpenOCD specific variables
+
+OOCD ?= openocd
+OOCD_INTERFACE ?= interface/stlink-v2.cfg
+#OOCD_BOARD = ../target/stm32f103.cfg
+OOCD_BOARD ?= target/stm32f1x.cfg
+
+################################################################################
+# Black Magic Probe specific variables
+# Set the BMP_PORT to a serial port and then BMP is used for flashing
+BMP_PORT ?=
+
+################################################################################
+# texane/stlink specific variables
+#STLINK_PORT ?= :4242
+
+
+include ../Makefile.rules
diff --git a/stm32/Makefile.rules b/stm32/Makefile.rules
new file mode 100644
index 0000000..ec27405
--- /dev/null
+++ b/stm32/Makefile.rules
@@ -0,0 +1,261 @@
+#
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2010 Piotr Esden-Tempski <piotr@esden.net>
+## Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
+##
+## This library is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this library. If not, see <http://www.gnu.org/licenses/>.
+##
+
+# Be silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
+NULL := 2>/dev/null
+endif
+
+###############################################################################
+# Executables
+
+PREFIX ?= arm-none-eabi
+
+CC := $(PREFIX)-gcc
+CXX := $(PREFIX)-g++
+LD := $(PREFIX)-gcc
+AR := $(PREFIX)-ar
+AS := $(PREFIX)-as
+OBJCOPY := $(PREFIX)-objcopy
+OBJDUMP := $(PREFIX)-objdump
+GDB := $(PREFIX)-gdb
+STFLASH = $(shell which st-flash)
+STYLECHECK := /checkpatch.pl
+STYLECHECKFLAGS := --no-tree -f --terse --mailback
+STYLECHECKFILES := $(shell find . -name '*.[ch]')
+
+
+###############################################################################
+# Source files
+
+LDSCRIPT ?= $(BINARY).ld
+
+#OBJS += $(BINARY).o
+
+
+ifeq ($(strip $(OPENCM3_DIR)),)
+# user has not specified the library path, so we try to detect it
+
+# where we search for the library
+LIBPATHS := ./libopencm3 ../libopencm3
+
+OPENCM3_DIR := $(wildcard $(LIBPATHS:=/locm3.sublime-project))
+OPENCM3_DIR := $(firstword $(dir $(OPENCM3_DIR)))
+
+ifeq ($(strip $(OPENCM3_DIR)),)
+$(warning Cannot find libopencm3 library in the standard search paths.)
+$(error Please specify it through OPENCM3_DIR variable!)
+endif
+endif
+
+ifeq ($(V),1)
+$(info Using $(OPENCM3_DIR) path to library)
+endif
+
+INCLUDE_DIR = $(OPENCM3_DIR)/include
+LIB_DIR = $(OPENCM3_DIR)/lib
+SCRIPT_DIR = $(OPENCM3_DIR)/scripts
+
+###############################################################################
+# C flags
+
+CFLAGS += -Os -g
+CFLAGS += -Wextra -Wimplicit-function-declaration
+CFLAGS += -Wmissing-prototypes -Wstrict-prototypes
+CFLAGS += -fno-common -ffunction-sections -fdata-sections
+
+###############################################################################
+# C++ flags
+
+CXXFLAGS += -Os -g
+CXXFLAGS += -Wextra -Wshadow -Wredundant-decls -Weffc++
+CXXFLAGS += -fno-common -ffunction-sections -fdata-sections
+
+###############################################################################
+# C & C++ preprocessor common flags
+
+CPPFLAGS += -MD
+CPPFLAGS += -Wall -Wundef
+
+INCLUDES = -I$(INCLUDE_DIR)
+DEFINES = $(DEFS)
+
+CPPFLAGS += $(INCLUDES) $(DEFINES)
+
+###############################################################################
+# Linker flags
+
+LDFLAGS += --static -nostartfiles
+LDFLAGS += -L$(LIB_DIR)
+LDFLAGS += -T$(LDSCRIPT)
+LDFLAGS += -Wl,-Map=$(*).map
+LDFLAGS += -Wl,--gc-sections
+ifeq ($(V),99)
+LDFLAGS += -Wl,--print-gc-sections
+endif
+
+###############################################################################
+# Used libraries
+
+LDLIBS += -l$(LIBNAME)
+LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group
+
+###############################################################################
+###############################################################################
+###############################################################################
+
+.SUFFIXES: .elf .bin .hex .srec .list .map .images .dfu
+.SECONDEXPANSION:
+.SECONDARY:
+
+all: elf
+
+
+elf: $(BINARY).elf
+bin: $(BINARY).bin
+hex: $(BINARY).hex
+srec: $(BINARY).srec
+list: $(BINARY).list
+
+images: $(BINARY).images
+flash: $(BINARY).flash
+
+%.images: %.bin %.hex %.srec %.list %.map %.dfu
+ @#printf "*** $* images generated ***\n"
+
+%.bin: %.elf
+ @#printf " OBJCOPY $(*).bin\n"
+ $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).bin
+
+%.hex: %.elf
+ @#printf " OBJCOPY $(*).hex\n"
+ $(Q)$(OBJCOPY) -Oihex $(*).elf $(*).hex
+
+%.dfu: %.elf
+ @#printf " OBJCOPY $(*).dfu\n"
+ $(Q)$(OBJCOPY) -Obinary $(*).elf $(*).dfu
+
+%.srec: %.elf
+ @#printf " OBJCOPY $(*).srec\n"
+ $(Q)$(OBJCOPY) -Osrec $(*).elf $(*).srec
+
+%.list: %.elf
+ @#printf " OBJDUMP $(*).list\n"
+ $(Q)$(OBJDUMP) -S $(*).elf > $(*).list
+
+fish:
+ echo %.elf %.map: $(OBJS) $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a
+ echo $(BINARY).elf
+
+%.elf %.map: $(OBJS) $(LDSCRIPT) $(LIB_DIR)/lib$(LIBNAME).a
+ @#printf " LD $(*).elf\n"
+ $(Q)$(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(*).elf
+
+%.o: %.c $(OPENCM3_DIR)/../opencm3.build.stamp
+ @#printf " CC $(*).c\n"
+ $(Q)$(CC) $(CFLAGS) $(CPPFLAGS) $(ARCH_FLAGS) -o $(*).o -c $(*).c
+
+%.o: %.cxx $(OPENCM3_DIR)/../opencm3.build.stamp
+ @#printf " CXX $(*).cxx\n"
+ $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(ARCH_FLAGS) -o $(*).o -c $(*).cxx
+
+%.o: %.cpp $(OPENCM3_DIR)/../opencm3.build.stamp
+ @#printf " CXX $(*).cpp\n"
+ $(Q)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(ARCH_FLAGS) -o $(*).o -c $(*).cpp
+
+clean:
+ @#printf " CLEAN\n"
+ $(Q)$(RM) *.o *.d *.elf *.bin *.hex *.srec *.list *.map *~ *.dfu ${EXTRACLEANS} *.orig *~
+
+stylecheck: $(STYLECHECKFILES:=.stylecheck)
+styleclean: $(STYLECHECKFILES:=.styleclean)
+
+# the cat is due to multithreaded nature - we like to have consistent chunks of text on the output
+%.stylecheck: %
+ $(Q)$(SCRIPT_DIR)$(STYLECHECK) $(STYLECHECKFLAGS) $* > $*.stylecheck; \
+ if [ -s $*.stylecheck ]; then \
+ cat $*.stylecheck; \
+ else \
+ rm -f $*.stylecheck; \
+ fi;
+
+%.styleclean:
+ $(Q)rm -f $*.stylecheck;
+
+
+%.stlink-flash: %.bin
+ @printf " FLASH $<\n"
+ $(Q)$(STFLASH) write $(*).bin 0x8000000
+
+ifeq ($(STLINK_PORT),)
+ifeq ($(BMP_PORT),)
+ifeq ($(OOCD_SERIAL),)
+%.flash: %.hex
+ @printf " FLASH $<\n"
+ @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
+ $(Q)$(OOCD) -f $(OOCD_INTERFACE) \
+ -f $(OOCD_BOARD) \
+ -c "init" -c "reset init" \
+ -c "flash write_image erase $(*).hex" \
+ -c "reset" \
+ -c "shutdown" $(NULL)
+else
+%.flash: %.hex
+ @printf " FLASH $<\n"
+ @# IMPORTANT: Don't use "resume", only "reset" will work correctly!
+ $(Q)$(OOCD) -f $(OOCD_INTERFACE) \
+ -f $(OOCD_BOARD) \
+ -c "ft2232_serial $(OOCD_SERIAL)" \
+ -c "init" -c "reset init" \
+ -c "flash write_image erase $(*).hex" \
+ -c "reset" \
+ -c "shutdown" $(NULL)
+endif
+else
+%.flash: %.elf
+ @printf " GDB $(*).elf (flash)\n"
+ $(Q)$(GDB) --batch \
+ -ex 'target extended-remote $(BMP_PORT)' \
+ -x $(SCRIPT_DIR)/black_magic_probe_flash.scr \
+ $(*).elf
+endif
+else
+%.flash: %.elf
+ @printf " GDB $(*).elf (flash)\n"
+ $(Q)$(GDB) --batch \
+ -ex 'target extended-remote $(STLINK_PORT)' \
+ -x $(SCRIPT_DIR)/stlink_flash.scr \
+ $(*).elf
+endif
+
+.PHONY: images clean stylecheck styleclean elf bin hex srec list
+
+-include $(OBJS:.o=.d)
+
+
+$(LIB_DIR)/lib$(LIBNAME).a: $(OPENCM3_DIR)/../opencm3.build.stamp
+
+
+$(OPENCM3_DIR)/../opencm3.build.stamp:
+ ${MAKE} -C ${OPENCM3_DIR}
+ touch $@
+
diff --git a/stm32/app/.gitignore b/stm32/app/.gitignore
new file mode 100644
index 0000000..6d83155
--- /dev/null
+++ b/stm32/app/.gitignore
@@ -0,0 +1,5 @@
+*.d
+*.o
+*.elf
+*.map
+*.hex
diff --git a/stm32/app/Makefile b/stm32/app/Makefile
new file mode 100644
index 0000000..f50e524
--- /dev/null
+++ b/stm32/app/Makefile
@@ -0,0 +1,69 @@
+##
+## This file is part of the libopencm3 project.
+##
+## Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## This library is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public License
+## along with this library. If not, see <http://www.gnu.org/licenses/>.
+##
+
+CPROTO=cproto
+PROG=speedo
+
+V=1
+default: ${PROG}.elf
+
+CSRCS=main.c led.c i2c.c usart.c ring.c ticker.c oled.c i2c_hw.c font8x8.c font8x16.c tacho.c oled1.c oled2.c font21x32.c gauge.c
+
+HSRCS=i2c.h oled.h project.h ring.h
+
+BINARY = ${PROG}
+OBJS = ${CSRCS:%.c=%.o}
+
+
+include ../Makefile.include
+
+tidy:
+ indent -i2 -ts0 ${CSRCS} ${HSRCS}
+
+#INCLUDES += -I..
+
+#dfu:${PROG}.dfu
+# dfu-util -R -a 0 -d 1d6b:${DID} -s 0x08002000:leave -D $<
+
+program: ${PROG}.hex
+ echo init | nc -t localhost 4444
+ echo reset init | nc -t localhost 4444
+ echo flash write_image erase ${PWD}/$< | nc -t localhost 4444
+ echo reset run | nc -t localhost 4444
+
+ds:
+ $(Q)$(OOCD) -f $(OOCD_INTERFACE) \
+ -f $(OOCD_BOARD)
+
+debug: ${PROG}.elf
+ ${PREFIX}-gdb -x gdb.script ${PROG}.elf
+# openocd
+
+protos: ${CSRCS}
+ echo -n > prototypes.h
+ ${CPROTO} $(INCLUDES) $(DEFINES) -e -v ${CSRCS} > prototypes.h.tmp
+ mv -f prototypes.h.tmp prototypes.h
+
+tidy:
+# indent -i2 -ts0 ${CSRCS} ${HSRCS}
+ astyle -A3 -s2 --attach-extern-c -L -c -w -Y -m0 -f -p -H -U -k3 -xj -xd ${CSRCS} ${HSRCS}
+
+
+#${OBJCOPY} -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata.almanac,alloc,load,readonly,data,contents $< $@
+
diff --git a/stm32/app/font21x32.c b/stm32/app/font21x32.c
new file mode 100644
index 0000000..476af5e
--- /dev/null
+++ b/stm32/app/font21x32.c
@@ -0,0 +1,135 @@
+#include "project.h"
+
+static const uint8_t font21x32[][84] = {
+ {
+ 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, 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, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
+ 0xfc, 0xfe, 0xff, 0x07, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x0f,
+ 0xff, 0xfe, 0xfc, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x7f, 0xff,
+ 0xe0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xf8, 0xff, 0x7f, 0x3f,
+ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x01, 0x01, 0x01, 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,
+ 0x06, 0x06, 0x06, 0x06, 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0,
+ 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0,
+ 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, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
+ 0x1e, 0x1f, 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x83, 0xc7, 0xff,
+ 0xff, 0xfe, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xe0, 0xf0,
+ 0xf0, 0xf8, 0xfc, 0xf4, 0xf6, 0xf3, 0xf3, 0xf1, 0xf1, 0xf1, 0xf0, 0xfc,
+ 0x04, 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, 0x80, 0x80, 0x80, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x3c, 0x7e, 0x7f, 0x7b, 0x11, 0x01, 0x01, 0x01, 0x01, 0x83, 0xff, 0xff,
+ 0xfe, 0xfe, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x04, 0x04, 0x04, 0x04, 0x0e, 0x0f, 0x3b, 0xfb, 0xf9, 0xf0, 0xe0,
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x3f, 0x6f, 0x6e, 0x40, 0xc0,
+ 0xc0, 0xc0, 0xc0, 0x60, 0x78, 0x7f, 0x3f, 0x3f, 0x1f, 0x07, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x38, 0x0c, 0xfe, 0xff, 0xff,
+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xdc, 0xc6,
+ 0xc3, 0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xc0,
+ 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0x60, 0x60, 0x60, 0x7f, 0x7f, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x07,
+ 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x8f, 0x8f,
+ 0x06, 0x02, 0x03, 0x03, 0x01, 0x03, 0x03, 0x1e, 0xfe, 0xfc, 0xfc, 0xf0,
+ 0xc0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x37, 0x67, 0x63, 0x40, 0xc0,
+ 0xc0, 0xc0, 0x40, 0x60, 0x78, 0x7f, 0x3f, 0x1f, 0x0f, 0x01, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xe0, 0xf0, 0xf8, 0xfc, 0x1e, 0x06, 0x02, 0x03, 0x03,
+ 0x03, 0x03, 0x3b, 0x7e, 0x7e, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0x0c, 0x06, 0x02, 0x02, 0x02, 0x02, 0x06, 0xfe,
+ 0xfc, 0xf8, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x7f,
+ 0xff, 0xc0, 0xc0, 0x80, 0x80, 0x80, 0x80, 0xc0, 0xff, 0x7f, 0x7f, 0x1f,
+ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff,
+ 0x1f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xcf, 0xef, 0x7f,
+ 0x3f, 0x0f, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xc0, 0xf0, 0xfc, 0xfe, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xff, 0xff,
+ 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xf0, 0xfc, 0xfe, 0xc2, 0x82, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x06, 0xfe, 0xfc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0xc1, 0xe7, 0xef, 0x3f, 0x1f, 0x1f, 0x3f, 0x3e, 0x7e, 0xfc, 0xfe, 0xfb,
+ 0xfb, 0xf1, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x7f, 0x7f, 0xe0,
+ 0xc0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc1, 0x63, 0x7f, 0x3f,
+ 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
+ 0xfc, 0xfe, 0xfe, 0xff, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, 0xff,
+ 0xfe, 0xfc, 0xf8, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0f, 0x1f, 0x3f,
+ 0x7f, 0x60, 0x40, 0x40, 0x40, 0x40, 0x20, 0x18, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x7e, 0x5c, 0xc0, 0xc0,
+ 0xc0, 0x40, 0x60, 0x70, 0x38, 0x3f, 0x1f, 0x0f, 0x03, 0x00, 0x00, 0x00,
+ },
+};
+
+
+
+/* this can be budget, since it can only fit one way vertically*/
+
+void
+font21x32_put_ch (uint8_t *vram, unsigned ch, unsigned x)
+{
+ if ((ch >= '0') && (ch <= '9'))
+ ch -= '0' - 1;
+ else
+ ch = 0;
+
+
+ oled_blit_strip (vram, x, x + 21, 0xff, 0, font21x32[ch]);
+ x += SSD1306_WIDTH;
+ oled_blit_strip (vram, x, x + 21, 0xff, 0, &font21x32[ch][21]);
+ x += SSD1306_WIDTH;
+ oled_blit_strip (vram, x, x + 21, 0xff, 0, &font21x32[ch][42]);
+ x += SSD1306_WIDTH;
+ oled_blit_strip (vram, x, x + 21, 0xff, 0, &font21x32[ch][63]);
+}
+
+
+void
+font21x32_put_str (uint8_t *vram, char *str, unsigned x)
+{
+ while (*str) {
+ font21x32_put_ch (vram, * (str++), x);
+ x += 21;
+ }
+}
diff --git a/stm32/app/font8x16.c b/stm32/app/font8x16.c
new file mode 100644
index 0000000..4e3b5d6
--- /dev/null
+++ b/stm32/app/font8x16.c
@@ -0,0 +1,1071 @@
+#include "project.h"
+
+static const uint8_t font8x16[][16] = {
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xf0, 0x08, 0x48, 0x08, 0x08, 0x48, 0x08, 0xf0, 0x3f, 0x40, 0x44, 0x4c,
+ 0x4c, 0x44, 0x40, 0x3f,
+ },
+ {
+ 0xf0, 0xf8, 0xb8, 0xf8, 0xf8, 0xb8, 0xf8, 0xf0, 0x3f, 0x7f, 0x7b, 0x73,
+ 0x73, 0x7b, 0x7f, 0x3f,
+ },
+ {
+ 0x80, 0xc0, 0xc0, 0x80, 0xc0, 0xc0, 0x80, 0x00, 0x0f, 0x1f, 0x3f, 0x7f,
+ 0x3f, 0x1f, 0x0f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x06, 0x0f, 0x1f, 0x3f,
+ 0x1f, 0x0f, 0x06, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xe0, 0xf0, 0xf0, 0xe0, 0x00, 0x00, 0x0f, 0x0f, 0x4f, 0x70,
+ 0x70, 0x4f, 0x0f, 0x0f,
+ },
+ {
+ 0x00, 0x80, 0xc0, 0xf0, 0xf0, 0xc0, 0x80, 0x00, 0x07, 0x0f, 0x4f, 0x7f,
+ 0x7f, 0x4f, 0x0f, 0x07,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0f,
+ 0x0f, 0x07, 0x00, 0x00,
+ },
+ {
+ 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf0,
+ 0xf0, 0xf8, 0xff, 0xff,
+ },
+ {
+ 0x00, 0x80, 0xc0, 0x40, 0x40, 0xc0, 0x80, 0x00, 0x00, 0x0f, 0x18, 0x10,
+ 0x10, 0x18, 0x0f, 0x00,
+ },
+ {
+ 0xff, 0x7f, 0x3f, 0xbf, 0xbf, 0x3f, 0x7f, 0xff, 0xff, 0xf0, 0xe7, 0xef,
+ 0xef, 0xe7, 0xf0, 0xff,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xc8, 0x68, 0x38, 0x78, 0x00, 0x3e, 0x7f, 0x41, 0x41,
+ 0x7f, 0x3e, 0x00, 0x00,
+ },
+ {
+ 0x00, 0xf0, 0xf8, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x00, 0x13, 0x17, 0x7c,
+ 0x7c, 0x17, 0x13, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xf8, 0xf8, 0x48, 0x48, 0x78, 0x78, 0x60, 0x70, 0x7f, 0x3f,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0xf8, 0xf8, 0x48, 0x48, 0x48, 0xf8, 0xf8, 0xe0, 0xff, 0x7f, 0x00,
+ 0x00, 0x70, 0x7f, 0x3f,
+ },
+ {
+ 0x80, 0x80, 0x00, 0xe0, 0xe0, 0x00, 0x80, 0x80, 0x16, 0x16, 0x0f, 0x79,
+ 0x79, 0x0f, 0x16, 0x16,
+ },
+ {
+ 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x7f, 0x3f, 0x1f, 0x0f,
+ 0x07, 0x03, 0x03, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0x00, 0x03, 0x03, 0x07, 0x0f,
+ 0x1f, 0x3f, 0x7f, 0x00,
+ },
+ {
+ 0x00, 0x20, 0x30, 0xf8, 0xf8, 0x30, 0x20, 0x00, 0x00, 0x10, 0x30, 0x7f,
+ 0x7f, 0x30, 0x10, 0x00,
+ },
+ {
+ 0x00, 0xf8, 0xf8, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x6f, 0x6f, 0x00,
+ 0x00, 0x6f, 0x6f, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0xf8, 0xf8, 0x08, 0xf8, 0xf8, 0x00, 0x01, 0x01, 0x7f,
+ 0x7f, 0x00, 0x7f, 0x7f,
+ },
+ {
+ 0x10, 0xb8, 0xe8, 0x48, 0xc8, 0x98, 0x10, 0x00, 0x23, 0x67, 0x4c, 0x48,
+ 0x5c, 0x77, 0x23, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x70,
+ 0x70, 0x70, 0x70, 0x00,
+ },
+ {
+ 0x00, 0x20, 0x30, 0xf8, 0xf8, 0x30, 0x20, 0x00, 0x00, 0x90, 0xb0, 0xff,
+ 0xff, 0xb0, 0x90, 0x00,
+ },
+ {
+ 0x00, 0x20, 0x30, 0xf8, 0xf8, 0x30, 0x20, 0x00, 0x00, 0x00, 0x00, 0x7f,
+ 0x7f, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x30, 0x7f,
+ 0x7f, 0x30, 0x10, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x0a,
+ 0x0f, 0x07, 0x02, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x0f, 0x0a,
+ 0x02, 0x02, 0x02, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x10, 0x10,
+ 0x10, 0x10, 0x10, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x02, 0x07, 0x0f, 0x02,
+ 0x02, 0x0f, 0x07, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x18, 0x1e, 0x1f, 0x1f,
+ 0x1f, 0x1e, 0x18, 0x00,
+ },
+ {
+ 0x60, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x60, 0x00, 0x00, 0x01, 0x07, 0x1f,
+ 0x07, 0x01, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xf0, 0xf8, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f,
+ 0x6f, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x1c, 0x3c, 0x00, 0x00, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x40, 0xf8, 0xf8, 0x40, 0xf8, 0xf8, 0x40, 0x00, 0x08, 0x7f, 0x7f, 0x08,
+ 0x7f, 0x7f, 0x08, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0x0e, 0x0e, 0x18, 0x30, 0x00, 0x30, 0x61, 0x41, 0xc1,
+ 0xc1, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0x38, 0x38, 0x00, 0x80, 0xe0, 0x78, 0x18, 0x00, 0x60, 0x78, 0x1e, 0x07,
+ 0x01, 0x70, 0x70, 0x00,
+ },
+ {
+ 0x00, 0x70, 0xf8, 0x88, 0xf8, 0x70, 0x00, 0x00, 0x3e, 0x7f, 0x41, 0x47,
+ 0x3e, 0x7f, 0x41, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x20, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xe0, 0xf0, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f,
+ 0x60, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x08, 0x18, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x40, 0x60,
+ 0x3f, 0x1f, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x02, 0x0a, 0x0f, 0x07,
+ 0x07, 0x0f, 0x0a, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x1f,
+ 0x1f, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf0,
+ 0x70, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0x60, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x80, 0xe0, 0x78, 0x18, 0x00, 0x60, 0x78, 0x1e, 0x07,
+ 0x01, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0x88, 0x08, 0xf8, 0xf0, 0x00, 0x3f, 0x7f, 0x40, 0x47,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x00, 0x20, 0x30, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7f,
+ 0x7f, 0x40, 0x40, 0x00,
+ },
+ {
+ 0x10, 0x18, 0x08, 0x08, 0x88, 0xf8, 0x70, 0x00, 0x78, 0x7c, 0x46, 0x43,
+ 0x41, 0x60, 0x60, 0x00,
+ },
+ {
+ 0x10, 0x18, 0x08, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x20, 0x60, 0x41, 0x41,
+ 0x41, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0x00, 0x80, 0xe0, 0x78, 0xf8, 0xf8, 0x00, 0x00, 0x06, 0x07, 0x05, 0x44,
+ 0x7f, 0x7f, 0x44, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x21, 0x61, 0x41, 0x41,
+ 0x41, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x08, 0x08, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0x41, 0x41,
+ 0x41, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0x18, 0x18, 0x08, 0x08, 0x08, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x78, 0x7e,
+ 0x07, 0x01, 0x00, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x3e, 0x7f, 0x41, 0x41,
+ 0x41, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x00, 0x41, 0x41, 0x41,
+ 0x61, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30,
+ 0x30, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x70,
+ 0x30, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x10, 0x00, 0x00, 0x03, 0x07, 0x0c,
+ 0x18, 0x30, 0x20, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x09,
+ 0x09, 0x09, 0x09, 0x00,
+ },
+ {
+ 0x00, 0x10, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x20, 0x30, 0x18,
+ 0x0c, 0x07, 0x03, 0x00,
+ },
+ {
+ 0x30, 0x38, 0x08, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x6e,
+ 0x6f, 0x01, 0x00, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x10, 0x10, 0x10, 0xf0, 0xe0, 0x00, 0x3f, 0x7f, 0x40, 0x4f,
+ 0x4f, 0x4f, 0x07, 0x00,
+ },
+ {
+ 0xc0, 0xe0, 0x30, 0x18, 0x30, 0xe0, 0xc0, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x41, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x40, 0x60, 0x30, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x18, 0xf0, 0xe0, 0x00, 0x40, 0x7f, 0x7f, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x88, 0x18, 0x38, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x43, 0x60, 0x70, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x88, 0x18, 0x38, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x03, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x1f, 0x3f, 0x60, 0x42,
+ 0x42, 0x3e, 0x7e, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x7f, 0x7f, 0x01, 0x01,
+ 0x01, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x08, 0xf8, 0xf8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0xf8, 0xf8, 0x08, 0x30, 0x70, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x00, 0xc0, 0xf8, 0x38, 0x00, 0x40, 0x7f, 0x7f, 0x03,
+ 0x0f, 0x7e, 0x70, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f, 0x7f, 0x40,
+ 0x40, 0x60, 0x70, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x70, 0xe0, 0x70, 0xf8, 0xf8, 0x00, 0x7f, 0x7f, 0x00, 0x01,
+ 0x00, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0xe0, 0x80, 0x00, 0xf8, 0xf8, 0x00, 0x7f, 0x7f, 0x01, 0x07,
+ 0x1e, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x08, 0x18, 0xf0, 0xe0, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x01, 0x01, 0x00, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x3f, 0x7f, 0x40, 0x70,
+ 0xe0, 0xff, 0x3f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x40, 0x7f, 0x7f, 0x01,
+ 0x07, 0x7f, 0x78, 0x00,
+ },
+ {
+ 0x70, 0xf8, 0x88, 0x08, 0x08, 0x38, 0x30, 0x00, 0x30, 0x70, 0x41, 0x41,
+ 0x43, 0x7e, 0x3c, 0x00,
+ },
+ {
+ 0x00, 0x38, 0x18, 0xf8, 0xf8, 0x18, 0x38, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x0f, 0x1f, 0x30, 0x60,
+ 0x30, 0x1f, 0x0f, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x1f, 0x7f, 0x70, 0x1e,
+ 0x70, 0x7f, 0x1f, 0x00,
+ },
+ {
+ 0x38, 0xf8, 0xc0, 0x00, 0xc0, 0xf8, 0x38, 0x00, 0x70, 0x7c, 0x0f, 0x03,
+ 0x0f, 0x7c, 0x70, 0x00,
+ },
+ {
+ 0x00, 0xf8, 0xf8, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x41, 0x7f,
+ 0x7f, 0x41, 0x00, 0x00,
+ },
+ {
+ 0x38, 0x18, 0x08, 0x08, 0x88, 0xf8, 0x78, 0x00, 0x78, 0x7c, 0x46, 0x43,
+ 0x41, 0x60, 0x70, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xf8, 0xf8, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f,
+ 0x40, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x18, 0x78, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07,
+ 0x1e, 0x78, 0x60, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x08, 0x08, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40,
+ 0x7f, 0x7f, 0x00, 0x00,
+ },
+ {
+ 0x10, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x10, 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, 0x04, 0x0c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x80, 0x80, 0x00, 0x00, 0x00, 0x40, 0x7f, 0x3f, 0x40,
+ 0x41, 0x7f, 0x3e, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x61, 0x21, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0x88, 0xf8, 0xf8, 0x00, 0x00, 0x3e, 0x7f, 0x41, 0x40,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x44, 0x44,
+ 0x44, 0x67, 0x27, 0x00,
+ },
+ {
+ 0x00, 0xf0, 0xf8, 0x08, 0x18, 0x30, 0x00, 0x00, 0x41, 0x7f, 0x7f, 0x41,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x1f, 0x3f, 0x20, 0x20,
+ 0xff, 0xff, 0x00, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x00, 0x80, 0x80, 0x00, 0x00, 0x40, 0x7f, 0x7f, 0x01,
+ 0x00, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0x98, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x98, 0x98, 0x00, 0x00, 0x80, 0x80, 0x00,
+ 0x00, 0xff, 0xff, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x00, 0x00, 0x80, 0x80, 0x00, 0x40, 0x7f, 0x7f, 0x0c,
+ 0x1e, 0x73, 0x61, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x08, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x7f, 0x7f, 0x01, 0x1f,
+ 0x01, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00,
+ 0x00, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20,
+ 0x20, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x1f, 0x3f, 0x20, 0x20,
+ 0xff, 0xff, 0x00, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x00, 0x03, 0x03, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x21, 0x63, 0x46, 0x44,
+ 0x4c, 0x79, 0x31, 0x00,
+ },
+ {
+ 0x80, 0x80, 0xf0, 0xf8, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f,
+ 0x40, 0x60, 0x20, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x1f, 0x3f, 0x60,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x3f, 0x7f, 0x60, 0x3c,
+ 0x60, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x61, 0x73, 0x1e, 0x0c,
+ 0x1e, 0x73, 0x61, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x1f, 0x3f, 0x20, 0x20,
+ 0x20, 0xff, 0xff, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x61, 0x71, 0x58, 0x4c,
+ 0x46, 0x63, 0x61, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xf0, 0xf8, 0x08, 0x08, 0x00, 0x00, 0x03, 0x03, 0x3f,
+ 0x7c, 0x40, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
+ 0x7f, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7c,
+ 0x3f, 0x03, 0x03, 0x00,
+ },
+ {
+ 0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x3e, 0x3f, 0x21, 0x20,
+ 0x21, 0x3f, 0x3e, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x1f, 0x3f, 0x60, 0xc0,
+ 0xc0, 0x60, 0x30, 0x00,
+ },
+ {
+ 0xb0, 0xb0, 0x00, 0x00, 0xb0, 0xb0, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x80, 0xa0, 0xb0, 0x98, 0x88, 0x00, 0x00, 0x3f, 0x7f, 0x44, 0x44,
+ 0x44, 0x67, 0x27, 0x00,
+ },
+ {
+ 0x00, 0xa0, 0xb0, 0x98, 0xb0, 0x20, 0x00, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x30, 0xb0, 0x80, 0x80, 0xb0, 0x30, 0x00, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x88, 0x98, 0xb0, 0xa0, 0x00, 0x00, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x90, 0xb8, 0xa8, 0xb8, 0x10, 0x00, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0xc0,
+ 0xc0, 0x61, 0x21, 0x00,
+ },
+ {
+ 0x00, 0xa0, 0xb0, 0x98, 0xb0, 0xa0, 0x00, 0x00, 0x3f, 0x7f, 0x44, 0x44,
+ 0x44, 0x67, 0x27, 0x00,
+ },
+ {
+ 0x30, 0xb0, 0x80, 0x80, 0xb0, 0xb0, 0x00, 0x00, 0x3f, 0x7f, 0x44, 0x44,
+ 0x44, 0x67, 0x27, 0x00,
+ },
+ {
+ 0x00, 0x88, 0x98, 0xb0, 0xa0, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x44, 0x44,
+ 0x44, 0x67, 0x27, 0x00,
+ },
+ {
+ 0x00, 0x30, 0xb0, 0x80, 0x80, 0x30, 0x30, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x20, 0xb0, 0x98, 0x98, 0x30, 0x20, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x08, 0x98, 0xb0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0xc3, 0xe3, 0x30, 0x18, 0x30, 0xe3, 0xc3, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xc0, 0xe2, 0x37, 0x15, 0x37, 0xe2, 0xc0, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x0a, 0x8b, 0x19, 0x38, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x43, 0x60, 0x70, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x38, 0x7c, 0x47, 0x3f,
+ 0x7c, 0x47, 0x47, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x08, 0xf8, 0xf8, 0x08, 0x00, 0x7f, 0x7f, 0x01, 0x01,
+ 0x7f, 0x7f, 0x41, 0x00,
+ },
+ {
+ 0x00, 0xa0, 0xb0, 0x98, 0xb0, 0xa0, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x30, 0xb0, 0x80, 0x80, 0x80, 0xb0, 0x30, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x00, 0x88, 0x98, 0xb0, 0xa0, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0xa0, 0xb0, 0x18, 0x18, 0xb0, 0xa0, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x80, 0x88, 0x18, 0x30, 0xa0, 0x80, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0xb0, 0xb0, 0x00, 0x00, 0x00, 0xb0, 0xb0, 0x00, 0x1f, 0x3f, 0x20, 0x20,
+ 0x20, 0xff, 0xff, 0x00,
+ },
+ {
+ 0xe3, 0xf3, 0x18, 0x08, 0x18, 0xf3, 0xe3, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0xfb, 0xfb, 0x00, 0x00, 0x00, 0xfb, 0xfb, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x80, 0x80, 0xc0, 0x40, 0x00, 0xbf, 0xff, 0x70, 0x4c,
+ 0x43, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x80, 0xf8, 0xfc, 0x84, 0x0c, 0x18, 0x00, 0x00, 0x60, 0x7f, 0x7f, 0x40,
+ 0x40, 0x60, 0x20, 0x00,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x88, 0x78, 0xfc, 0xe4, 0x00, 0x9f, 0xff, 0x78, 0x47,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x10, 0x19, 0x0f, 0x06,
+ 0x0f, 0x19, 0x10, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xf8, 0xfc, 0x04, 0x0c, 0x08, 0x80, 0x81, 0x01, 0xff,
+ 0xff, 0x01, 0x01, 0x00,
+ },
+ {
+ 0x00, 0x80, 0xa0, 0xb0, 0x98, 0x08, 0x00, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xa0, 0xb0, 0x98, 0x08, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x80, 0xa0, 0xb0, 0x98, 0x88, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x20, 0x30, 0x98, 0x88, 0x00, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0xa0, 0xb0, 0x10, 0xb0, 0xa0, 0xb0, 0x10, 0x00, 0x00, 0x7f, 0x7f, 0x00,
+ 0x00, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xfa, 0xfb, 0xe1, 0x83, 0x02, 0xfb, 0xf9, 0x00, 0x7f, 0x7f, 0x01, 0x07,
+ 0x1e, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x00, 0x38, 0x7c, 0x44, 0x7c, 0x7c, 0x40, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x00,
+ },
+ {
+ 0x00, 0x38, 0x7c, 0x44, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xd8, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7e, 0x43, 0x41,
+ 0x40, 0x70, 0x30, 0x00,
+ },
+ {
+ 0xf0, 0x18, 0xe8, 0x28, 0xc8, 0x18, 0xf0, 0x00, 0x1f, 0x30, 0x2f, 0x21,
+ 0x2e, 0x30, 0x1f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x1f, 0x1f, 0x00,
+ },
+ {
+ 0xfc, 0xfc, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x00, 0x18, 0x0c, 0x96, 0xcb,
+ 0x69, 0x38, 0x10, 0x00,
+ },
+ {
+ 0xfc, 0xfc, 0x00, 0x00, 0x80, 0xc0, 0x60, 0x00, 0x18, 0x4c, 0x66, 0x73,
+ 0xf9, 0xf8, 0x40, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x98, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x7f,
+ 0x7f, 0x38, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x06, 0x0f, 0x19, 0x10,
+ 0x06, 0x0f, 0x19, 0x10,
+ },
+ {
+ 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x10, 0x19, 0x0f, 0x06,
+ 0x10, 0x19, 0x0f, 0x06,
+ },
+ {
+ 0x00, 0xaa, 0x00, 0x55, 0x00, 0xaa, 0x00, 0x55, 0x00, 0xaa, 0x00, 0x55,
+ 0x00, 0xaa, 0x00, 0x55,
+ },
+ {
+ 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55,
+ 0xaa, 0x55, 0xaa, 0x55,
+ },
+ {
+ 0x55, 0xff, 0xaa, 0xff, 0x55, 0xff, 0xaa, 0xff, 0x55, 0xff, 0xaa, 0xff,
+ 0x55, 0xff, 0xaa, 0xff,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+ 0xff, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0xff,
+ 0xff, 0x00, 0x00, 0x00,
+ },
+ {
+ 0xc0, 0xe0, 0x30, 0x1a, 0x33, 0xe1, 0xc0, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xc0, 0xe2, 0x33, 0x19, 0x33, 0xe2, 0xc0, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xc0, 0xe1, 0x33, 0x1a, 0x30, 0xe0, 0xc0, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0xf0, 0x18, 0xc8, 0x28, 0x28, 0x18, 0xf0, 0x00, 0x1f, 0x30, 0x27, 0x28,
+ 0x28, 0x30, 0x1f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x05, 0x05, 0xfd, 0xfd,
+ 0x00, 0xff, 0xff, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
+ 0x00, 0xff, 0xff, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0xfd, 0xfd,
+ 0x01, 0xff, 0xff, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x05, 0x05, 0x05, 0x05,
+ 0x04, 0x07, 0x07, 0x00,
+ },
+ {
+ 0x00, 0xc0, 0xe0, 0x38, 0x38, 0x60, 0x40, 0x00, 0x00, 0x0f, 0x1f, 0x70,
+ 0x70, 0x18, 0x08, 0x00,
+ },
+ {
+ 0x00, 0x38, 0x78, 0xc0, 0xc0, 0x78, 0x38, 0x00, 0x00, 0x09, 0x09, 0x7f,
+ 0x7f, 0x09, 0x09, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0xfe,
+ 0xfe, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 0x03, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x03,
+ 0x03, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0xfe,
+ 0xfe, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
+ 0xff, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0xff,
+ 0xff, 0x02, 0x02, 0x02,
+ },
+ {
+ 0x20, 0xb0, 0x90, 0xb0, 0xa0, 0x30, 0x10, 0x00, 0x38, 0x7c, 0x44, 0x44,
+ 0x3f, 0x7f, 0x40, 0x00,
+ },
+ {
+ 0xc2, 0xe3, 0x31, 0x1b, 0x32, 0xe3, 0xc1, 0x00, 0x7f, 0x7f, 0x02, 0x02,
+ 0x02, 0x7f, 0x7f, 0x00,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x07, 0x07,
+ 0x04, 0x05, 0x05, 0x05,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
+ 0x01, 0xfd, 0xfd, 0x05,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x05, 0x05, 0x05, 0x05,
+ 0x04, 0x05, 0x05, 0x05,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0xfd, 0xfd,
+ 0x01, 0xfd, 0xfd, 0x05,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
+ 0x00, 0xfd, 0xfd, 0x05,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05,
+ },
+ {
+ 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x05, 0x05, 0xfd, 0xfd,
+ 0x00, 0xfd, 0xfd, 0x05,
+ },
+ {
+ 0x90, 0xf0, 0x60, 0x40, 0x60, 0xf0, 0x90, 0x00, 0x27, 0x3f, 0x18, 0x08,
+ 0x18, 0x3f, 0x27, 0x00,
+ },
+ {
+ 0x20, 0xa8, 0x98, 0xb0, 0xe8, 0xc8, 0x80, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x08, 0x18, 0xf0, 0xe0, 0x00, 0x41, 0x7f, 0x7f, 0x41,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x08, 0xfa, 0xfb, 0x09, 0x8b, 0x1a, 0x38, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x43, 0x60, 0x70, 0x00,
+ },
+ {
+ 0x08, 0xfb, 0xfb, 0x08, 0x88, 0x1b, 0x3b, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x43, 0x60, 0x70, 0x00,
+ },
+ {
+ 0x08, 0xf9, 0xfb, 0x0a, 0x88, 0x18, 0x38, 0x00, 0x40, 0x7f, 0x7f, 0x41,
+ 0x43, 0x60, 0x70, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x08, 0xfa, 0xfb, 0x09, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x02, 0x0b, 0xf9, 0xf9, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x03, 0x0b, 0xf8, 0xf8, 0x0b, 0x03, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x03,
+ 0x03, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe,
+ 0xfe, 0x02, 0x02, 0x02,
+ },
+ {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe,
+ 0xfe, 0xfe, 0xfe, 0xfe,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c,
+ 0x7c, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x09, 0xfb, 0xfa, 0x08, 0x00, 0x00, 0x00, 0x00, 0x40, 0x7f,
+ 0x7f, 0x40, 0x00, 0x00,
+ },
+ {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ },
+ {
+ 0xe0, 0xf0, 0x18, 0x0a, 0x1b, 0xf1, 0xe0, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0x08, 0xf8, 0xf0, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x41,
+ 0x43, 0x7e, 0x3c, 0x00,
+ },
+ {
+ 0xe0, 0xf2, 0x1b, 0x09, 0x1b, 0xf2, 0xe0, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0xe0, 0xf1, 0x1b, 0x0a, 0x18, 0xf0, 0xe0, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x20, 0xb0, 0x90, 0xb0, 0xa0, 0xb0, 0x10, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0xe2, 0xf3, 0x19, 0x0b, 0x1a, 0xf3, 0xe1, 0x00, 0x1f, 0x3f, 0x60, 0x40,
+ 0x60, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0xff, 0xff, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20,
+ 0x20, 0x3f, 0x1f, 0x00,
+ },
+ {
+ 0x08, 0xf8, 0xf8, 0x48, 0x40, 0xc0, 0x80, 0x00, 0x40, 0x7f, 0x7f, 0x48,
+ 0x08, 0x0f, 0x07, 0x00,
+ },
+ {
+ 0xf8, 0xf8, 0x00, 0x02, 0x03, 0xf9, 0xf8, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0xf8, 0xfa, 0x03, 0x01, 0x03, 0xfa, 0xf8, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0xf8, 0xf9, 0x03, 0x02, 0x00, 0xf8, 0xf8, 0x00, 0x3f, 0x7f, 0x40, 0x40,
+ 0x40, 0x7f, 0x3f, 0x00,
+ },
+ {
+ 0x80, 0x80, 0x20, 0x30, 0x18, 0x88, 0x80, 0x00, 0x1f, 0x3f, 0x20, 0x20,
+ 0x20, 0xff, 0xff, 0x00,
+ },
+ {
+ 0x00, 0xf8, 0xf8, 0x02, 0x03, 0xf9, 0xf8, 0x00, 0x00, 0x00, 0x41, 0x7f,
+ 0x7f, 0x41, 0x00, 0x00,
+ },
+ {
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x10, 0x18, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x4f,
+ 0x4f, 0x41, 0x41, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80,
+ },
+ {
+ 0x84, 0x94, 0xfc, 0x68, 0x80, 0xc0, 0x60, 0x00, 0x18, 0x4c, 0x66, 0x73,
+ 0xf9, 0xf8, 0x40, 0x00,
+ },
+ {
+ 0xf0, 0xf8, 0x08, 0xf8, 0xf8, 0x08, 0xf8, 0xf8, 0x00, 0x01, 0x01, 0x7f,
+ 0x7f, 0x00, 0x7f, 0x7f,
+ },
+ {
+ 0x10, 0xb8, 0xe8, 0x48, 0xc8, 0x98, 0x10, 0x00, 0x23, 0x67, 0x4c, 0x48,
+ 0x5c, 0x77, 0x23, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x32,
+ 0x32, 0x02, 0x02, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0xc0, 0x80, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x38, 0x7c, 0x44, 0x7c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
+ 0x02, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x08, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x88, 0x8c, 0x24, 0xfc, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x00, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x88, 0xcc, 0x64, 0x3c, 0x98, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x00, 0x00,
+ },
+ {
+ 0x00, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x00, 0x00,
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ },
+};
+
+void
+font8x16_put_ch (uint8_t *vram, unsigned ch, unsigned x, unsigned y)
+{
+ unsigned shift = y & 7;
+ unsigned page = y >> 3;
+ unsigned mask;
+
+ x += page * SSD1306_WIDTH;
+
+ oled_blit_strip (vram, x, x + 8, 0xff << shift, shift, font8x16[ch]);
+
+ x += SSD1306_WIDTH;
+
+ shift = 8 - shift;
+ mask = 0xff >> shift;
+
+ if (shift)
+ oled_blit_strip (vram, x, x + 8, mask, -shift, font8x16[ch]);
+
+ shift = y & 7;
+ oled_blit_strip (vram, x, x + 8, ~mask & (0xff << shift), shift,
+ &font8x16[ch][8]);
+
+ if (shift) {
+ x += SSD1306_WIDTH;
+ shift = 8 - shift;
+ oled_blit_strip (vram, x, x + 8, 0xff >> shift, -shift,
+ &font8x16[ch][8]);
+ }
+
+
+}
+
+
+void
+font8x16_put_str (uint8_t *vram, char *str, unsigned x, unsigned y)
+{
+ while (*str) {
+ font8x16_put_ch (vram, * (str++), x, y);
+ x += 8;
+ }
+}
diff --git a/stm32/app/font8x8.c b/stm32/app/font8x8.c
new file mode 100644
index 0000000..c5c9d05
--- /dev/null
+++ b/stm32/app/font8x8.c
@@ -0,0 +1,288 @@
+#include "project.h"
+
+static const uint8_t font8x8[][8] = {
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+ {0x7e, 0x81, 0x95, 0xb1, 0xb1, 0x95, 0x81, 0x7e,},
+ {0x7e, 0xff, 0xeb, 0xcf, 0xcf, 0xeb, 0xff, 0x7e,},
+ {0x0e, 0x1f, 0x3f, 0x7e, 0x3f, 0x1f, 0x0e, 0x00,},
+ {0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08, 0x00,},
+ {0x38, 0x38, 0x9f, 0xff, 0x9f, 0x38, 0x38, 0x00,},
+ {0x10, 0x38, 0xbc, 0xff, 0xbc, 0x38, 0x10, 0x00,},
+ {0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00,},
+ {0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff,},
+ {0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,},
+ {0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff,},
+ {0x70, 0x88, 0x88, 0x88, 0x89, 0x7d, 0x03, 0x0f,},
+ {0x00, 0x4e, 0x51, 0xf1, 0xf1, 0x51, 0x4e, 0x00,},
+ {0xc0, 0xe0, 0x7f, 0x05, 0x05, 0x05, 0x05, 0x07,},
+ {0xc0, 0xe0, 0x7f, 0x05, 0x05, 0x65, 0x75, 0x3f,},
+ {0x5a, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x5a,},
+ {0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 0x00,},
+ {0x08, 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f, 0x00,},
+ {0x00, 0x24, 0x66, 0xff, 0xff, 0x66, 0x24, 0x00,},
+ {0x00, 0x00, 0x5f, 0x00, 0x00, 0x5f, 0x00, 0x00,},
+ {0x06, 0x09, 0x09, 0x7f, 0x01, 0x01, 0x7f, 0x01,},
+ {0x40, 0xda, 0xa7, 0xa5, 0xe5, 0x59, 0x03, 0x02,},
+ {0x00, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x00,},
+ {0x80, 0x94, 0xb6, 0xff, 0xff, 0xb6, 0x94, 0x80,},
+ {0x00, 0x0c, 0x06, 0x7f, 0x06, 0x0c, 0x00, 0x00,},
+ {0x00, 0x18, 0x30, 0x7f, 0x30, 0x18, 0x00, 0x00,},
+ {0x08, 0x08, 0x08, 0x2a, 0x3e, 0x1c, 0x08, 0x00,},
+ {0x08, 0x1c, 0x3e, 0x2a, 0x08, 0x08, 0x08, 0x00,},
+ {0x00, 0x3c, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,},
+ {0x08, 0x1c, 0x3e, 0x08, 0x08, 0x3e, 0x1c, 0x08,},
+ {0x30, 0x38, 0x3c, 0x3e, 0x3c, 0x38, 0x30, 0x00,},
+ {0x06, 0x0e, 0x1e, 0x3e, 0x1e, 0x0e, 0x06, 0x00,},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00,},
+ {0x00, 0x14, 0x7f, 0x14, 0x14, 0x7f, 0x14, 0x00,},
+ {0x00, 0x24, 0x2a, 0x6b, 0x6b, 0x2a, 0x12, 0x00,},
+ {0x00, 0x46, 0x26, 0x10, 0x08, 0x64, 0x62, 0x00,},
+ {0x30, 0x4a, 0x45, 0x4d, 0x32, 0x48, 0x48, 0x00,},
+ {0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x1c, 0x22, 0x41, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x41, 0x22, 0x1c, 0x00, 0x00, 0x00,},
+ {0x08, 0x2a, 0x1c, 0x1c, 0x1c, 0x2a, 0x08, 0x00,},
+ {0x00, 0x08, 0x08, 0x3e, 0x08, 0x08, 0x00, 0x00,},
+ {0x00, 0x00, 0x80, 0x60, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,},
+ {0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00,},
+ {0x00, 0x3e, 0x61, 0x51, 0x49, 0x45, 0x3e, 0x00,},
+ {0x00, 0x44, 0x42, 0x7f, 0x40, 0x40, 0x00, 0x00,},
+ {0x00, 0x62, 0x51, 0x51, 0x49, 0x49, 0x66, 0x00,},
+ {0x00, 0x22, 0x41, 0x49, 0x49, 0x49, 0x36, 0x00,},
+ {0x10, 0x18, 0x14, 0x52, 0x7f, 0x50, 0x10, 0x00,},
+ {0x00, 0x27, 0x45, 0x45, 0x45, 0x45, 0x39, 0x00,},
+ {0x00, 0x3c, 0x4a, 0x49, 0x49, 0x49, 0x30, 0x00,},
+ {0x00, 0x03, 0x01, 0x71, 0x09, 0x05, 0x03, 0x00,},
+ {0x00, 0x36, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00,},
+ {0x00, 0x06, 0x49, 0x49, 0x49, 0x29, 0x1e, 0x00,},
+ {0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x80, 0x66, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00,},
+ {0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00,},
+ {0x00, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, 0x00,},
+ {0x00, 0x02, 0x01, 0x01, 0x51, 0x09, 0x06, 0x00,},
+ {0x00, 0x3e, 0x41, 0x5d, 0x55, 0x55, 0x1e, 0x00,},
+ {0x00, 0x7c, 0x12, 0x11, 0x11, 0x12, 0x7c, 0x00,},
+ {0x00, 0x41, 0x7f, 0x49, 0x49, 0x49, 0x36, 0x00,},
+ {0x00, 0x1c, 0x22, 0x41, 0x41, 0x41, 0x22, 0x00,},
+ {0x00, 0x41, 0x7f, 0x41, 0x41, 0x22, 0x1c, 0x00,},
+ {0x00, 0x41, 0x7f, 0x49, 0x5d, 0x41, 0x63, 0x00,},
+ {0x00, 0x41, 0x7f, 0x49, 0x1d, 0x01, 0x03, 0x00,},
+ {0x00, 0x1c, 0x22, 0x41, 0x51, 0x51, 0x72, 0x00,},
+ {0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x7f, 0x00,},
+ {0x00, 0x00, 0x41, 0x7f, 0x41, 0x00, 0x00, 0x00,},
+ {0x00, 0x30, 0x40, 0x40, 0x41, 0x3f, 0x01, 0x00,},
+ {0x00, 0x41, 0x7f, 0x08, 0x14, 0x22, 0x41, 0x40,},
+ {0x00, 0x41, 0x7f, 0x41, 0x40, 0x40, 0x60, 0x00,},
+ {0x00, 0x7f, 0x01, 0x02, 0x04, 0x02, 0x01, 0x7f,},
+ {0x00, 0x7f, 0x01, 0x02, 0x04, 0x08, 0x7f, 0x00,},
+ {0x00, 0x3e, 0x41, 0x41, 0x41, 0x41, 0x3e, 0x00,},
+ {0x00, 0x41, 0x7f, 0x49, 0x09, 0x09, 0x06, 0x00,},
+ {0x00, 0x1e, 0x21, 0x21, 0x31, 0x21, 0x5e, 0x40,},
+ {0x00, 0x41, 0x7f, 0x49, 0x19, 0x29, 0x46, 0x00,},
+ {0x00, 0x26, 0x49, 0x49, 0x49, 0x49, 0x32, 0x00,},
+ {0x00, 0x03, 0x01, 0x41, 0x7f, 0x41, 0x01, 0x03,},
+ {0x00, 0x3f, 0x40, 0x40, 0x40, 0x40, 0x3f, 0x00,},
+ {0x00, 0x0f, 0x10, 0x20, 0x40, 0x20, 0x10, 0x0f,},
+ {0x00, 0x3f, 0x40, 0x40, 0x38, 0x40, 0x40, 0x3f,},
+ {0x00, 0x41, 0x22, 0x14, 0x08, 0x14, 0x22, 0x41,},
+ {0x00, 0x01, 0x02, 0x44, 0x78, 0x44, 0x02, 0x01,},
+ {0x00, 0x43, 0x61, 0x51, 0x49, 0x45, 0x43, 0x61,},
+ {0x00, 0x7f, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00,},
+ {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00,},
+ {0x00, 0x41, 0x41, 0x41, 0x7f, 0x00, 0x00, 0x00,},
+ {0x08, 0x04, 0x02, 0x01, 0x02, 0x04, 0x08, 0x00,},
+ {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,},
+ {0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00,},
+ {0x00, 0x20, 0x54, 0x54, 0x54, 0x54, 0x78, 0x40,},
+ {0x00, 0x01, 0x7f, 0x30, 0x48, 0x48, 0x48, 0x30,},
+ {0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x28, 0x00,},
+ {0x00, 0x30, 0x48, 0x48, 0x48, 0x31, 0x7f, 0x40,},
+ {0x00, 0x38, 0x54, 0x54, 0x54, 0x54, 0x18, 0x00,},
+ {0x00, 0x00, 0x48, 0x7e, 0x49, 0x01, 0x02, 0x00,},
+ {0x00, 0x98, 0xa4, 0xa4, 0xa4, 0xa4, 0x78, 0x04,},
+ {0x00, 0x41, 0x7f, 0x08, 0x04, 0x04, 0x78, 0x00,},
+ {0x00, 0x00, 0x44, 0x7d, 0x40, 0x00, 0x00, 0x00,},
+ {0x00, 0x60, 0x80, 0x80, 0x80, 0x84, 0x7d, 0x00,},
+ {0x00, 0x01, 0x7f, 0x10, 0x28, 0x44, 0x40, 0x00,},
+ {0x00, 0x00, 0x41, 0x7f, 0x40, 0x00, 0x00, 0x00,},
+ {0x00, 0x7c, 0x04, 0x04, 0x78, 0x04, 0x04, 0x78,},
+ {0x00, 0x7c, 0x08, 0x04, 0x04, 0x04, 0x78, 0x00,},
+ {0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00,},
+ {0x00, 0x84, 0xfc, 0x98, 0x24, 0x24, 0x18, 0x00,},
+ {0x00, 0x18, 0x24, 0x24, 0x98, 0xfc, 0x84, 0x00,},
+ {0x00, 0x44, 0x7c, 0x48, 0x04, 0x04, 0x18, 0x00,},
+ {0x00, 0x48, 0x54, 0x54, 0x54, 0x54, 0x24, 0x00,},
+ {0x00, 0x04, 0x04, 0x3f, 0x44, 0x44, 0x20, 0x00,},
+ {0x00, 0x3c, 0x40, 0x40, 0x40, 0x20, 0x7c, 0x00,},
+ {0x00, 0x0c, 0x10, 0x20, 0x40, 0x20, 0x10, 0x0c,},
+ {0x00, 0x3c, 0x40, 0x40, 0x38, 0x40, 0x40, 0x3c,},
+ {0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00,},
+ {0x00, 0x9c, 0xa0, 0xa0, 0xa0, 0xa0, 0x7c, 0x00,},
+ {0x00, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x00, 0x00,},
+ {0x00, 0x08, 0x08, 0x36, 0x41, 0x41, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x41, 0x41, 0x36, 0x08, 0x08, 0x00,},
+ {0x00, 0x02, 0x01, 0x01, 0x02, 0x02, 0x01, 0x00,},
+ {0x00, 0x70, 0x48, 0x44, 0x42, 0x44, 0x48, 0x70,},
+ {0x00, 0x0e, 0x91, 0x91, 0xb1, 0xb1, 0x4a, 0x00,},
+ {0x00, 0x3a, 0x40, 0x40, 0x40, 0x7a, 0x40, 0x00,},
+ {0x00, 0x38, 0x54, 0x54, 0x55, 0x55, 0x18, 0x00,},
+ {0x00, 0x22, 0x55, 0x55, 0x55, 0x79, 0x42, 0x00,},
+ {0x00, 0x21, 0x54, 0x54, 0x54, 0x78, 0x41, 0x00,},
+ {0x00, 0x20, 0x55, 0x55, 0x54, 0x78, 0x40, 0x00,},
+ {0x00, 0x20, 0x54, 0x55, 0x54, 0x78, 0x40, 0x00,},
+ {0x00, 0x18, 0x24, 0xa4, 0xa4, 0xe4, 0x40, 0x00,},
+ {0x00, 0x3a, 0x55, 0x55, 0x55, 0x55, 0x1a, 0x00,},
+ {0x00, 0x39, 0x54, 0x54, 0x54, 0x54, 0x19, 0x00,},
+ {0x00, 0x38, 0x55, 0x55, 0x54, 0x54, 0x18, 0x00,},
+ {0x00, 0x00, 0x01, 0x44, 0x7c, 0x41, 0x00, 0x00,},
+ {0x02, 0x01, 0x45, 0x7d, 0x41, 0x01, 0x02, 0x00,},
+ {0x00, 0x00, 0x01, 0x45, 0x7c, 0x40, 0x00, 0x00,},
+ {0x00, 0x79, 0x14, 0x12, 0x12, 0x14, 0x79, 0x00,},
+ {0x00, 0x70, 0x28, 0x2b, 0x2b, 0x28, 0x70, 0x00,},
+ {0x00, 0x44, 0x7c, 0x54, 0x55, 0x45, 0x00, 0x00,},
+ {0x00, 0x20, 0x54, 0x54, 0x58, 0x38, 0x54, 0x54,},
+ {0x00, 0x7c, 0x0a, 0x09, 0x09, 0x7f, 0x49, 0x49,},
+ {0x00, 0x30, 0x4a, 0x49, 0x49, 0x4a, 0x30, 0x00,},
+ {0x00, 0x32, 0x48, 0x48, 0x48, 0x48, 0x32, 0x00,},
+ {0x00, 0x30, 0x49, 0x4a, 0x48, 0x48, 0x30, 0x00,},
+ {0x00, 0x38, 0x42, 0x41, 0x41, 0x42, 0x38, 0x00,},
+ {0x00, 0x38, 0x41, 0x42, 0x40, 0x40, 0x38, 0x00,},
+ {0x00, 0x1a, 0xa0, 0xa0, 0xa0, 0xa0, 0x7a, 0x00,},
+ {0x00, 0x19, 0x24, 0x42, 0x42, 0x24, 0x19, 0x00,},
+ {0x00, 0x3d, 0x40, 0x40, 0x40, 0x40, 0x3d, 0x00,},
+ {0x00, 0x18, 0x24, 0x24, 0xe7, 0x24, 0x24, 0x00,},
+ {0x00, 0x68, 0x5e, 0x49, 0x41, 0x42, 0x20, 0x00,},
+ {0x00, 0x15, 0x16, 0x7c, 0x16, 0x15, 0x00, 0x00,},
+ {0x81, 0xff, 0x85, 0x05, 0x17, 0xfa, 0x90, 0x50,},
+ {0x40, 0x88, 0x88, 0x7f, 0x09, 0x09, 0x02, 0x00,},
+ {0x00, 0x20, 0x54, 0x54, 0x55, 0x79, 0x40, 0x00,},
+ {0x00, 0x00, 0x00, 0x44, 0x7d, 0x41, 0x00, 0x00,},
+ {0x00, 0x30, 0x48, 0x48, 0x4a, 0x49, 0x30, 0x00,},
+ {0x00, 0x38, 0x40, 0x40, 0x44, 0x42, 0x38, 0x00,},
+ {0x00, 0x7a, 0x09, 0x09, 0x0a, 0x0a, 0x71, 0x00,},
+ {0x00, 0x7a, 0x09, 0x11, 0x22, 0x42, 0x79, 0x00,},
+ {0x00, 0x26, 0x29, 0x29, 0x29, 0x2f, 0x28, 0x00,},
+ {0x00, 0x26, 0x29, 0x29, 0x29, 0x26, 0x00, 0x00,},
+ {0x00, 0x30, 0x48, 0x45, 0x40, 0x40, 0x20, 0x00,},
+ {0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00,},
+ {0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00,},
+ {0x4a, 0x2f, 0x18, 0x88, 0xd4, 0xca, 0xa9, 0xb0,},
+ {0x4a, 0x2f, 0x18, 0x28, 0x34, 0x2a, 0xfd, 0x20,},
+ {0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x08, 0x14, 0x22, 0x08, 0x14, 0x22, 0x00,},
+ {0x00, 0x22, 0x14, 0x08, 0x22, 0x14, 0x08, 0x00,},
+ {0xaa, 0x00, 0x55, 0x00, 0xaa, 0x00, 0x55, 0x00,},
+ {0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55,},
+ {0xdd, 0xff, 0xaa, 0x77, 0xdd, 0xaa, 0xff, 0x77,},
+ {0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,},
+ {0x10, 0x10, 0x10, 0xff, 0x00, 0x00, 0x00, 0x00,},
+ {0x14, 0x14, 0x14, 0xff, 0x00, 0x00, 0x00, 0x00,},
+ {0x10, 0x10, 0x10, 0xff, 0x00, 0xff, 0x00, 0x00,},
+ {0x10, 0x10, 0x10, 0xf0, 0x10, 0xf0, 0x00, 0x00,},
+ {0x14, 0x14, 0x14, 0xfc, 0x00, 0x00, 0x00, 0x00,},
+ {0x14, 0x14, 0x14, 0xf7, 0x00, 0xff, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00,},
+ {0x14, 0x14, 0x14, 0xf4, 0x04, 0xfc, 0x00, 0x00,},
+ {0x14, 0x14, 0x14, 0x17, 0x10, 0x1f, 0x00, 0x00,},
+ {0x10, 0x10, 0x10, 0x1f, 0x10, 0x1f, 0x00, 0x00,},
+ {0x14, 0x14, 0x14, 0x1f, 0x00, 0x00, 0x00, 0x00,},
+ {0x10, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x1f, 0x10, 0x10, 0x10, 0x10,},
+ {0x10, 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10,},
+ {0x10, 0x10, 0x10, 0xf0, 0x10, 0x10, 0x10, 0x10,},
+ {0x00, 0x00, 0x00, 0xff, 0x10, 0x10, 0x10, 0x10,},
+ {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,},
+ {0x10, 0x10, 0x10, 0xff, 0x10, 0x10, 0x10, 0x10,},
+ {0x00, 0x00, 0x00, 0xff, 0x14, 0x14, 0x14, 0x14,},
+ {0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x10, 0x10,},
+ {0x00, 0x00, 0x00, 0x1f, 0x10, 0x17, 0x14, 0x14,},
+ {0x00, 0x00, 0x00, 0xfc, 0x04, 0xf4, 0x14, 0x14,},
+ {0x14, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14,},
+ {0x14, 0x14, 0x14, 0xf4, 0x04, 0xf4, 0x14, 0x14,},
+ {0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x14, 0x14,},
+ {0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14,},
+ {0x14, 0x14, 0x14, 0xf7, 0x00, 0xf7, 0x14, 0x14,},
+ {0x14, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14, 0x14,},
+ {0x10, 0x10, 0x10, 0x1f, 0x10, 0x1f, 0x10, 0x10,},
+ {0x14, 0x14, 0x14, 0xf4, 0x14, 0x14, 0x14, 0x14,},
+ {0x10, 0x10, 0x10, 0xf0, 0x10, 0xf0, 0x10, 0x10,},
+ {0x00, 0x00, 0x00, 0x1f, 0x10, 0x1f, 0x10, 0x10,},
+ {0x00, 0x00, 0x00, 0x1f, 0x14, 0x14, 0x14, 0x14,},
+ {0x00, 0x00, 0x00, 0xfc, 0x14, 0x14, 0x14, 0x14,},
+ {0x00, 0x00, 0x00, 0xf0, 0x10, 0xf0, 0x10, 0x10,},
+ {0x10, 0x10, 0x10, 0xff, 0x10, 0xff, 0x10, 0x10,},
+ {0x14, 0x14, 0x14, 0xff, 0x14, 0x14, 0x14, 0x14,},
+ {0x10, 0x10, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0xf0, 0x10, 0x10, 0x10, 0x10,},
+ {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,},
+ {0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,},
+ {0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,},
+ {0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,},
+ {0x00, 0x38, 0x44, 0x44, 0x28, 0x10, 0x28, 0x44,},
+ {0x00, 0xfc, 0x2a, 0x2a, 0x2a, 0x2a, 0x14, 0x00,},
+ {0x00, 0x7e, 0x02, 0x02, 0x02, 0x02, 0x06, 0x00,},
+ {0x00, 0x04, 0x02, 0x7e, 0x02, 0x7e, 0x02, 0x02,},
+ {0x00, 0x63, 0x55, 0x49, 0x49, 0x41, 0x63, 0x00,},
+ {0x00, 0x38, 0x44, 0x44, 0x3c, 0x04, 0x04, 0x00,},
+ {0x80, 0x7e, 0x10, 0x10, 0x10, 0x0e, 0x10, 0x00,},
+ {0x00, 0x04, 0x02, 0x02, 0x7c, 0x04, 0x02, 0x02,},
+ {0x00, 0x99, 0xa5, 0xe7, 0xa5, 0x99, 0x00, 0x00,},
+ {0x00, 0x1c, 0x2a, 0x49, 0x49, 0x2a, 0x1c, 0x00,},
+ {0x00, 0x4c, 0x72, 0x01, 0x01, 0x72, 0x4c, 0x00,},
+ {0x00, 0x30, 0x4a, 0x4d, 0x4d, 0x49, 0x30, 0x00,},
+ {0x1c, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x1c,},
+ {0x80, 0x58, 0x24, 0x34, 0x2c, 0x26, 0x19, 0x00,},
+ {0x00, 0x00, 0x1c, 0x2a, 0x49, 0x49, 0x00, 0x00,},
+ {0x00, 0x7e, 0x01, 0x01, 0x01, 0x01, 0x7e, 0x00,},
+ {0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x00,},
+ {0x00, 0x44, 0x44, 0x5f, 0x44, 0x44, 0x00, 0x00,},
+ {0x00, 0x40, 0x40, 0x51, 0x4a, 0x44, 0x40, 0x00,},
+ {0x00, 0x40, 0x44, 0x4a, 0x51, 0x40, 0x40, 0x00,},
+ {0x00, 0x00, 0x00, 0xfe, 0x01, 0x01, 0x06, 0x00,},
+ {0x60, 0x80, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00,},
+ {0x00, 0x08, 0x08, 0x6b, 0x6b, 0x08, 0x08, 0x00,},
+ {0x00, 0x24, 0x12, 0x12, 0x24, 0x24, 0x12, 0x00,},
+ {0x00, 0x06, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,},
+ {0x20, 0x20, 0x40, 0x80, 0xff, 0x01, 0x01, 0x01,},
+ {0x00, 0x1f, 0x01, 0x01, 0x01, 0x1e, 0x00, 0x00,},
+ {0x00, 0x12, 0x19, 0x15, 0x12, 0x00, 0x00, 0x00,},
+ {0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00,},
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,},
+};
+
+void
+font8x8_put_ch (uint8_t *vram, unsigned ch, unsigned x, unsigned y)
+{
+ unsigned shift = y & 7;
+ unsigned page = y >> 3;
+
+ x += page * SSD1306_WIDTH;
+
+ oled_blit_strip (vram, x, x + 8, 0xff << shift, shift, font8x8[ch]);
+
+ if (shift) {
+ x += SSD1306_WIDTH;
+ shift = 8 - shift;
+ oled_blit_strip (vram, x, x + 8, 0xff >> shift, -shift, font8x8[ch]);
+ }
+
+}
+
+
+void
+font8x8_put_str (uint8_t *vram, char *str, unsigned x, unsigned y)
+{
+ while (*str) {
+ font8x8_put_ch (vram, * (str++), x, y);
+ x += 8;
+ }
+}
diff --git a/stm32/app/gauge.c b/stm32/app/gauge.c
new file mode 100644
index 0000000..8632379
--- /dev/null
+++ b/stm32/app/gauge.c
@@ -0,0 +1,161 @@
+#include "project.h"
+
+#define P1_N GPIO12
+#define P1_N_PORT GPIOB
+#define P1_P GPIO13
+#define P1_P_PORT GPIOB
+#define P2_N GPIO14
+#define P2_N_PORT GPIOB
+#define P2_P GPIO15
+#define P2_P_PORT GPIOB
+
+
+int gauge_target;
+static int gauge_current;
+static unsigned zeroing = 1000;
+
+#define GUAGE_N_STATE 6
+static unsigned gauge_state;
+
+
+static inline unsigned
+cw (unsigned v)
+{
+ v += GUAGE_N_STATE - 1;
+
+ if (v >= GUAGE_N_STATE)
+ v -= GUAGE_N_STATE;
+
+ return v;
+}
+
+
+static inline unsigned
+ccw (unsigned v)
+{
+ v += 1;
+
+ if (v >= GUAGE_N_STATE)
+ v -= GUAGE_N_STATE;
+
+ return v;
+}
+
+static inline void
+p1 (int i)
+{
+ if (i < 0) {
+ SET (P1_N);
+ CLEAR (P1_P);
+ } else if (i > 0) {
+ CLEAR (P1_N);
+ SET (P1_P);
+ } else {
+ CLEAR (P1_N);
+ CLEAR (P1_P);
+ }
+}
+
+static inline void
+p2 (int i)
+{
+ if (i < 0) {
+ SET (P2_N);
+ CLEAR (P2_P);
+ } else if (i > 0) {
+ CLEAR (P2_N);
+ SET (P2_P);
+ } else {
+ CLEAR (P2_N);
+ CLEAR (P2_P);
+ }
+}
+
+
+void
+gauge_ticker (void)
+{
+
+ if (zeroing) {
+ zeroing--;
+ gauge_state = ccw (gauge_state);
+ gauge_current = -10;
+ } else {
+
+ if (gauge_current < gauge_target) {
+ gauge_state = cw (gauge_state);
+ gauge_current++;
+ } else if (gauge_current > gauge_target) {
+ gauge_state = ccw (gauge_state);
+ gauge_current--;
+ }
+ }
+
+
+ switch (gauge_state) {
+ case 0:
+ p1 (1);
+ p2 (1);
+ break;
+
+ case 1:
+ p1 (1);
+ p2 (0);
+ break;
+
+ case 2:
+ p1 (0);
+ p2 (-1);
+ break;
+
+ case 3:
+ p1 (-1);
+ p2 (-1);
+ break;
+
+ case 4:
+ p1 (-1);
+ p2 (0);
+ break;
+
+ case 5:
+ p1 (0);
+ p2 (1);
+ }
+
+}
+
+void
+gauge_test (void)
+{
+ char buf[8];
+#if 0
+ uint32_t now = dwt_read_cycle_counter(); /*This wraps every 59.9 seconds or so */
+
+ now &= 0x3fffffff; /* now wraps every 15s */
+ now = now / (0x3fffffff / 810);
+
+ gauge_target = now;
+#else
+
+ if (gauge_target == gauge_current)
+ gauge_target ^= 900;
+
+#endif
+
+
+ sprintf (buf, "%6d", gauge_current);
+ font8x8_put_str (vram_1, buf, 80, 24);
+}
+
+
+
+
+void
+gauge_init (void)
+{
+ MAP_OUTPUT_PP (P1_N);
+ MAP_OUTPUT_PP (P1_P);
+ MAP_OUTPUT_PP (P2_N);
+ MAP_OUTPUT_PP (P2_P);
+}
diff --git a/stm32/app/gdb.script b/stm32/app/gdb.script
new file mode 100644
index 0000000..7cf9d09
--- /dev/null
+++ b/stm32/app/gdb.script
@@ -0,0 +1,2 @@
+target remote localhost:3333
+cont
diff --git a/stm32/app/i2c.c b/stm32/app/i2c.c
new file mode 100644
index 0000000..8c5630e
--- /dev/null
+++ b/stm32/app/i2c.c
@@ -0,0 +1,21 @@
+#include "project.h"
+
+static int mutex = 0;
+
+int
+i2c_lock (void)
+{
+ if (__sync_add_and_fetch (&mutex, 1) != 1) {
+ __sync_sub_and_fetch (&mutex, 1);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+void
+i2c_unlock (void)
+{
+ __sync_sub_and_fetch (&mutex, 1);
+}
diff --git a/stm32/app/i2c.h b/stm32/app/i2c.h
new file mode 100644
index 0000000..26570d5
--- /dev/null
+++ b/stm32/app/i2c.h
@@ -0,0 +1,2 @@
+#define I2C_WRITE 0
+#define I2C_READ 1
diff --git a/stm32/app/i2c_hw.c b/stm32/app/i2c_hw.c
new file mode 100644
index 0000000..a17c564
--- /dev/null
+++ b/stm32/app/i2c_hw.c
@@ -0,0 +1,360 @@
+#include "project.h"
+
+
+#define SCL1 GPIO6
+#define SDA1 GPIO7
+#define SCL1_PORT GPIOB
+#define SDA1_PORT GPIOB
+
+#define SCL2 GPIO10
+#define SDA2 GPIO11
+#define SCL2_PORT GPIOB
+#define SDA2_PORT GPIOB
+
+void
+i2c_clear_start (uint32_t i2c)
+{
+ I2C_CR1 (i2c) &= ~ (uint32_t) I2C_CR1_START;
+}
+
+
+int
+i2cp_start (uint32_t i2c)
+{
+ uint32_t timeout = 1000;
+ i2c_send_start (i2c);
+
+ while (! ((I2C_SR1 (i2c) & I2C_SR1_SB)
+ & (I2C_SR2 (i2c) & (I2C_SR2_MSL | I2C_SR2_BUSY))) && (timeout--));
+
+ return timeout ? 0 : -1;
+}
+
+void
+i2cp_abort_start (uint32_t i2c)
+{
+ i2c_clear_start (i2c);
+ delay_us (10);
+}
+
+void
+i2cp_stop (uint32_t i2c)
+{
+ i2c_send_stop (i2c);
+}
+
+
+void
+i2cp_abort_stop (uint32_t i2c)
+{
+ i2c_clear_stop (i2c);
+ delay_us (10);
+}
+
+int
+i2cp_send (uint32_t i2c, uint8_t v)
+{
+ uint32_t reg;
+ uint32_t timeout = 1000;
+
+ i2c_send_data (i2c, v);
+
+ while (!
+ ((reg =
+ I2C_SR1 (i2c)) & (I2C_SR1_BTF | I2C_SR1_BERR | I2C_SR1_ARLO |
+ I2C_SR1_AF | I2C_SR1_PECERR | I2C_SR1_TIMEOUT |
+ I2C_SR1_SMBALERT)) && (timeout--));
+
+ I2C_SR1 (i2c) =
+ reg & ~ (I2C_SR1_BERR | I2C_SR1_ARLO | I2C_SR1_AF | I2C_SR1_PECERR |
+ I2C_SR1_TIMEOUT | I2C_SR1_SMBALERT);
+
+ if (!timeout)
+ return 1;
+
+
+ return (reg & I2C_SR1_BTF) ? 0 : -1;
+}
+
+/*0 on success 1 on failure*/
+int
+i2cp_start_transaction (uint32_t i2c, uint8_t a, int wnr)
+{
+ uint32_t reg;
+ uint32_t __attribute__ ((unused)) dummy;
+ uint32_t timeout = 1000;
+
+ i2c_send_start (i2c);
+
+ while (! ((I2C_SR1 (i2c) & I2C_SR1_SB)
+ & (I2C_SR2 (i2c) & (I2C_SR2_MSL | I2C_SR2_BUSY))) && (timeout--));
+
+ if (!timeout)
+ return -1;
+
+ i2c_send_7bit_address (i2c, a, wnr);
+
+ while (!
+ ((reg =
+ I2C_SR1 (i2c)) & (I2C_SR1_ADDR | I2C_SR1_BERR | I2C_SR1_ARLO |
+ I2C_SR1_AF | I2C_SR1_PECERR | I2C_SR1_TIMEOUT |
+ I2C_SR1_SMBALERT)) && (timeout--));
+
+ if (!timeout)
+ return -1;
+
+ dummy = I2C_SR2 (i2c);
+
+ I2C_SR1 (i2c) =
+ reg & ~ (I2C_SR1_BERR | I2C_SR1_ARLO | I2C_SR1_AF | I2C_SR1_PECERR |
+ I2C_SR1_TIMEOUT | I2C_SR1_SMBALERT);
+
+
+ return (reg == 0x82) ? 0 : -1;
+}
+
+
+/*This is stupid, it bit bangs a dummy transaction to get the host i2c controller back in the game */
+void
+i2cp1_reset_sm (void)
+{
+ int i;
+
+ MAP_OUTPUT_PP (SCL1);
+ MAP_OUTPUT_PP (SDA1);
+
+ SET (SDA1);
+ SET (SCL1);
+ delay_us (10);
+ CLEAR (SDA1);
+ delay_us (10);
+ CLEAR (SCL1);
+
+ for (i = 0; i < 9; ++i) {
+ delay_us (10);
+ SET (SCL1);
+ delay_us (10);
+ CLEAR (SCL1);
+ delay_us (10);
+ }
+
+ SET (SCL1);
+ delay_us (10);
+ SET (SDA1);
+ delay_us (10);
+
+ MAP_AF_OD (SCL1);
+ MAP_AF_OD (SDA1);
+
+}
+
+void
+i2cp2_reset_sm (void)
+{
+ int i;
+
+ MAP_OUTPUT_PP (SCL2);
+ MAP_OUTPUT_PP (SDA2);
+
+ SET (SDA2);
+ SET (SCL2);
+ delay_us (10);
+ CLEAR (SDA2);
+ delay_us (10);
+ CLEAR (SCL2);
+
+ for (i = 0; i < 9; ++i) {
+ delay_us (10);
+ SET (SCL2);
+ delay_us (10);
+ CLEAR (SCL2);
+ delay_us (10);
+ }
+
+ SET (SCL2);
+ delay_us (10);
+ SET (SDA2);
+ delay_us (10);
+
+ MAP_AF_OD (SCL2);
+ MAP_AF_OD (SDA2);
+
+}
+
+
+
+void
+i2cp1_start_dma (uint8_t *buf, int len)
+{
+ dma_channel_reset (DMA1, DMA_CHANNEL6);
+ dma_set_peripheral_address (DMA1, DMA_CHANNEL6, (uint32_t) & I2C1_DR);
+ dma_set_memory_address (DMA1, DMA_CHANNEL6, (uint32_t) buf);
+ dma_set_number_of_data (DMA1, DMA_CHANNEL6, len);
+ dma_set_read_from_memory (DMA1, DMA_CHANNEL6);
+ dma_enable_memory_increment_mode (DMA1, DMA_CHANNEL6);
+ dma_set_peripheral_size (DMA1, DMA_CHANNEL6, DMA_CCR_PSIZE_8BIT);
+ dma_set_memory_size (DMA1, DMA_CHANNEL6, DMA_CCR_MSIZE_8BIT);
+ dma_set_priority (DMA1, DMA_CHANNEL6, DMA_CCR_PL_MEDIUM);
+ dma_enable_transfer_complete_interrupt (DMA1, DMA_CHANNEL6);
+ dma_enable_transfer_error_interrupt (DMA1, DMA_CHANNEL6);
+ dma_enable_channel (DMA1, DMA_CHANNEL6);
+
+ i2c_enable_dma (I2C1);
+}
+
+
+void
+i2cp2_start_dma (uint8_t *buf, int len)
+{
+ dma_channel_reset (DMA1, DMA_CHANNEL4);
+ dma_set_peripheral_address (DMA1, DMA_CHANNEL4, (uint32_t) & I2C2_DR);
+ dma_set_memory_address (DMA1, DMA_CHANNEL4, (uint32_t) buf);
+ dma_set_number_of_data (DMA1, DMA_CHANNEL4, len);
+ dma_set_read_from_memory (DMA1, DMA_CHANNEL4);
+ dma_enable_memory_increment_mode (DMA1, DMA_CHANNEL4);
+ dma_set_peripheral_size (DMA1, DMA_CHANNEL4, DMA_CCR_PSIZE_8BIT);
+ dma_set_memory_size (DMA1, DMA_CHANNEL4, DMA_CCR_MSIZE_8BIT);
+ dma_set_priority (DMA1, DMA_CHANNEL4, DMA_CCR_PL_MEDIUM);
+ dma_enable_transfer_complete_interrupt (DMA1, DMA_CHANNEL4);
+ dma_enable_transfer_error_interrupt (DMA1, DMA_CHANNEL4);
+ dma_enable_channel (DMA1, DMA_CHANNEL4);
+
+ i2c_enable_dma (I2C2);
+}
+
+
+int
+i2cp1_dma_in_progress (void)
+{
+ return ! (DMA1_ISR & (DMA_ISR_TCIF6 | DMA_ISR_TEIF6));
+}
+
+int
+i2cp2_dma_in_progress (void)
+{
+ return ! (DMA1_ISR & (DMA_ISR_TCIF4 | DMA_ISR_TEIF4));
+}
+
+void
+i2cp1_stop_dma (void)
+{
+ DMA1_IFCR |= DMA_IFCR_CTCIF6 | DMA_IFCR_CTEIF6 | DMA_IFCR_CGIF6;
+
+ dma_disable_transfer_complete_interrupt (DMA1, DMA_CHANNEL6);
+ dma_disable_transfer_error_interrupt (DMA1, DMA_CHANNEL6);
+
+ i2c_disable_dma (I2C1);
+ dma_disable_channel (DMA1, DMA_CHANNEL6);
+}
+
+void
+i2cp2_stop_dma (void)
+{
+ DMA1_IFCR |= DMA_IFCR_CTCIF4 | DMA_IFCR_CTEIF4 | DMA_IFCR_CGIF4;
+
+ dma_disable_transfer_complete_interrupt (DMA1, DMA_CHANNEL4);
+ dma_disable_transfer_error_interrupt (DMA1, DMA_CHANNEL4);
+
+ i2c_disable_dma (I2C2);
+ dma_disable_channel (DMA1, DMA_CHANNEL4);
+}
+
+
+void
+i2cp_reset (uint32_t i2c)
+{
+ while (i2c_lock());
+
+ i2cp_start (i2c);
+ i2cp_abort_start (i2c);
+ i2cp_stop (i2c);
+ i2cp_abort_stop (i2c);
+
+ i2cp_start (i2c);
+ i2cp_abort_start (i2c);
+ i2cp_stop (i2c);
+ i2cp_abort_stop (i2c);
+ i2c_unlock();
+}
+
+
+
+void
+i2cp_scan (uint32_t i2c)
+{
+ int i, r;
+
+ i2cp_reset (i2c);
+
+ printf ("Probing bus\n");
+
+ for (i = 0; i < 128; ++i) {
+ printf ("%d\n", i);
+
+ while (i2c_lock());
+
+ i2cp_start (i2c);
+ i2cp_abort_start (i2c);
+ i2cp_stop (i2c);
+ i2cp_abort_stop (i2c);
+ delay_ms (10);
+ r = i2cp_start_transaction (i2c, i, I2C_WRITE);
+ i2cp_stop (i2c);
+ i2c_unlock();
+
+ if (!r)
+ printf ("Found device at address 0x%x\n", i);
+
+ usart1_drain();
+ }
+
+ printf ("Done\n");
+ i2cp_reset (i2c);
+
+}
+
+static void
+i2cp_bringup (uint32_t i2c)
+{
+ i2c_peripheral_enable (i2c);
+ i2c_clear_start (i2c);
+ i2c_clear_stop (i2c);
+ i2c_reset (i2c);
+ i2c_peripheral_enable (i2c);
+
+ I2C_CR1 (i2c) |= I2C_CR1_SWRST;
+ delay_us (1000);
+ I2C_CR1 (i2c) &= ~I2C_CR1_SWRST;
+
+
+ if (i2c == I2C1)
+ i2cp1_reset_sm();
+ else
+ i2cp2_reset_sm();
+
+
+ i2c_set_clock_frequency (i2c, I2C_CR2_FREQ_36MHZ);
+ i2c_set_standard_mode (i2c);
+ i2c_set_ccr (i2c, 0x80); /* t_high=t_high=CCR * Tpclk1 */
+ i2c_set_trise (i2c, 0x0b);
+
+ i2c_set_own_7bit_slave_address (i2c, 0x00);
+
+ i2c_peripheral_enable (i2c);
+}
+
+
+void
+i2cp_init (void)
+{
+ rcc_periph_clock_enable (RCC_I2C1);
+ rcc_periph_clock_enable (RCC_I2C2);
+ rcc_periph_clock_enable (RCC_DMA1);
+
+ while (i2c_lock());
+
+ i2cp_bringup (I2C1);
+ i2cp_bringup (I2C2);
+
+ i2c_unlock();
+}
diff --git a/stm32/app/led.c b/stm32/app/led.c
new file mode 100644
index 0000000..57baa17
--- /dev/null
+++ b/stm32/app/led.c
@@ -0,0 +1,42 @@
+#include "project.h"
+
+
+#define LED GPIO13
+#define LED_PORT GPIOC
+
+static int led = 0;
+
+void
+led_init (void)
+{
+ MAP_OUTPUT_OD (LED);
+ SET (LED);
+
+}
+
+
+void
+led_clear (void)
+{
+ SET (LED);
+ led = 0;
+}
+
+void
+led_set (void)
+{
+ CLEAR (LED);
+ led = MS_TO_TICKS (200);
+}
+
+void
+led_tick (void)
+{
+ if (led) {
+ led--;
+
+ if (!led)
+ led_clear();
+ }
+
+}
diff --git a/stm32/app/main.c b/stm32/app/main.c
new file mode 100644
index 0000000..d834802
--- /dev/null
+++ b/stm32/app/main.c
@@ -0,0 +1,85 @@
+#include "project.h"
+
+#define WIGGLE GPIO4
+#define WIGGLE_PORT GPIOB
+
+int
+main (void)
+{
+ unsigned cnt = 0;
+
+ //nvic_set_priority_grouping(NVIC_PriorityGroup_4);
+
+ /*set up pll */
+ rcc_clock_setup_in_hse_8mhz_out_72mhz();
+
+ /*turn on clocks which aren't done elsewhere */
+ rcc_periph_clock_enable (RCC_GPIOA);
+ rcc_periph_clock_enable (RCC_GPIOB);
+ rcc_periph_clock_enable (RCC_GPIOC);
+ rcc_periph_clock_enable (RCC_AFIO);
+
+
+ /*Adjust interrupt priorities so that taco trumps uarts trumps timer trumps dma */
+ nvic_set_priority (TACHO_IRQ, 0x20);
+ nvic_set_priority (NVIC_USART1_IRQ, 0x40);
+ nvic_set_priority (NVIC_SYSTICK_IRQ, 0x60);
+ nvic_set_priority (NVIC_DMA1_CHANNEL6_IRQ, 0x80);
+
+ /* Claw some pins pack */
+ gpio_primary_remap (AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, 0);
+
+ dwt_enable_cycle_counter();
+
+ ticker_init();
+
+
+ led_init();
+ usart_init();
+ i2cp_init();
+
+ printf ("Hello world\n");
+
+ led_set();
+ tacho_init();
+
+ delay_ms (100);
+
+
+ oled1_init();
+ oled2_init();
+
+ gauge_init();
+
+
+
+ font8x8_put_str (vram_1, "ABC fish soup!", 0, 0);
+
+ MAP_OUTPUT_PP (WIGGLE);
+
+
+ for (;;) {
+ char buf[20];
+
+ sprintf (buf, "%6u rpm", (unsigned) raw_tacho);
+ font8x16_put_str (vram_1, buf, 30, 8);
+
+ sprintf (buf, "%8d", cnt++);
+ font8x8_put_str (vram_1, buf, 0, 24);
+
+ sprintf (buf, "%6d", cnt >> 4);
+ font21x32_put_str (vram_2, buf, 0);
+
+
+ if (cnt & 1)
+ SET (WIGGLE);
+ else
+ CLEAR (WIGGLE);
+
+
+ gauge_test();
+
+ }
+
+ return 0;
+}
diff --git a/stm32/app/not/i2c_bb.c b/stm32/app/not/i2c_bb.c
new file mode 100644
index 0000000..3076605
--- /dev/null
+++ b/stm32/app/not/i2c_bb.c
@@ -0,0 +1,164 @@
+#include "project.h"
+
+#define SCL GPIO6
+#define SDA GPIO7
+
+static uint8_t
+set (uint8_t sda, uint8_t scl)
+{
+ uint8_t ret;
+ if (sda)
+ gpio_set (GPIOB, SDA);
+ else
+ gpio_clear (GPIOB, SDA);
+
+ if (scl)
+ gpio_set (GPIOB, SCL);
+ else
+ gpio_clear (GPIOB, SCL);
+
+ delay_us (10);
+ ret = (gpio_get (GPIOB, SDA) & SDA) ? 1 : 0;
+
+ return ret;
+}
+
+
+
+
+uint8_t
+i2cb_send (uint8_t wot)
+{
+ uint8_t i;
+
+ printf ("%02x", wot);
+
+ for (i = 0; i < 8; ++i)
+ {
+ set (wot & 0x80, 0);
+ set (wot & 0x80, 1);
+ set (wot & 0x80, 0);
+ wot <<= 1;
+ }
+ set (1, 0);
+ i = set (1, 1);
+ set (1, 0);
+
+ printf ("%c", i ? '!' : '.');
+ return i;
+}
+
+uint8_t
+i2cb_send_addr (uint8_t addr, uint8_t rnw)
+{
+ return i2cb_send (addr << 1 | rnw);
+}
+
+uint8_t
+i2cb_read (uint8_t ack)
+{
+ uint8_t i, wot = 0;
+
+ for (i = 0; i < 8; ++i)
+ {
+ wot <<= 1;
+ set (1, 0);
+ wot |= set (1, 1);
+ set (1, 0);
+ }
+ set (ack, 0);
+ set (ack, 1);
+ set (ack, 0);
+ return wot;
+}
+
+
+void
+i2cb_start (void)
+{
+ printf ("S");
+ set (1, 1);
+ set (0, 1);
+ set (0, 0);
+}
+
+void
+i2cb_stop (void)
+{
+ printf ("R\n");
+ set (0, 0);
+ set (0, 1);
+ set (1, 1);
+}
+
+
+int
+i2cb_start_transaction (uint8_t a, uint8_t rnw)
+{
+ i2cb_start ();
+ return i2cb_send_addr (a, rnw);
+
+}
+
+
+void
+i2cb_reset (void)
+{
+ i2cb_start ();
+ i2cb_stop ();
+ i2cb_start ();
+ i2cb_stop ();
+}
+
+
+
+void
+i2cb_scan (void)
+{
+ uint8_t r;
+ uint16_t i;
+
+ i2cb_reset ();
+
+ printf ("Probing bus\n");
+ for (i = 0; i < 128; ++i)
+ {
+ i2cb_start ();
+ i2cb_stop ();
+ i2cb_start ();
+ r = i2cb_send ((i << 1) | I2C_WRITE);
+ i2cb_stop ();
+
+ if (!r)
+ printf ("Found device at address 0x%x\n", i);
+ }
+ printf ("Done\n");
+ i2cb_reset ();
+
+}
+
+void
+i2cb_init (void)
+{
+ gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL,
+ SCL);
+ gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN,
+ SDA);
+
+ set (1, 1);
+#ifdef DEBUG_I2C
+ printf ("T11 %d:%d\n", !!(SDA_IN_REG & SDA_VAL), !!(SCL_IN_REG & SCL_VAL));
+#endif
+ set (0, 1);
+#ifdef DEBUG_I2C
+ printf ("T01 %d:%d\n", !!(SDA_IN_REG & SDA_VAL), !!(SCL_IN_REG & SCL_VAL));
+#endif
+ set (1, 0);
+#ifdef DEBUG_I2C
+ printf ("T10 %d:%d\n", !!(SDA_IN_REG & SDA_VAL), !!(SCL_IN_REG & SCL_VAL));
+#endif
+ set (1, 1);
+#ifdef DEBUG_I2C
+ printf ("T11 %d:%d\n", !!(SDA_IN_REG & SDA_VAL), !!(SCL_IN_REG & SCL_VAL));
+#endif
+}
diff --git a/stm32/app/not/lcd.c b/stm32/app/not/lcd.c
new file mode 100644
index 0000000..d6ee5c7
--- /dev/null
+++ b/stm32/app/not/lcd.c
@@ -0,0 +1,477 @@
+#include "project.h"
+
+
+#define PCF8574_I2C_ADDRESS 0x27
+
+#define LINE_RS 0x1
+#define LINE_RnW 0x2
+#define LINE_EN 0x4
+#define LINE_BACKLIGHT 0x8
+
+#define LCD_CLEAR 0x1
+#define LCD_HOME 0x2
+
+#define LCD_DISP 0x8
+#define LCD_DISP_ON 0x4
+#define LCD_DISP_CURSOR 0x2
+#define LCD_DISP_CURSOR_BLINK 0x1
+
+#define LCD_FUNC 0x20
+#define LCD_FUNC_8BIT 0x10
+#define LCD_FUNC_4BIT 0x00
+#define LCD_FUNC_2ROWS 0x08
+#define LCD_FUNC_1ROW 0x00
+#define LCD_FUNC_5x10 0x04
+#define LCD_FUNC_5X7 0x00
+
+#define LCD_SET_DDRAM_ADDR 0x80
+
+#define LCD_H_SHIFT 5
+#define LCD_RS (1 << LCD_H_SHIFT)
+#define LCD_W 20
+#define LCD_W_MASK (LCD_RS -1 )
+#define LCD_H 4
+#define LCD_SZ (LCD_H << LCD_H_SHIFT)
+#define LCD_POS(c,r) (((r) << LCD_H_SHIFT ) +(c))
+
+#define BYTES_PER_BYTE 6
+
+#define DMA_BUF_SZ (BYTES_PER_BYTE * ( (1 + LCD_W) *LCD_H + 1))
+
+static uint8_t dma_buf[DMA_BUF_SZ];
+static uint8_t update_buf[DMA_BUF_SZ];
+static int dma_in_progress = 0;
+static int refresh_enabled = 0;
+
+static int backlight;
+static int pos;
+
+static void
+clock_nibble (uint8_t n)
+{
+ if (backlight)
+ n |= LINE_BACKLIGHT;
+ i2cp_send(n);
+ i2cp_send(LINE_EN | n);
+ i2cp_send(n);
+}
+
+
+static void
+write_reg (uint8_t c, int r)
+{
+ uint8_t b;
+
+ b = c & 0xf0;
+ if (r)
+ b |= LINE_RS;
+
+ clock_nibble (b);
+
+ b = (c & 0xf) << 4;
+ if (r)
+ b |= LINE_RS;
+
+ clock_nibble (b);
+}
+
+static void
+send_command (uint8_t c)
+{
+ write_reg (c, 0);
+}
+
+static void
+send_one_command (uint8_t cmd, int delay)
+{
+ while (i2c_lock ());
+ i2cp_start_transaction (PCF8574_I2C_ADDRESS, I2C_WRITE);
+ send_command (cmd);
+ i2cp_stop ();
+ if (delay)
+ delay_ms (delay);
+ i2c_unlock ();
+}
+
+
+
+static void
+cls (void)
+{
+ send_one_command (LCD_CLEAR, 2);
+}
+
+#if 0
+static void
+home (void)
+{
+ send_one_command (LCD_HOME, 2);
+}
+#endif
+
+static void
+on (void)
+{
+ send_one_command (LCD_DISP | LCD_DISP_ON /* | LCD_DISP_CURSOR */ , 4);
+}
+
+static void
+off (void)
+{
+ send_one_command (LCD_DISP, 4);
+}
+
+static int
+lcd_addr (int x, int y)
+{
+ return x + ((y & 1) << 6) + ((y & 2) ? 20 : 0);
+}
+
+
+#if 0
+static void
+move (uint8_t c, uint8_t r)
+{
+ send_one_command (LCD_SET_DDRAM_ADDR | lcd_addr (c, r), 2);
+}
+#endif
+
+
+uint32_t refresh_wdt = 0;
+
+static void
+start_dma (void)
+{
+ if (dma_in_progress)
+ return;
+
+ refresh_wdt = 0;
+
+ dma_in_progress = 1;
+
+ memcpy (dma_buf, update_buf, DMA_BUF_SZ);
+ i2cp_start_transaction (PCF8574_I2C_ADDRESS, I2C_WRITE);
+ i2cp_start_dma (dma_buf, DMA_BUF_SZ);
+
+}
+
+void
+dma1_channel6_isr (void)
+{
+ if (dma_in_progress)
+ {
+ i2cp_stop_dma ();
+
+ i2cp_stop ();
+ dma_in_progress = 0;
+ }
+
+ if (refresh_enabled)
+ start_dma ();
+}
+
+void
+lcd_refresh_wdt (void)
+{
+ refresh_wdt++;
+
+ if (refresh_wdt < 1000)
+ return;
+
+ refresh_wdt = 0;
+
+/*No refresh for 1s, restart everything */
+
+ i2cp_stop_dma ();
+ i2cp_stop ();
+ dma_in_progress = 0;
+
+ start_dma ();
+
+}
+
+static inline void
+dma_clock_nibble (uint8_t * ptr, uint8_t n)
+{
+ if (backlight)
+ n |= LINE_BACKLIGHT;
+ *(ptr++) = n;
+ *(ptr++) = n | LINE_EN;
+ *(ptr++) = n;
+}
+
+
+static inline int
+dma_write_reg (uint8_t * ptr, uint8_t c, int r)
+{
+ uint8_t b;
+
+ b = c & 0xf0;
+ if (r)
+ b |= LINE_RS;
+
+ dma_clock_nibble (ptr, b);
+ ptr += 3;
+
+ b = (c & 0xf) << 4;
+ if (r)
+ b |= LINE_RS;
+
+ dma_clock_nibble (ptr, b);
+
+ return 6;
+}
+
+static inline int
+dma_command (uint8_t * ptr, uint8_t c)
+{
+ return dma_write_reg (ptr, c, 0);
+}
+
+static inline int
+dma_data (uint8_t * ptr, uint8_t c)
+{
+ return dma_write_reg (ptr, c, 1);
+}
+
+
+static void
+dma_generate_stream (void)
+{
+ uint8_t *dma_ptr;
+ int x, y, i;
+
+ dma_ptr = update_buf;
+/* 6 bytes per character, 6 bytes to move position, 5 moves + 20*4 chars => 510*/
+
+ for (y = 0; y < LCD_H; ++y)
+ {
+
+ dma_ptr += dma_command (dma_ptr, LCD_SET_DDRAM_ADDR | lcd_addr (0, y));
+
+ i = y << LCD_H_SHIFT;
+
+ for (x = 0; x < LCD_W; ++x, i++)
+ {
+ dma_ptr += dma_data (dma_ptr, ' ');
+ }
+ }
+
+ dma_ptr += dma_command (dma_ptr, LCD_SET_DDRAM_ADDR |
+ lcd_addr (pos & LCD_W_MASK, pos >> LCD_H_SHIFT));
+
+}
+
+
+static void
+dma_change_backlight (void)
+{
+ int len = DMA_BUF_SZ;
+ uint8_t *p = update_buf;
+
+ cm_disable_interrupts ();
+
+ if (backlight)
+ while (p++, len--)
+ *p |= LINE_BACKLIGHT;
+ else
+ while (p++, len--)
+ *p &= ~LINE_BACKLIGHT;
+
+ cm_enable_interrupts ();
+}
+
+
+static int
+dma_offset (int x, int y)
+{
+ return BYTES_PER_BYTE * (1 + x + y * (LCD_W + 1));
+}
+
+
+
+static void
+_lcd_write_char (uint8_t c, int x, int y)
+{
+ cm_disable_interrupts ();
+ dma_data (update_buf + dma_offset (x, y), c);
+ cm_enable_interrupts ();
+}
+
+
+void
+lcd_write_char (uint8_t c, int x, int y)
+{
+ cm_disable_interrupts ();
+ _lcd_write_char (c, x, y);
+ cm_enable_interrupts ();
+}
+
+
+void
+lcd_erase (int x, int y, int w)
+{
+ uint8_t *dma_ptr = update_buf + dma_offset (x, y);
+ cm_disable_interrupts ();
+ while (w--)
+ dma_ptr += dma_data (dma_ptr, ' ');
+ cm_enable_interrupts ();
+}
+
+void
+lcd_erase_line (int w, int y)
+{
+ lcd_erase (0, y, w);
+}
+
+void
+lcd_erase_all (void)
+{
+ int y;
+ for (y = 0; y < LCD_H; ++y)
+ {
+ lcd_erase (0, 0, LCD_W);
+ }
+}
+
+void
+lcd_write (char *c, int x, int y)
+{
+ cm_disable_interrupts ();
+ while (*c)
+ {
+ _lcd_write_char (*(c++), x++, y);
+ if (x == LCD_W)
+ break;
+ }
+ cm_enable_interrupts ();
+}
+
+#if 0
+static void
+lcd_scroll (uint8_t * p)
+{
+ int i;
+ for (i = 0; i < 3; ++i)
+ {
+ memcpy (p, p + LCD_RS, LCD_W);
+ p += LCD_RS;
+ }
+ memset (p, ' ', LCD_W);
+}
+
+void
+lcd_putc (uint8_t c)
+{
+
+ switch (c)
+ {
+ case '\r':
+ pos &= ~LCD_W_MASK;
+ break;
+ case '\n':
+ pos &= ~LCD_W_MASK;
+ pos += LCD_RS;
+ break;
+ default:
+ buf[pos] = c;
+ pos++;
+ }
+
+
+ if ((pos & LCD_W_MASK) == LCD_W)
+ {
+ pos &= ~LCD_W_MASK;
+ pos += LCD_RS;
+ }
+
+ if (pos == LCD_SZ)
+ {
+ lcd_scroll (buf);
+ pos -= LCD_RS;
+ }
+
+
+}
+#endif
+
+
+void
+lcd_backlight (int i)
+{
+ backlight = i;
+
+ dma_change_backlight ();
+
+ if (refresh_enabled)
+ return;
+
+ while (i2c_lock ());
+ i2cp_start_transaction (PCF8574_I2C_ADDRESS, I2C_WRITE);
+ i2cp_send(backlight ? LINE_BACKLIGHT : 0);
+ i2cp_stop ();
+ i2c_unlock ();
+}
+
+
+
+
+
+void
+lcd_enable_refresh (void)
+{
+ refresh_enabled = 1;
+ start_dma ();
+}
+
+
+void
+lcd_disable_refresh (void)
+{
+ refresh_enabled = 0;
+ while (dma_in_progress);
+}
+
+
+
+void
+lcd_reset (void)
+{
+ while (i2c_lock ());
+ i2cp_start_transaction (PCF8574_I2C_ADDRESS, I2C_WRITE);
+ clock_nibble (0x30);
+ delay_ms (5);
+ clock_nibble (0x30);
+ delay_us (64);
+ clock_nibble (0x30);
+ delay_us (64);
+ clock_nibble (0x20);
+
+ send_command (LCD_FUNC | LCD_FUNC_4BIT | LCD_FUNC_2ROWS | LCD_FUNC_5X7);
+ i2cp_stop ();
+ i2c_unlock ();
+
+ on ();
+ cls ();
+}
+
+void
+lcd_init (void)
+{
+ lcd_backlight (0);
+ lcd_reset ();
+ lcd_backlight (1);
+
+ dma_generate_stream ();
+
+ nvic_enable_irq (NVIC_DMA1_CHANNEL6_IRQ);
+ lcd_enable_refresh ();
+}
+
+void
+lcd_shutdown (void)
+{
+ lcd_disable_refresh ();
+ lcd_backlight (0);
+ off ();
+}
diff --git a/stm32/app/oled.c b/stm32/app/oled.c
new file mode 100644
index 0000000..983fe9a
--- /dev/null
+++ b/stm32/app/oled.c
@@ -0,0 +1,190 @@
+#include "project.h"
+
+
+int
+ssd1306_cmds (uint32_t i2c, uint8_t *buf, size_t len, int delay)
+{
+
+ int ret = -1;
+
+ while (i2c_lock());
+
+ do {
+
+ if (i2cp_start_transaction (i2c, SSD1306_I2C_ADDRESS, I2C_WRITE))
+ break;
+
+ if (i2cp_send (i2c, SSD1306_COMMAND))
+ break;
+
+ while (len--)
+ if (i2cp_send (i2c, * (buf++)))
+ break;
+
+ i2cp_stop (i2c);
+
+ if (delay)
+ delay_us (delay);
+
+ ret = 0;
+ } while (0);
+
+ i2c_unlock();
+
+
+ return ret;
+}
+
+int
+ssd1306_cmd (uint32_t i2c, uint8_t cmd, int delay)
+{
+ return ssd1306_cmds (i2c, &cmd, 1, delay);
+}
+
+
+
+void
+oled_generate_stream (uint8_t *vram)
+{
+ memset (vram, 0, DMA_BUF_SZ);
+ vram[0] = SSD1306_DATA_CONTINUE;
+}
+
+
+
+
+void
+oled_cls (uint8_t *vram)
+{
+ memset (vram + 1, 0, SSD1306_VRAM_SIZE);
+}
+
+
+void
+oled_on (uint32_t i2c)
+{
+ ssd1306_cmd (i2c, SSD1306_DISPLAY_ON, 0);
+
+}
+
+
+void
+oled_off (uint32_t i2c)
+{
+ ssd1306_cmd (i2c, SSD1306_DISPLAY_OFF, 0);
+}
+
+
+
+#if 0
+void
+oled_squirt (void)
+{
+ unsigned i;
+ uint8_t cmds[] = {
+ SSD1306_SET_PAGE_ADDR, 0, 0xff,
+ SSD1306_SET_COLUMN_ADDR, 0, SSD1306_WIDTH - 1
+ };
+
+ ssd1306_cmds (cmds, sizeof (cmds), 0);
+
+
+ while (i2c_lock());
+
+ i2cp_start_transaction (SSD1306_I2C_ADDRESS, I2C_WRITE);
+
+ for (i = 0; i < DMA_BUF_SZ; ++i)
+ i2cp_send (update_buf[i]);
+
+ i2cp_stop();
+
+ i2c_unlock();
+}
+#endif
+
+void
+oled_reset (uint32_t i2c)
+{
+ uint8_t init[] = {
+ SSD1306_DISPLAY_OFF,
+ SSD1306_SET_DISPLAY_CLOCK_DIV_RATIO, 0x80,
+ SSD1306_SET_MULTIPLEX_RATIO, SSD1306_HEIGHT - 1,
+ SSD1306_SET_DISPLAY_OFFSET, 0x0,
+ SSD1306_SET_START_LINE | 0x0,
+ SSD1306_CHARGE_PUMP, 0x14,
+ SSD1306_MEMORY_ADDR_MODE, 0x00,
+ SSD1306_SET_SEGMENT_REMAP | 0x1,
+ SSD1306_COM_SCAN_DIR_DEC,
+ //SSD1306_SET_COM_PINS, 0x12,
+ SSD1306_SET_COM_PINS, 0x02,
+ //SSD1306_SET_CONTRAST_CONTROL, 0xCF,
+ SSD1306_SET_CONTRAST_CONTROL, 0x8F,
+ SSD1306_SET_PRECHARGE_PERIOD, 0xF1,
+ SSD1306_SET_VCOM_DESELECT, 0x40,
+ SSD1306_DISPLAY_ALL_ON_RESUME,
+ SSD1306_NORMAL_DISPLAY,
+ SSD1306_DISPLAY_ON,
+ };
+
+ ssd1306_cmds (i2c, init, sizeof (init), 0);
+}
+
+
+void
+oled_const_strip (uint8_t *vram, int x, int xe, uint8_t and, uint8_t or)
+{
+ uint8_t r;
+
+ for (x++; x <= xe; ++x) {
+ r = vram[x] & and;
+ vram[x] = r | or;
+ }
+}
+
+
+void
+oled_blit_strip (uint8_t *vram, int x, int xe, uint8_t mask, int shift,
+ const uint8_t *src)
+{
+ uint8_t r, s;
+
+ while (x < 0) {
+ x++;
+ src++;
+ };
+
+ if (xe < 0) xe = 0;
+
+ if (x > SSD1306_VRAM_SIZE) xe = SSD1306_VRAM_SIZE;
+
+ if (xe > SSD1306_VRAM_SIZE) xe = SSD1306_VRAM_SIZE;
+
+
+ if (shift > 0) {
+ for (x++; x <= xe; ++x) {
+ s = * (src++);
+ s <<= shift;
+ s &= mask;
+ r = vram[x] & ~mask;
+ vram[x] = r | s;
+
+ }
+ } else if (shift < 0) {
+ shift = -shift;
+
+ for (x++; x <= xe; ++x) {
+ s = * (src++);
+ s >>= shift;
+ s &= mask;
+ r = vram[x] & ~mask;
+ vram[x] = r | s;
+ }
+ } else {
+ for (x++; x <= xe; ++x) {
+ s = * (src++);
+ s &= mask;
+ r = vram[x] & ~mask;
+ vram[x] = r | s;
+ }
+ }
+}
diff --git a/stm32/app/oled.h b/stm32/app/oled.h
new file mode 100644
index 0000000..0786981
--- /dev/null
+++ b/stm32/app/oled.h
@@ -0,0 +1,49 @@
+
+#define SSD1306_I2C_ADDRESS 0x3C
+
+#define SSD1306_COMMAND 0x00
+#define SSD1306_DATA 0xC0
+#define SSD1306_DATA_CONTINUE 0x40
+
+#define SSD1306_SET_CONTRAST_CONTROL 0x81
+#define SSD1306_DISPLAY_ALL_ON_RESUME 0xA4
+#define SSD1306_DISPLAY_ALL_ON 0xA5
+#define SSD1306_NORMAL_DISPLAY 0xA6
+#define SSD1306_INVERT_DISPLAY 0xA7
+#define SSD1306_DISPLAY_OFF 0xAE
+#define SSD1306_DISPLAY_ON 0xAF
+#define SSD1306_NOP 0xE3
+
+#define SSD1306_HORIZONTAL_SCROLL_RIGHT 0x26
+#define SSD1306_HORIZONTAL_SCROLL_LEFT 0x27
+#define SSD1306_HORIZONTAL_SCROLL_VERTICAL_AND_RIGHT 0x29
+#define SSD1306_HORIZONTAL_SCROLL_VERTICAL_AND_LEFT 0x2A
+#define SSD1306_DEACTIVATE_SCROLL 0x2E
+#define SSD1306_ACTIVATE_SCROLL 0x2F
+#define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3
+
+#define SSD1306_SET_LOWER_COLUMN 0x00
+#define SSD1306_SET_HIGHER_COLUMN 0x10
+#define SSD1306_MEMORY_ADDR_MODE 0x20
+#define SSD1306_SET_COLUMN_ADDR 0x21
+#define SSD1306_SET_PAGE_ADDR 0x22
+
+#define SSD1306_SET_START_LINE 0x40
+#define SSD1306_SET_SEGMENT_REMAP 0xA0
+#define SSD1306_SET_MULTIPLEX_RATIO 0xA8
+#define SSD1306_COM_SCAN_DIR_INC 0xC0
+#define SSD1306_COM_SCAN_DIR_DEC 0xC8
+#define SSD1306_SET_DISPLAY_OFFSET 0xD3
+#define SSD1306_SET_COM_PINS 0xDA
+#define SSD1306_CHARGE_PUMP 0x8D
+
+#define SSD1306_SET_DISPLAY_CLOCK_DIV_RATIO 0xD5
+#define SSD1306_SET_PRECHARGE_PERIOD 0xD9
+#define SSD1306_SET_VCOM_DESELECT 0xDB
+
+#define SSD1306_WIDTH 128
+#define SSD1306_HEIGHT 32
+
+#define SSD1306_VRAM_SIZE (SSD1306_WIDTH * ((SSD1306_HEIGHT + 7) >> 3))
+
+#define DMA_BUF_SZ (2 + (SSD1306_VRAM_SIZE))
diff --git a/stm32/app/oled1.c b/stm32/app/oled1.c
new file mode 100644
index 0000000..0798568
--- /dev/null
+++ b/stm32/app/oled1.c
@@ -0,0 +1,124 @@
+#include "project.h"
+
+
+static uint8_t dma_buf[DMA_BUF_SZ];
+uint8_t vram_1[DMA_BUF_SZ];
+
+static int dma_in_progress = 0;
+static int refresh_enabled = 0;
+static uint32_t refresh_wdt = 0;
+static int oled_sad = 0;
+
+
+static void
+start_dma (void)
+{
+ uint8_t cmds[] = {
+ SSD1306_SET_PAGE_ADDR, 0, 0xff,
+ SSD1306_SET_COLUMN_ADDR, 0, SSD1306_WIDTH - 1
+ };
+
+ if (dma_in_progress)
+ return;
+
+
+ memcpy (dma_buf, vram_1, DMA_BUF_SZ);
+
+ if (ssd1306_cmds (I2C1, cmds, sizeof (cmds), 0)) {
+ oled_sad++;
+ return;
+ }
+
+ if (i2cp_start_transaction (I2C1, SSD1306_I2C_ADDRESS, I2C_WRITE)) {
+ oled_sad++;
+ return;
+ }
+
+ refresh_wdt = 0;
+ dma_in_progress = 1;
+
+ i2cp1_start_dma (dma_buf, DMA_BUF_SZ);
+}
+
+
+
+void
+dma1_channel6_isr (void)
+{
+ if (dma_in_progress) {
+ i2cp1_stop_dma();
+
+ i2cp_stop (I2C1);
+ dma_in_progress = 0;
+ }
+
+ if (refresh_enabled)
+ start_dma();
+}
+
+void
+oled1_ticker (void)
+{
+ if (!refresh_enabled)
+ return;
+
+ refresh_wdt++;
+
+ if ((refresh_wdt < MS_TO_TICKS (1000)) && (!oled_sad))
+ return;
+
+ refresh_wdt = 0;
+
+ /*No refresh for 1s, restart everything */
+
+ i2cp1_stop_dma();
+ i2cp_stop (I2C1);
+ dma_in_progress = 0;
+
+ if (oled_sad) {
+ oled_sad = 0;
+ i2cp1_reset_sm();
+ }
+
+ start_dma();
+
+}
+
+void
+oled1_enable_refresh (void)
+{
+ refresh_enabled = 1;
+ start_dma();
+}
+
+
+void
+oled1_disable_refresh (void)
+{
+ refresh_enabled = 0;
+
+ while (dma_in_progress);
+}
+
+
+
+void
+oled1_init (void)
+{
+ oled_reset (I2C1);
+
+ delay_us (100);
+
+ oled_generate_stream (vram_1);
+
+ nvic_enable_irq (NVIC_DMA1_CHANNEL6_IRQ);
+ oled1_enable_refresh();
+}
+
+
+void
+oled1_shutdown (void)
+{
+ oled1_disable_refresh();
+ oled_off (I2C1);
+}
diff --git a/stm32/app/oled2.c b/stm32/app/oled2.c
new file mode 100644
index 0000000..bccb4ba
--- /dev/null
+++ b/stm32/app/oled2.c
@@ -0,0 +1,124 @@
+#include "project.h"
+
+
+static uint8_t dma_buf[DMA_BUF_SZ];
+uint8_t vram_2[DMA_BUF_SZ];
+
+static int dma_in_progress = 0;
+static int refresh_enabled = 0;
+static uint32_t refresh_wdt = 0;
+static int oled_sad = 0;
+
+
+static void
+start_dma (void)
+{
+ uint8_t cmds[] = {
+ SSD1306_SET_PAGE_ADDR, 0, 0xff,
+ SSD1306_SET_COLUMN_ADDR, 0, SSD1306_WIDTH - 1
+ };
+
+ if (dma_in_progress)
+ return;
+
+
+ memcpy (dma_buf, vram_2, DMA_BUF_SZ);
+
+ if (ssd1306_cmds (I2C2, cmds, sizeof (cmds), 0)) {
+ oled_sad++;
+ return;
+ }
+
+ if (i2cp_start_transaction (I2C2, SSD1306_I2C_ADDRESS, I2C_WRITE)) {
+ oled_sad++;
+ return;
+ }
+
+ refresh_wdt = 0;
+ dma_in_progress = 1;
+
+ i2cp2_start_dma (dma_buf, DMA_BUF_SZ);
+}
+
+
+
+void
+dma1_channel4_isr (void)
+{
+ if (dma_in_progress) {
+ i2cp2_stop_dma();
+
+ i2cp_stop (I2C2);
+ dma_in_progress = 0;
+ }
+
+ if (refresh_enabled)
+ start_dma();
+}
+
+void
+oled2_ticker (void)
+{
+ if (!refresh_enabled)
+ return;
+
+ refresh_wdt++;
+
+ if ((refresh_wdt < MS_TO_TICKS (1000)) && (!oled_sad))
+ return;
+
+ refresh_wdt = 0;
+
+ /*No refresh for 1s, restart everything */
+
+ i2cp2_stop_dma();
+ i2cp_stop (I2C2);
+ dma_in_progress = 0;
+
+ if (oled_sad) {
+ oled_sad = 0;
+ i2cp2_reset_sm();
+ }
+
+ start_dma();
+
+}
+
+void
+oled2_enable_refresh (void)
+{
+ refresh_enabled = 1;
+ start_dma();
+}
+
+
+void
+oled2_disable_refresh (void)
+{
+ refresh_enabled = 0;
+
+ while (dma_in_progress);
+}
+
+
+
+void
+oled2_init (void)
+{
+ oled_reset (I2C2);
+
+ delay_us (100);
+
+ oled_generate_stream (vram_2);
+
+ nvic_enable_irq (NVIC_DMA1_CHANNEL4_IRQ);
+ oled2_enable_refresh();
+}
+
+
+void
+oled2_shutdown (void)
+{
+ oled2_disable_refresh();
+ oled_off (I2C2);
+}
diff --git a/stm32/app/pins.h b/stm32/app/pins.h
new file mode 100644
index 0000000..a29e48f
--- /dev/null
+++ b/stm32/app/pins.h
@@ -0,0 +1,55 @@
+#ifndef _PINS_H_
+#define _PINS_H_
+
+/* st seem to change these with every chip revision */
+
+#define MAP_AF_PP(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, a ); \
+ } while (0)
+
+#define MAP_AF(a) MAP_AF_PP(a)
+
+/* STM32F1 doesn't have AF pull up, but also doesn't disconnect af inputs so just use regular pull up */
+#define MAP_AF_PU(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, a); \
+ gpio_set( a ## _PORT, a); \
+ } while (0)
+
+#define MAP_AF_OD(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_OPENDRAIN, a ); \
+ } while (0)
+
+
+#define MAP_OUTPUT_PP(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, a ); \
+ } while (0)
+
+
+#define MAP_OUTPUT_OD(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, a ); \
+ } while (0)
+
+
+/* STM32F1 madly uses the output register to drive the other end of the resistor, so pull up */
+/* requires us to write a 1 there */
+
+#define MAP_INPUT_PU(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, a); \
+ gpio_set( a ## _PORT, a); \
+ } while (0)
+
+
+#define MAP_INPUT(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, a); \
+ } while (0)
+
+#define MAP_ANALOG(a) do { \
+ gpio_set_mode( a ## _PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_ANALOG, a); \
+ } while (0)
+
+
+#define CLEAR(a) gpio_clear( a ## _PORT, a)
+#define SET(a) gpio_set( a ## _PORT, a)
+#define GET(a) gpio_get( a ## _PORT, a)
+
+#endif
diff --git a/stm32/app/project.h b/stm32/app/project.h
new file mode 100644
index 0000000..8c729d8
--- /dev/null
+++ b/stm32/app/project.h
@@ -0,0 +1,42 @@
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <libopencm3/stm32/rcc.h>
+#include <libopencm3/stm32/gpio.h>
+#include <libopencm3/stm32/usart.h>
+#include <libopencm3/stm32/dma.h>
+#include <libopencm3/stm32/i2c.h>
+#include <libopencm3/stm32/adc.h>
+#include <libopencm3/stm32/exti.h>
+#include <libopencm3/cm3/systick.h>
+#include <libopencm3/cm3/nvic.h>
+#include <libopencm3/cm3/cortex.h>
+#include <libopencm3/cm3/scb.h>
+#include <libopencm3/cm3/dwt.h>
+
+#include <stdio.h>
+#include <errno.h>
+
+#define TICK_BASE 9000
+#define TICK_DIV 12000
+#define TICKS_TO_US(a) (((a)*TICK_DIV*1000)/TICK_BASE)
+#define MS_TO_TICKS(a) (((a)*1000)/TICKS_TO_US(1))
+
+#include "pins.h"
+
+#include "i2c.h"
+
+#include "oled.h"
+
+#include "ring.h"
+#include "tacho.h"
+
+
+#define US(a) (72*(a))
+#define MS(a) (US(a) * 1000 )
+#define HZ(a) (MS(a) * 1000)
+
+
+#define T do { printf("%s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__); } while (0)
+
+#include "prototypes.h"
diff --git a/stm32/app/prototypes.h b/stm32/app/prototypes.h
new file mode 100644
index 0000000..4649eb3
--- /dev/null
+++ b/stm32/app/prototypes.h
@@ -0,0 +1,92 @@
+/* main.c */
+extern int main(void);
+/* led.c */
+extern void led_init(void);
+extern void led_clear(void);
+extern void led_set(void);
+extern void led_tick(void);
+/* i2c.c */
+extern int i2c_lock(void);
+extern void i2c_unlock(void);
+/* usart.c */
+extern ring_t rx1_ring;
+extern ring_t tx1_ring;
+extern void usart1_isr(void);
+extern int _write(int file, char *ptr, int len);
+extern void usart1_queue(uint8_t d);
+extern void usart1_drain(void);
+extern void usart_init(void);
+/* ring.c */
+extern void ring_init(ring_t *r, uint8_t *buf, size_t len);
+extern int ring_write_byte(ring_t *r, uint8_t c);
+extern int ring_read_byte(ring_t *r, uint8_t *c);
+extern int ring_write(ring_t *r, uint8_t *buf, size_t len);
+extern int ring_empty(ring_t *r);
+/* ticker.c */
+extern void delay_us(uint32_t d);
+extern void sys_tick_handler(void);
+extern void delay_ms(uint32_t d);
+extern void ticker_init(void);
+/* oled.c */
+extern int ssd1306_cmds(uint32_t i2c, uint8_t *buf, size_t len, int delay);
+extern int ssd1306_cmd(uint32_t i2c, uint8_t cmd, int delay);
+extern void oled_generate_stream(uint8_t *vram);
+extern void oled_cls(uint8_t *vram);
+extern void oled_on(uint32_t i2c);
+extern void oled_off(uint32_t i2c);
+extern void oled_reset(uint32_t i2c);
+extern void oled_const_strip(uint8_t *vram, int x, int xe, uint8_t and, uint8_t or);
+extern void oled_blit_strip(uint8_t *vram, int x, int xe, uint8_t mask, int shift, const uint8_t *src);
+/* i2c_hw.c */
+extern void i2c_clear_start(uint32_t i2c);
+extern int i2cp_start(uint32_t i2c);
+extern void i2cp_abort_start(uint32_t i2c);
+extern void i2cp_stop(uint32_t i2c);
+extern void i2cp_abort_stop(uint32_t i2c);
+extern int i2cp_send(uint32_t i2c, uint8_t v);
+extern int i2cp_start_transaction(uint32_t i2c, uint8_t a, int wnr);
+extern void i2cp1_reset_sm(void);
+extern void i2cp2_reset_sm(void);
+extern void i2cp1_start_dma(uint8_t *buf, int len);
+extern void i2cp2_start_dma(uint8_t *buf, int len);
+extern int i2cp1_dma_in_progress(void);
+extern int i2cp2_dma_in_progress(void);
+extern void i2cp1_stop_dma(void);
+extern void i2cp2_stop_dma(void);
+extern void i2cp_reset(uint32_t i2c);
+extern void i2cp_scan(uint32_t i2c);
+extern void i2cp_init(void);
+/* font8x8.c */
+extern void font8x8_put_ch(uint8_t *vram, unsigned ch, unsigned x, unsigned y);
+extern void font8x8_put_str(uint8_t *vram, char *str, unsigned x, unsigned y);
+/* font8x16.c */
+extern void font8x16_put_ch(uint8_t *vram, unsigned ch, unsigned x, unsigned y);
+extern void font8x16_put_str(uint8_t *vram, char *str, unsigned x, unsigned y);
+/* tacho.c */
+extern uint32_t raw_tacho;
+extern void exti3_isr(void);
+extern void tacho_init(void);
+/* oled1.c */
+extern uint8_t vram_1[(2 + ((128 * ((32 + 7) >> 3))))];
+extern void dma1_channel6_isr(void);
+extern void oled1_ticker(void);
+extern void oled1_enable_refresh(void);
+extern void oled1_disable_refresh(void);
+extern void oled1_init(void);
+extern void oled1_shutdown(void);
+/* oled2.c */
+extern uint8_t vram_2[(2 + ((128 * ((32 + 7) >> 3))))];
+extern void dma1_channel4_isr(void);
+extern void oled2_ticker(void);
+extern void oled2_enable_refresh(void);
+extern void oled2_disable_refresh(void);
+extern void oled2_init(void);
+extern void oled2_shutdown(void);
+/* font21x32.c */
+extern void font21x32_put_ch(uint8_t *vram, unsigned ch, unsigned x);
+extern void font21x32_put_str(uint8_t *vram, char *str, unsigned x);
+/* gauge.c */
+extern int gauge_target;
+extern void gauge_ticker(void);
+extern void gauge_test(void);
+extern void gauge_init(void);
diff --git a/stm32/app/ring.c b/stm32/app/ring.c
new file mode 100644
index 0000000..c1d1803
--- /dev/null
+++ b/stm32/app/ring.c
@@ -0,0 +1,69 @@
+#include "project.h"
+
+
+static inline size_t
+ring_next (ring_t *r, size_t p)
+{
+ p++;
+
+ if (p >= r->size)
+ p -= r->size;
+
+ return p;
+}
+
+void
+ring_init (ring_t *r, uint8_t *buf, size_t len)
+{
+ r->data = buf;
+ r->size = len;
+ r->write = 0;
+ r->read = 0;
+}
+
+int
+ring_write_byte (ring_t *r, uint8_t c)
+{
+ size_t n = ring_next (r, r->write);
+
+ if (n == r->read)
+ return -1;
+
+ r->data[r->write] = c;
+
+ r->write = n;
+
+ return 0;
+}
+
+
+int
+ring_read_byte (ring_t *r, uint8_t *c)
+{
+ size_t n = ring_next (r, r->read);
+
+ if (r->read == r->write)
+ return -1;
+
+ *c = r->data[r->read];
+ r->read = n;
+
+ return 0;
+}
+
+int
+ring_write (ring_t *r, uint8_t *buf, size_t len)
+{
+ while (len--) {
+ if (ring_write_byte (r, * (buf++)))
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+ring_empty (ring_t *r)
+{
+ return (r->read == r->write) ? 1 : 0;
+}
diff --git a/stm32/app/ring.h b/stm32/app/ring.h
new file mode 100644
index 0000000..1eae65b
--- /dev/null
+++ b/stm32/app/ring.h
@@ -0,0 +1,6 @@
+typedef struct ring {
+ uint8_t *data;
+ size_t size;
+ size_t write;
+ size_t read;
+} ring_t;
diff --git a/stm32/app/speedo.ld b/stm32/app/speedo.ld
new file mode 100644
index 0000000..0fb2378
--- /dev/null
+++ b/stm32/app/speedo.ld
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the libopencm3 project.
+ *
+ * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Linker script for Olimex STM32-H103 (STM32F103RBT6, 128K flash, 20K RAM). */
+
+/* Define memory regions. */
+MEMORY
+{
+ rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+ ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
+}
+
+/* Include the common ld script. */
+INCLUDE libopencm3_stm32f1.ld
+
+
+
+
+/* PROVIDE(_stack = dfu_shared_location ); */
+
+
+
diff --git a/stm32/app/tacho.c b/stm32/app/tacho.c
new file mode 100644
index 0000000..bf0222c
--- /dev/null
+++ b/stm32/app/tacho.c
@@ -0,0 +1,66 @@
+#include "project.h"
+
+#define SPURIOUS MS(10) /*Anything faster than 6000rpm is a false trigger */
+
+
+
+uint32_t raw_tacho;
+
+static uint32_t
+cycle_diff (uint32_t a, uint32_t b)
+{
+ return b - a;
+}
+
+
+
+void
+TACHO_ISR (void)
+{
+ uint32_t now, diff;
+ static uint32_t last_edge;
+
+ if (! (EXTI_PR & TACHO))
+ return;
+
+ EXTI_PR = TACHO;
+
+ now = dwt_read_cycle_counter();
+
+ diff = cycle_diff (last_edge, now);
+
+ if (diff < SPURIOUS)
+ return;
+
+ last_edge = now;
+
+
+ /* Want RPM, diff is in units of 1/72 us */
+
+ if (!diff)
+ return;
+
+ /* uint32_t is un-able to express 60s in clock ticks, so divide everything by 2 */
+
+ diff >>= 1;
+
+
+
+ raw_tacho = (US ((60U * 1000000) / 2)) / diff;
+
+}
+
+
+void
+tacho_init (void)
+{
+ MAP_INPUT_PU (TACHO);
+
+ exti_select_source (TACHO, TACHO_PORT);
+ exti_set_trigger (TACHO, EXTI_TRIGGER_FALLING);
+ exti_enable_request (TACHO);
+ exti_reset_request (TACHO);
+
+ nvic_enable_irq (TACHO_IRQ);
+
+}
diff --git a/stm32/app/tacho.h b/stm32/app/tacho.h
new file mode 100644
index 0000000..a044ae7
--- /dev/null
+++ b/stm32/app/tacho.h
@@ -0,0 +1,5 @@
+
+#define TACHO_IRQ NVIC_EXTI3_IRQ
+#define TACHO GPIO3
+#define TACHO_PORT GPIOB
+#define TACHO_ISR exti3_isr
diff --git a/stm32/app/ticker.c b/stm32/app/ticker.c
new file mode 100644
index 0000000..eb7dfe5
--- /dev/null
+++ b/stm32/app/ticker.c
@@ -0,0 +1,75 @@
+#include "project.h"
+
+
+
+
+static volatile uint32_t ticks;
+static volatile uint32_t delay_ms_count;
+static uint32_t scale = 7;
+
+
+void
+delay_us (uint32_t d)
+{
+ d *= scale;
+
+ while (d--)
+ __asm__ ("nop");
+}
+
+
+void
+sys_tick_handler (void)
+{
+ if (delay_ms_count)
+ delay_ms_count--;
+
+
+ led_tick();
+ oled1_ticker();
+ oled2_ticker();
+ gauge_ticker();
+
+ ticks++;
+}
+
+
+void
+delay_ms (uint32_t d)
+{
+ delay_ms_count = MS_TO_TICKS (d);
+
+ while (delay_ms_count);
+}
+
+
+void
+ticker_init (void)
+{
+ uint32_t v, w;
+
+ /*Start periodic timer */
+
+ systick_set_clocksource (STK_CSR_CLKSOURCE_AHB_DIV8);
+ /* 72MHz / 8 = > 9Mhz */
+ systick_set_reload (TICK_DIV);
+ systick_interrupt_enable();
+ systick_counter_enable();
+
+ /*Calibrate the delay loop */
+
+
+ do {
+ scale--;
+ v = ticks;
+
+ while (v == ticks);
+
+ delay_us (TICKS_TO_US (1));
+ w = ticks;
+ v++;
+ w -= v;
+ } while (w);
+
+
+}
diff --git a/stm32/app/usart.c b/stm32/app/usart.c
new file mode 100644
index 0000000..8d98287
--- /dev/null
+++ b/stm32/app/usart.c
@@ -0,0 +1,119 @@
+#include "project.h"
+
+#define BUFFER_SIZE 256
+
+
+#define USART1_TX GPIO_USART1_TX
+#define USART1_TX_PORT GPIOA
+#define USART1_RX GPIO_USART1_RX
+#define USART1_RX_PORT GPIOA
+
+
+ring_t rx1_ring;
+static uint8_t rx1_ring_buf[BUFFER_SIZE];
+
+ring_t tx1_ring;
+static uint8_t tx1_ring_buf[BUFFER_SIZE];
+
+void
+usart1_isr (void)
+{
+ uint8_t data;
+
+ /* Check if we were called because of RXNE. */
+ if (((USART_CR1 (USART1) & USART_CR1_RXNEIE) != 0) &&
+ ((USART_SR (USART1) & USART_SR_RXNE) != 0)) {
+
+ /* Retrieve the data from the peripheral. */
+ data = usart_recv (USART1);
+
+
+ ring_write_byte (&rx1_ring, data);
+ }
+
+ /* Check if we were called because of TXE. */
+ if (((USART_CR1 (USART1) & USART_CR1_TXEIE) != 0) &&
+ ((USART_SR (USART1) & USART_SR_TXE) != 0)) {
+
+ if (ring_read_byte (&tx1_ring, &data)) {
+ /*No more data, Disable the TXE interrupt, it's no longer needed. */
+ USART_CR1 (USART1) &= ~USART_CR1_TXEIE;
+ } else
+ usart_send (USART1, data);
+ }
+
+}
+
+
+int
+_write (int file, char *ptr, int len)
+{
+ int ret;
+
+ if (file == 1) {
+ ret = len;
+
+ usart1_drain();
+
+ while (len--) {
+ if (*ptr == '\n')
+ ring_write_byte (&tx1_ring, '\r');
+
+ ring_write_byte (&tx1_ring, * (ptr++));
+ }
+
+ USART_CR1 (USART1) |= USART_CR1_TXEIE;
+ return ret;
+ }
+
+ errno = EIO;
+ return -1;
+}
+
+void
+usart1_queue (uint8_t d)
+{
+ ring_write_byte (&tx1_ring, d);
+ USART_CR1 (USART1) |= USART_CR1_TXEIE;
+}
+
+
+void
+usart1_drain (void)
+{
+ while (!ring_empty (&tx1_ring));
+}
+
+
+
+void
+usart_init (void)
+{
+ rcc_periph_clock_enable (RCC_USART1);
+
+ ring_init (&rx1_ring, rx1_ring_buf, sizeof (rx1_ring_buf));
+ ring_init (&tx1_ring, tx1_ring_buf, sizeof (tx1_ring_buf));
+
+ /* Enable the USART1,2 interrupt. */
+ nvic_enable_irq (NVIC_USART1_IRQ);
+
+ /* Map pins, and usart1 to have pull ups */
+ MAP_AF_PP (USART1_TX);
+ MAP_INPUT_PU (USART1_RX);
+
+
+ /* Setup UART1 parameters. */
+ usart_set_baudrate (USART1, 115200);
+ usart_set_databits (USART1, 8);
+ usart_set_stopbits (USART1, USART_STOPBITS_1);
+ usart_set_parity (USART1, USART_PARITY_NONE);
+ usart_set_flow_control (USART1, USART_FLOWCONTROL_NONE);
+ usart_set_mode (USART1, USART_MODE_TX_RX);
+
+
+ /* Enable USART1 Receive interrupt. */
+ USART_CR1 (USART1) |= USART_CR1_RXNEIE;
+
+ /* Finally enable the USARTs. */
+ usart_enable (USART1);
+}
diff --git a/stm32/doc/cs32g103.pdf b/stm32/doc/cs32g103.pdf
new file mode 100644
index 0000000..a4d994b
--- /dev/null
+++ b/stm32/doc/cs32g103.pdf
Binary files differ
diff --git a/stm32/doc/rm0008.pdf b/stm32/doc/rm0008.pdf
new file mode 100644
index 0000000..8f3d0e1
--- /dev/null
+++ b/stm32/doc/rm0008.pdf
Binary files differ
diff --git a/stm32/doc/stm32f103c8.pdf b/stm32/doc/stm32f103c8.pdf
new file mode 100644
index 0000000..2723cee
--- /dev/null
+++ b/stm32/doc/stm32f103c8.pdf
Binary files differ
diff --git a/stm32/doc/stm32f103c8t6_pinout_voltage01.png b/stm32/doc/stm32f103c8t6_pinout_voltage01.png
new file mode 100644
index 0000000..2c22a74
--- /dev/null
+++ b/stm32/doc/stm32f103c8t6_pinout_voltage01.png
Binary files differ
diff --git a/stm32/libopencm3 b/stm32/libopencm3
new file mode 160000
+Subproject 5c73d601763dd140bff020be8d6d06f03c2bea7