diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..029d0b2 --- /dev/null +++ b/Makefile @@ -0,0 +1,619 @@ +# Hey Emacs, this is a -*- makefile -*- +#---------------------------------------------------------------------------- +# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. +# +# Released to the Public Domain +# +# Additional material for this makefile was written by: +# Peter Fleury +# Tim Henigan +# Colin O'Flynn +# Reiner Patommel +# Markus Pfaff +# Sander Pool +# Frederik Rouleau +# Carlos Lamas +# +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device, using avrdude. +# Please customize the avrdude settings below first! +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + + +# Target file name (without extension). +TARGET = twobtn + + +# List C source files here. (C dependencies are automatically generated.) +SRC = main.c \ + mouse.c \ + buttons.c \ + usb_mouse.c + + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +# +MCU = atmega32u2 +#MCU = at90usb162 # Teensy 1.0 +#MCU = atmega32u4 # Teensy 2.0 +#MCU = at90usb646 # Teensy++ 1.0 +#MCU = at90usb1286 # Teensy++ 2.0 + + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 8000000 + + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +# Object files directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +OBJDIR = . + + +# List C++ source files here. (C dependencies are automatically generated.) +CPPSRC = + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = 2 + + +# Debugging format. +# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. +# AVR Studio 4.10 requires dwarf-2. +# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. +DEBUG = dwarf-2 + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=c99 + + +# Place -D or -U options here for C sources +CDEFS = -DF_CPU=$(F_CPU)UL -DSROM_VERSION=5 + + +# Place -D or -U options here for ASM sources +ADEFS = -DF_CPU=$(F_CPU) + + +# Place -D or -U options here for C++ sources +CPPDEFS = -DF_CPU=$(F_CPU)UL +#CPPDEFS += -D__STDC_LIMIT_MACROS +#CPPDEFS += -D__STDC_CONSTANT_MACROS + + + +#---------------- Compiler Options C ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char +CFLAGS += -funsigned-bitfields +CFLAGS += -ffunction-sections +CFLAGS += -fpack-struct +CFLAGS += -fshort-enums +CFLAGS += -Wall +CFLAGS += -Wextra +#CFLAGS += -pedantic +CFLAGS += -Wstrict-prototypes +#CFLAGS += -mshort-calls +#CFLAGS += -fno-unit-at-a-time +#CFLAGS += -Wundef +#CFLAGS += -Wunreachable-code +#CFLAGS += -Wsign-compare +CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) + + +#---------------- Compiler Options C++ ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CPPFLAGS = -g$(DEBUG) +CPPFLAGS += $(CPPDEFS) +CPPFLAGS += -O$(OPT) +CPPFLAGS += -funsigned-char +CPPFLAGS += -funsigned-bitfields +CPPFLAGS += -fpack-struct +CPPFLAGS += -fshort-enums +CPPFLAGS += -fno-exceptions +CPPFLAGS += -Wall +CPPFLAGS += -Wundef +#CPPFLAGS += -mshort-calls +#CPPFLAGS += -fno-unit-at-a-time +#CPPFLAGS += -Wstrict-prototypes +#CPPFLAGS += -Wunreachable-code +#CPPFLAGS += -Wsign-compare +CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) +CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +#CPPFLAGS += $(CSTANDARD) + + +#---------------- Assembler Options ---------------- +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +# -listing-cont-lines: Sets the maximum number of continuation lines of hex +# dump that will be displayed for a given single line of source input. +ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 + + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + + +MATH_LIB = -lm + + +# List any extra directories to look for libraries here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRALIBDIRS = + + + +#---------------- External Memory Options ---------------- + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + + + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +#LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--gc-sections +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +#LDFLAGS += -T linker_script.x + + + +#---------------- Programming Options (avrdude) ---------------- + +# Programming hardware +# Type: avrdude -c ? +# to get a full listing. +# +AVRDUDE_PROGRAMMER = stk500v2 + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = com1 # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +#---------------- Debugging Options ---------------- + +# For simulavr only - target MCU frequency. +DEBUG_MFREQ = $(F_CPU) + +# Set the DEBUG_UI to either gdb or insight. +# DEBUG_UI = gdb +DEBUG_UI = insight + +# Set the debugging back-end to either avarice, simulavr. +DEBUG_BACKEND = avarice +#DEBUG_BACKEND = simulavr + +# GDB Init Filename. +GDBINIT_FILE = __avr_gdbinit + +# When using avarice settings for the JTAG +JTAG_DEV = /dev/com1 + +# Debugging port used to communicate between GDB / avarice / simulavr. +DEBUG_PORT = 4242 + +# Debugging host used to communicate between GDB / avarice / simulavr, normally +# just set to localhost unless doing some sort of crazy debugging when +# avarice is running on a different computer. +DEBUG_HOST = localhost + + + +#============================================================================ + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar rcs +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +REMOVEDIR = rm -rf +COPY = cp +WINSHELL = cmd + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling C: +MSG_COMPILING_CPP = Compiling C++: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: + + + + +# Define all object files. +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) + +# Define all listing files. +LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) + + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d + + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +all: begin gccversion sizebefore build sizeafter end + +# Change the build target to build a HEX file or a library. +build: elf hex eep lss sym +#build: lib + + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym +LIBNAME=lib$(TARGET).a +lib: $(LIBNAME) + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +#ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf +ELFSIZE = $(SIZE) $(TARGET).elf + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + 2>/dev/null; echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + +# Generate avr-gdb config/init file which does the following: +# define the reset signal, load the target file, connect to target, and set +# a breakpoint at main(). +gdb-config: + @$(REMOVE) $(GDBINIT_FILE) + @echo define reset >> $(GDBINIT_FILE) + @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) + @echo end >> $(GDBINIT_FILE) + @echo file $(TARGET).elf >> $(GDBINIT_FILE) + @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) +ifeq ($(DEBUG_BACKEND),simulavr) + @echo load >> $(GDBINIT_FILE) +endif + @echo break main >> $(GDBINIT_FILE) + +debug: gdb-config $(TARGET).elf +ifeq ($(DEBUG_BACKEND), avarice) + @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. + @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ + $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) + @$(WINSHELL) /c pause + +else + @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ + $(DEBUG_MFREQ) --port $(DEBUG_PORT) +endif + @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT = $(OBJCOPY) --debugging +COFFCONVERT += --change-section-address .data-0x800000 +COFFCONVERT += --change-section-address .bss-0x800000 +COFFCONVERT += --change-section-address .noinit-0x800000 +COFFCONVERT += --change-section-address .eeprom-0x810000 + + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S -z $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Create library from object files. +.SECONDARY : $(TARGET).a +.PRECIOUS : $(OBJ) +%.a: $(OBJ) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $@ $(OBJ) + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +$(OBJDIR)/%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create object files from C++ source files. +$(OBJDIR)/%.o : %.cpp + @echo + @echo $(MSG_COMPILING_CPP) $< + $(CC) -c $(ALL_CPPFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C++ source files. +%.s : %.cpp + $(CC) -S $(ALL_CPPFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +$(OBJDIR)/%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + +# Create preprocessed source for use in sending a bug report. +%.i : %.c + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + + +# Target: clean project. +clean: begin clean_list end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) $(SRC:.c=.i) + $(REMOVEDIR) .dep + + +# Create object files directory +$(shell mkdir $(OBJDIR) 2>/dev/null) + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program debug gdb-config diff --git a/atmel_bootloader.c b/atmel_bootloader.c new file mode 100644 index 0000000..50674e1 --- /dev/null +++ b/atmel_bootloader.c @@ -0,0 +1,42 @@ +/* Copyright (c) 2012 MichaÅ‚ Trybus + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +#include "atmel_bootloader.h" +#include + +void flash_write_page(uint32_t addr, const uint8_t *data) +{ + volatile uint8_t sreg = SREG; + cli(); + for (int i = 0; i < SPM_PAGESIZE; i += 2) + flash_fill_temp_buffer(*(uint16_t*)(data + i), i); + flash_page_erase_and_write(addr); + SREG = sreg; +} diff --git a/atmel_bootloader.h b/atmel_bootloader.h new file mode 100644 index 0000000..c8cea79 --- /dev/null +++ b/atmel_bootloader.h @@ -0,0 +1,188 @@ +/* Copyright (c) 2012 MichaÅ‚ Trybus + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +#pragma once + +#include +#include + +#define LAST_BOOT_ENTRY (FLASHEND - 3) + +/* Addresses to bootloader ABI functions (in bytes) */ +#define PAGE_ERASE_AND_WRITE_ADDR (LAST_BOOT_ENTRY - 24) +#define READ_SIG_ADDR (LAST_BOOT_ENTRY - 20) +#define READ_FUSE_ADDR (LAST_BOOT_ENTRY - 16) +#define FILL_TEMP_BUFFER_ADDR (LAST_BOOT_ENTRY - 12) +#define PRG_PAGE_ADDR (LAST_BOOT_ENTRY - 8) +#define PAGE_ERASE_ADDR (LAST_BOOT_ENTRY - 4) +#define LOCK_WR_BITS_ADDR (LAST_BOOT_ENTRY - 0) + +#define PUSH_REGS \ + "push r0" "\n\t" \ + "push r1" "\n\t" \ + "push r16" "\n\t" \ + "push r17" "\n\t" \ + +#define POP_REGS \ + "pop r17" "\n\t" \ + "pop r16" "\n\t" \ + "pop r1" "\n\t" \ + "pop r0" "\n\t" \ + +/* wrapper which passes one 24-bit argument in r18:r17:r16 to Atmel DFU + * bootloader function */ +#define ATMEL_DFU_CALL_1ARG(addr, arg) \ +(__extension__({ \ + __asm__ __volatile__( \ + PUSH_REGS \ + "mov r18, %0" "\n\t" \ + "mov r17, %1" "\n\t" \ + "mov r16, %2" "\n\t" \ + "call %3" "\n\t" \ + POP_REGS \ + : \ + : "r" (((arg) >> 16) & 0xff), \ + "r" (((arg) >> 8) & 0xff), \ + "r" (((arg) >> 0) & 0xff), \ + "i" ((addr)) \ + : "r0", "r1", "r16", "r17", "r18", \ + "r20", "r30", "r31"); \ +})) \ + +/* wrapper which passes one 24-bit argument in r18:r17:r16 to Atmel DFU + * bootloader function and returns value returned in r16 */ +#define ATMEL_DFU_CALL_1ARG_RET(addr, arg) \ +(__extension__({ \ + uint8_t ret; \ + __asm__ __volatile__( \ + PUSH_REGS \ + "mov r18, %1" "\n\t" \ + "mov r17, %2" "\n\t" \ + "mov r16, %3" "\n\t" \ + "call %4" "\n\t" \ + "mov %0, r16" "\n\t" \ + POP_REGS \ + : "=r" (ret) \ + : "r" (((arg) >> 16) & 0xff), \ + "r" (((arg) >> 8) & 0xff), \ + "r" (((arg) >> 0) & 0xff), \ + "i" ((addr)) \ + : "r0", "r1", "r16", "r17", "r18", \ + "r20", "r30", "r31"); \ + ret; \ +})) + +/* wrapper which passes two 16-bit arguments in r17:r16 and r18:r19, + * respectively */ +#define ATMEL_DFU_CALL_2ARG(addr, arg1, arg2) \ +(__extension__({ \ + __asm__ __volatile__( \ + PUSH_REGS \ + "mov r19, %0" "\n\t" \ + "mov r18, %1" "\n\t" \ + "mov r17, %2" "\n\t" \ + "mov r16, %3" "\n\t" \ + "call %4" "\n\t" \ + POP_REGS \ + : \ + : "r" (((arg2) >> 8) & 0xff), \ + "r" (((arg2) >> 0) & 0xff), \ + "r" (((arg1) >> 0) & 0xff), \ + "r" (((arg1) >> 8) & 0xff), \ + "i" ((addr)) \ + : "r0", "r1", "r16", "r17", "r18", "r19", \ + "r20", "r30", "r31"); \ +})) + +/* Atmel DFU bootloader ABI calls */ +static inline void flash_page_erase_and_write(uint32_t addr) +{ + ATMEL_DFU_CALL_1ARG(PAGE_ERASE_AND_WRITE_ADDR, addr); +} +static inline uint8_t flash_read_sig(uint32_t addr) +{ + return ATMEL_DFU_CALL_1ARG_RET(READ_SIG_ADDR, addr); +} +static inline uint8_t flash_read_fuse(uint32_t addr) +{ + return ATMEL_DFU_CALL_1ARG_RET(READ_FUSE_ADDR, addr); +} +static inline void flash_fill_temp_buffer(uint16_t data, uint16_t addr) +{ + ATMEL_DFU_CALL_2ARG(FILL_TEMP_BUFFER_ADDR, data, addr); +} +static inline void flash_prg_page(uint32_t addr) +{ + ATMEL_DFU_CALL_1ARG(PRG_PAGE_ADDR, addr); +} +static inline void flash_page_erase(uint32_t addr) +{ + ATMEL_DFU_CALL_1ARG(PAGE_ERASE_ADDR, addr); +} +static inline void flash_lock_wr_bits(uint8_t bits) +{ + ATMEL_DFU_CALL_1ARG(LOCK_WR_BITS_ADDR, (uint32_t)bits); +} + +/* fuse bits addresses */ +#define FUSE_LOW 0 +#define FUSE_HIGH 3 +#define FUSE_EXTENDED 2 + +#define BOOTSZ0 1 +#define BOOTSZ1 2 + +/* Determines the size of bootloader section in run-time based on BOOTSZ[1..0] + * fusebits */ +static inline uint32_t bootloader_size() +{ + uint8_t hfuse = flash_read_fuse(FUSE_HIGH); + uint8_t bootsz = (hfuse >> BOOTSZ0) & 0x03; + return 512 << (3-bootsz); +} + +/* Jumps to the beginning of bootloader. Address is computed in runtime */ +static inline void run_bootloader() +{ + TIMSK0 = 0; + /* compute the address of the beginning of the bootloader section and + * convert to word address */ + uint32_t bladdr = (FLASHEND - bootloader_size()) / 2 + 1; + __asm__ __volatile__( + "mov r30, %0" "\n\t" + "mov r31, %1" "\n\t" + "ijmp" + : + : "r" ((bladdr >> 0) & 0xff), + "r" ((bladdr >> 8) & 0xff) + : "r30", "r31"); +} + +void flash_write_page(uint32_t addr, const uint8_t *data); diff --git a/buttons.c b/buttons.c new file mode 100644 index 0000000..6ef55a1 --- /dev/null +++ b/buttons.c @@ -0,0 +1,76 @@ +#include "buttons.h" + +#include + +#ifdef TEST_MODE +# include +# include +# include +# define DBG(fmt, ...) printf("\n" fmt, ##__VA_ARGS__) +#else +# include +# define DBG(...) +# define assert(x) +# define stname(...) +#endif + +#define SCHMITT + +static int32_t debounce_delay_tics = 0; +static bool state[2] = {false, false}; + +void BUTTONS_init(void) +{ +} + +void BUTTONS_set_debounce_delay(uint16_t delay) +{ + debounce_delay_tics = delay & 0x7fff; +} + +#ifdef SCHMITT +void BUTTONS_task(uint8_t dtime, struct input input[]) +{ + for (int i = 0; i < 2; ++i) { + if (state[i]) + state[i] = !input[i].T || input[i].B; + else + state[i] = input[i].B && !input[i].T; + } +} +#else +void BUTTONS_task(uint8_t dtime, struct input input[]) +{ + static uint16_t time = 0; + static uint16_t tmr[2] = {0, 0}; + + const uint16_t ntime = (time + dtime) & 0x7fff; + if (ntime < time) { /* time is wrapping - clean up timers */ + for (int i = 0; i < 2; ++i) { + if (tmr[i] & 0x8000) + tmr[i] &= 0x7fff; + else + tmr[i] = 0; + } + } + time = ntime; + for (int i = 0; i < 2; ++i) { + if (input[i].B && !input[i].T) { + state[i] = true; + tmr[i] = 0; + } + if (time < tmr[i]) + continue; + const bool newstate = !input[i].T; + if (state[i] != newstate) { + state[i] = newstate; + tmr[i] = time + debounce_delay_tics; + } + } +} +#endif + +bool BUTTONS_get(uint8_t num) +{ + return state[num]; +} diff --git a/buttons.h b/buttons.h new file mode 100644 index 0000000..550dc02 --- /dev/null +++ b/buttons.h @@ -0,0 +1,17 @@ +#ifndef _BUTTONS_H_INCLUDED_ +#define _BUTTONS_H_INCLUDED_ + +#include +#include + +struct input { + bool T : 1; + bool B : 1; +}; + +void BUTTONS_init(void); +void BUTTONS_set_debounce_delay(uint16_t delay); +void BUTTONS_task(uint8_t dtime, struct input[]); +bool BUTTONS_get(uint8_t num); + +#endif /* _BUTTONS_H_INCLUDED_ */ diff --git a/main.c b/main.c new file mode 100644 index 0000000..ef67b9f --- /dev/null +++ b/main.c @@ -0,0 +1,347 @@ +#include +#include +#include +#include "usb_mouse.h" +#if SROM_VERSION == 3 +# include "srom_3360_0x03.h" +#elif SROM_VERSION == 5 +# include "srom_3360_0x05.h" +#else +# error bad srom version +#endif + +#include + +#include "mouse.h" +#include "buttons.h" + +#define delay_us(t) __builtin_avr_delay_cycles((t) * F_CPU/1000000) +#define delay_ms(t) __builtin_avr_delay_cycles((t) * F_CPU/1000) + + +#define PORT_SPI PORTB +#define DDR_SPI DDRB + +#define DD_SS 6 // aka NCS +#define DD_SCK 1 +#define DD_MOSI 2 +#define DD_MISO 3 + +#define SS_LOW (PORT_SPI &= ~(1<> 6) | ((PIND & (1<<4)) >> 3); + const uint8_t dpis[] = {CPI_VAL(1500), CPI_VAL(500), CPI_VAL(600), CPI_VAL(700)}; + pmw3366_init(dpis[dpi]); + + usb_init(); + while (!usb_configured()) + ; + + // begin burst mode + SS_LOW; + spi_write(0x50, 0x00); + SS_HIGH; + + // set up timer0 to set OCF0A in TIFR0 every 125us + TCCR0A = 0x02; // CTC + TCCR0B = 0x02; // prescaler 1/8 = 1us period + OCR0A = 124; // = 125 - 1 + + BUTTONS_set_debounce_delay(160); + + uint32_t time_ticks = 0; + + uint8_t prev_squal = 128; + while (1) { + for (uint8_t i = 0; i < 8; i++) { + if (i == 0) { + // sync to usb frames (1ms) + UDINT &= ~(1<= 16, + &b1, &b2, &out_dx, &out_dy); + +#ifdef DEBUG_PINS + PORTC |= _BV(PC6); + PORTC &= ~_BV(PC6); +#endif + + spi_send(0x00); // motion, not used + spi_send(0x00); // observation, not used + _x.lo = spi_recv(); + _x.hi = spi_recv(); + _y.lo = spi_recv(); + _y.hi = spi_recv(); + prev_squal = spi_recv(); + SS_HIGH; + +#ifdef DEBUG_PINS + PORTC |= _BV(PC6); + PORTC &= ~_BV(PC6); +#endif + + if (overwrite_delta) { + _x.all = out_dx; + _y.all = out_dy; + } + + int16_t cpi; + bool as; + int8_t lod; + mouse_get_params(&cpi, &as, &lod); + pmw3366_set_cpi(cpi); + pmw3366_set_mode(as, lod); + const uint8_t btn_dbncd = b1 | (b2 << 1); + + if ((btn_dbncd != btn_prev) || _x.all || _y.all) { + UENUM = MOUSE_ENDPOINT; + if (UESTA0X & (1< +# include +# include +# define DBG(fmt, ...) printf("\n" fmt, ##__VA_ARGS__) +# define run_bootloader() {DBG("RUN BOOTLOADER\n"); exit(0);} +# define store_config(cpi, as, lod) DBG("STORING CONFIG cpi=%i, as=%i, lod=%i\n", (int)(cpi), (int)(as), (int)lod) +# define load_config(cpi, as, lod) { *(cpi) = CPI_DEFAULT; *(as) = 0; *(lod) = 2; DBG("LOADING CONFIG cpi=%i, as=%i, lod=%i\n", *cpi, *as, *lod); } +const char *stname(enum state s) +{ + switch (s) { + case POWERON: return "POWERON"; + case IDLE: return "IDLE"; + case ANIM_WAIT: return "ANIM_WAIT"; + case ANIM_RIGHT: return "ANIM_RIGHT"; + case ANIM_DOWN: return "ANIM_DOWN"; + case ANIM_LEFT: return "ANIM_LEFT"; + case ANIM_UP: return "ANIM_UP"; + case SHOW_CPI_HUNDREDS: return "SHOW_CPI_HUNDREDS"; + case WAIT_FOR_RELEASE: return "WAIT_FOR_RELEASE"; + case CPI: return "CPI"; + default: + assert(false); + } +} +#else +# include "avr/eeprom.h" +# include "atmel_bootloader.h" +# define DBG(...) +# define assert(x) +# define stname(...) + +static uint16_t EEMEM cpi_ee = CPI_DEFAULT; +static uint8_t EEMEM as_ee = 0; +static uint8_t EEMEM lod_ee = 2; + +void store_config(int16_t cpi, bool as, int8_t lod) +{ + eeprom_write_word(&cpi_ee, (uint16_t)cpi); + eeprom_busy_wait(); + + eeprom_write_byte(&as_ee, (uint8_t)as); + eeprom_busy_wait(); + + eeprom_write_byte(&lod_ee, (uint8_t)lod); + eeprom_busy_wait(); +} + +void load_config(int16_t *cpi, bool *as, int8_t *lod) +{ + *cpi = (int16_t)eeprom_read_word(&cpi_ee); + *as = (bool)eeprom_read_byte(&as_ee); + *lod = (int8_t)eeprom_read_byte(&lod_ee); +} +#endif + +static int16_t config_cpi; +static bool config_as; +static int8_t config_lod; + +static bool mode_changed(int32_t time, bool left, bool right, bool tracking) +{ + enum state { + WAIT_RELEASE_BOTH, + WAIT_PRESS_BOTH, + WAIT_TIMEOUT, + }; + static enum state state = WAIT_RELEASE_BOTH; + + static int32_t start_wait = -1; + + bool rv = false; + if (tracking) { + state = WAIT_RELEASE_BOTH; + } else { + switch (state) { + case WAIT_RELEASE_BOTH: + if (!left && !right) + state = WAIT_PRESS_BOTH; + break; + case WAIT_PRESS_BOTH: + if (left && right) { + state = WAIT_TIMEOUT; + start_wait = time; + } + break; + case WAIT_TIMEOUT: + if (!(left && right)) { + state = WAIT_RELEASE_BOTH; + } else if (time > start_wait + PROGRAMMING_TIMEOUT) { + rv = true; + state = WAIT_RELEASE_BOTH; + } + break; + } + } + + return rv; +} + +/** + * @return -1 after small CPI decrease, -2 after large CPI decrease, + * 1 after small CPI increase, 2 after large CPI increase, + * 0 after no CPI increase + */ +static int8_t cpi_mode_step(bool left, bool right, bool tracking) +{ + static uint8_t ret = 0; + static bool prev_left = false, + prev_right = false; + static bool wait_for_release = true; + static int8_t lock = 0; + + static int16_t prev_cpi; + + prev_cpi = config_cpi; + ret = 0; + if (!tracking) { + wait_for_release = true; + } else if (wait_for_release) { + if (!left && !right) { + wait_for_release = false; + lock = 0; + } + } else { + if (!lock && left && right && !prev_right) { + lock = 1; + } else if (!lock && right && left && !prev_left) { + lock = -1; + } else if (!left && prev_left) { + if (lock == 1) { + wait_for_release = true; + } else if (right) { + if (lock == -1) { + config_cpi -= CPI_LARGE_STEP; + ret = -2; + } + } else if (!lock) { + config_cpi -= CPI_SMALL_STEP; + ret = -1; + } + } else if (!right && prev_right) { + if (lock == -1) { + wait_for_release = true; + } else if (left) { + if (lock == 1) { + config_cpi += CPI_LARGE_STEP; + ret = 2; + } + } else if (!lock) { + config_cpi += CPI_SMALL_STEP; + ret = 1; + } + } + if (!right && !left) + lock = 0; + } + + if (config_cpi > CPI_MAX) + config_cpi = CPI_MAX; + if (config_cpi < CPI_MIN) + config_cpi = CPI_MIN; + if (config_cpi == prev_cpi) + ret = 0; + + prev_left = left; + prev_right = right; + + return ret; +} + +bool mouse_step(int32_t time, bool left, bool right, bool tracking, + bool *out_left, bool *out_right, int16_t *out_dx, int16_t *out_dy) +{ + enum anim_type { + ANIM_SQUARE, + ANIM_SQUARE_INV, + ANIM_SPIKE_DOWN, + ANIM_SPIKE_UP, + ANIM_SPIKE_RIGHT + }; + static enum state state = POWERON; + static enum anim_type anim_type; + static enum state next_state = IDLE; + static int8_t anim_repeat; + static int16_t anim_length; + static int16_t anim_length_wait; + static int16_t actual_length; + static int16_t anim_step; + static int16_t actual_step; + static int16_t anim_pos; + static int32_t last_anim; + static int32_t boot_press_time = -1; + static enum state next_next_state; + +#define SET_ANIM_FIRST_STATE(type, nstate) \ + { \ + if (type == ANIM_SQUARE) { \ + DBG("state %s -> ANIM_RIGHT (-> ANIM_DOWN -> ANIM_LEFT" \ + " -> ANIM_UP -> %s)\n", \ + stname(state), stname(nstate)); \ + state = ANIM_RIGHT; \ + } else if (type == ANIM_SQUARE_INV) { \ + DBG("state %s -> ANIM_LEFT (-> ANIM_DOWN -> ANIM_RIGHT" \ + " -> ANIM_UP -> %s)\n", \ + stname(state), stname(nstate)); \ + state = ANIM_LEFT; \ + } else if (type == ANIM_SPIKE_RIGHT) { \ + DBG("state %s -> ANIM_RIGHT (-> ANIM_LEFT -> %s)\n", \ + stname(state), stname(nstate)); \ + state = ANIM_RIGHT; \ + } else if (type == ANIM_SPIKE_UP) { \ + DBG("state %s -> ANIM_UP (-> ANIM_DOWN -> %s)\n", \ + stname(state), stname(nstate)); \ + state = ANIM_UP; \ + } else if (type == ANIM_SPIKE_DOWN) { \ + DBG("state %s -> ANIM_DOWN (-> ANIM_UP -> %s)\n", \ + stname(state), stname(nstate)); \ + state = ANIM_DOWN; \ + } else { \ + assert(false); \ + } \ + } + +#define ANIMATE(type, len, dur, repeat, wait, nstate) \ + if ((repeat) > 0) { \ + next_state = (nstate); \ + anim_type = (type); \ + SET_ANIM_FIRST_STATE(type, nstate); \ + anim_length = (len); \ + anim_length_wait = (wait); \ + anim_step = dur / ((((type) == ANIM_SQUARE || (type) == ANIM_SQUARE_INV) ? 4 : 2)*(anim_length)); \ + anim_pos = 0; \ + anim_repeat = (repeat); \ + last_anim = time; \ + } else { \ + state = nstate; \ + } + +#define ANIMATE_CONTINUE() \ + { \ + state = ANIM_WAIT; \ + last_anim = time; \ + --anim_repeat; \ + } + + bool rv = false; + + *out_left = left; + *out_right = right; + + switch (state) { + case POWERON: + *out_left = *out_right = false; + if (boot_press_time == -1) { + load_config(&config_cpi, &config_as, &config_lod); + if (left && right) { + config_as = false; + config_lod = 2; + store_config(config_cpi, config_as, config_lod); + boot_press_time = time; + ANIMATE(ANIM_SQUARE_INV, ANIMATION_LENGTH_SQUARE, ANIMATION_DURATION_SQUARE, 1, TICKS_FROM_US(1000000), POWERON); + state = ANIM_WAIT; + } else if (left) { + config_as = true; + store_config(config_cpi, config_as, config_lod); + boot_press_time = time; + ANIMATE(ANIM_SQUARE, ANIMATION_LENGTH_SQUARE, ANIMATION_DURATION_SQUARE, 1, TICKS_FROM_US(1000000), POWERON); + state = ANIM_WAIT; + } else if (right) { + config_lod = 3; + store_config(config_cpi, config_as, config_lod); + boot_press_time = time; + ANIMATE(ANIM_SQUARE, ANIMATION_LENGTH_SQUARE, ANIMATION_DURATION_SQUARE, 1, TICKS_FROM_US(1000000), POWERON); + state = ANIM_WAIT; + } else { + DBG("state POWERON -> IDLE\n"); + state = IDLE; + } + } else { + if (left && right && time > boot_press_time + DFU_MODE_TIMEOUT) { + config_lod = LOD_DEFAULT; + config_as = AS_DEFAULT; + config_cpi = CPI_DEFAULT; + store_config(config_cpi, config_as, config_lod); + DBG("Running bootloader\n"); + run_bootloader(); + } else if (!left && !right) { + state = IDLE; + } + } + break; + case IDLE: + if (mode_changed(time, left, right, tracking)) { + ANIMATE(ANIM_SPIKE_RIGHT, ANIMATION_LENGTH_SPIKE_SHORT, ANIMATION_DURATION_SPIKE_INDICATION, config_cpi / 1000, ANIMATION_DURATION_SPIKE_INDICATION, + SHOW_CPI_HUNDREDS); + next_next_state = CPI; + } + break; + case CPI: + *out_left = *out_right = false; + if (mode_changed(time, left, right, tracking)) { + store_config(config_cpi, config_as, config_lod); + ANIMATE(ANIM_SPIKE_RIGHT, ANIMATION_LENGTH_SPIKE_SHORT, ANIMATION_DURATION_SPIKE_INDICATION, config_cpi / 1000, ANIMATION_DURATION_SPIKE_INDICATION, + SHOW_CPI_HUNDREDS); + next_next_state = IDLE; + } else { + const int8_t ret = cpi_mode_step(left, right, tracking); + if (ret == 0) + break; + if (ret > 0) { + if (ret == 1) { + ANIMATE(ANIM_SPIKE_UP, ANIMATION_LENGTH_SPIKE_SHORT, ANIMATION_DURATION_SPIKE, 1, 0, CPI); + } else { + ANIMATE(ANIM_SPIKE_UP, ANIMATION_LENGTH_SPIKE_LONG, ANIMATION_DURATION_SPIKE, 1, 0, CPI); + } + } else if (ret < 0) { + if (ret == -1) { + ANIMATE(ANIM_SPIKE_DOWN, ANIMATION_LENGTH_SPIKE_SHORT, ANIMATION_DURATION_SPIKE, 1, 0, CPI); + } else { + ANIMATE(ANIM_SPIKE_DOWN, ANIMATION_LENGTH_SPIKE_LONG, ANIMATION_DURATION_SPIKE, 1, 0, CPI); + } + } else { + assert(false); + } + } + break; + case ANIM_WAIT: + case ANIM_RIGHT: + case ANIM_DOWN: + case ANIM_LEFT: + case ANIM_UP: + *out_left = *out_right = false; + *out_dx = *out_dy = 0; + rv = true; + actual_length = (state == ANIM_WAIT) ? anim_length_wait : anim_length; + actual_step = (state == ANIM_WAIT) ? 1 : anim_step; + if (anim_pos < actual_length && time > last_anim + actual_step) { + switch (state) { + case ANIM_WAIT: break; + case ANIM_RIGHT: *out_dx = 1; break; + case ANIM_DOWN: *out_dy = 1; break; + case ANIM_LEFT: *out_dx = -1; break; + case ANIM_UP: *out_dy = -1; break; + default: + assert(false); + } + ++anim_pos; + last_anim = time; + } else if (anim_pos >= actual_length) { + anim_pos = 0; + switch (state) { + case ANIM_WAIT: + SET_ANIM_FIRST_STATE(anim_type, next_state); + break; + case ANIM_RIGHT: + if (anim_type == ANIM_SQUARE) { + DBG("state ANIM_RIGHT -> ANIM_DOWN\n"); + state = ANIM_DOWN; break; + } else if (anim_type == ANIM_SQUARE_INV) { + DBG("state ANIM_RIGHT -> ANIM_UP\n"); + state = ANIM_UP; break; + } else if (anim_type == ANIM_SPIKE_RIGHT) { + DBG("state ANIM_RIGHT -> ANIM_LEFT\n"); + state = ANIM_LEFT; break; + } else { + assert(false); + } + case ANIM_DOWN: + if (anim_type == ANIM_SQUARE) { + DBG("state ANIM_DOWN -> ANIM_LEFT\n"); + state = ANIM_LEFT; break; + } else if (anim_type == ANIM_SQUARE_INV) { + DBG("state ANIM_DOWN -> ANIM_RIGHT\n"); + state = ANIM_RIGHT; break; + } else if (anim_type == ANIM_SPIKE_DOWN) { + DBG("state ANIM_DOWN -> ANIM_UP\n"); + state = ANIM_UP; break; + } else if (anim_type == ANIM_SPIKE_UP) { + if (anim_repeat == 1) { + DBG("state ANIM_DOWN -> %s\n", stname(next_state)); + state = next_state; + } else { + ANIMATE_CONTINUE(); + } + break; + } else { + assert(false); + } + case ANIM_LEFT: + if (anim_type == ANIM_SQUARE) { + DBG("state ANIM_LEFT -> ANIM_UP\n"); + state = ANIM_UP; break; + } else if (anim_type == ANIM_SQUARE_INV) { + DBG("state ANIM_LEFT -> ANIM_DOWN\n"); + state = ANIM_DOWN; break; + } else if (anim_type == ANIM_SPIKE_RIGHT) { + if (anim_repeat == 1) { + DBG("state ANIM_LEFT -> %s\n", stname(next_state)); + state = next_state; + } else { + ANIMATE_CONTINUE(); + } + break; + } + case ANIM_UP: + if (anim_type == ANIM_SQUARE) { + DBG("state ANIM_UP -> %s\n", stname(next_state)); + state = next_state; break; + } else if (anim_type == ANIM_SQUARE_INV) { + DBG("state ANIM_UP -> %s\n", stname(next_state)); + state = next_state; break; + } else if (anim_type == ANIM_SPIKE_DOWN) { + DBG("state ANIM_UP -> %s\n", stname(next_state)); + state = next_state; break; + } else if (anim_type == ANIM_SPIKE_UP) { + DBG("state ANIM_UP -> ANIM_DOWN\n"); + state = ANIM_DOWN; break; + } else { + assert(false); + } + default: + assert(false); + } + } + break; + case SHOW_CPI_HUNDREDS: + ANIMATE(ANIM_SPIKE_UP, ANIMATION_LENGTH_SPIKE_SHORT, ANIMATION_DURATION_SPIKE_INDICATION, (config_cpi % 1000)/100, ANIMATION_DURATION_SPIKE_INDICATION, + WAIT_FOR_RELEASE); + next_state = next_next_state; + if (state != WAIT_FOR_RELEASE) { + state = ANIM_WAIT; + } + break; + case WAIT_FOR_RELEASE: + *out_left = *out_right = false; + if (!left && !right) { + DBG("state WAIT_FOR_RELEASE -> %s\n", stname(next_state)); + state = next_state; + } + break; + } + return rv; +} + +void mouse_get_params(int16_t *out_cpi, bool *out_as, int8_t *out_lod) +{ + *out_cpi = config_cpi; + *out_as = config_as; + *out_lod = config_lod; +} diff --git a/mouse.h b/mouse.h new file mode 100644 index 0000000..28216f6 --- /dev/null +++ b/mouse.h @@ -0,0 +1,30 @@ +#ifndef _MOUSE_H_INCLUDED_ +#define _MOUSE_H_INCLUDED_ + + +#include +#include + +/** + * Performs one step of mouse logic. + * + * @param time system time expressed in ticks (1/8000s) + * @param left state of left button + * @param right state of right button + * @param tracking true iff mouse is tracking (not lifted above surface) + * @param out_left pointer to store output left button state + * @param out_right pointer to store output right button state + * @param out_dx pointer to store output x delta (if return value is true) + * @param out_dx pointer to store output y delta (if return value is true) + * + * @return true if mouse logic takes control over mouse delta, in this case + * values *out_dx and *out_dy should be sent as mouse delta; + * false if mouse logic does not take control over mouse delta, + * in this case actual values from the sensor should be sent as + * mouse delta + */ +bool mouse_step(int32_t time, bool left, bool right, bool tracking, + bool *out_left, bool *out_right, int16_t *out_dx, int16_t *out_dy); +void mouse_get_params(int16_t *out_cpi, bool *out_as, int8_t *out_lod); + +#endif diff --git a/srom_3360_0x03.h b/srom_3360_0x03.h new file mode 100644 index 0000000..d3ed89b --- /dev/null +++ b/srom_3360_0x03.h @@ -0,0 +1,4099 @@ +#define SROM_LENGTH (4094) + +const uint8_t PROGMEM srom[SROM_LENGTH] = +{ +0x01, +0x03, +0x87, +0x8a, +0x56, +0x0f, +0xde, +0x3e, +0xfe, +0x5f, +0x1d, +0xb8, +0xf2, +0x66, +0x4e, +0xff, +0x7c, +0x7a, +0x76, +0x4e, +0x1c, +0xb8, +0xd7, +0x0d, +0x79, +0x70, +0x62, +0x27, +0xcc, +0x1a, +0xb6, +0xee, +0x3f, +0xfc, +0x7a, +0x76, +0x4f, +0x1c, +0x9b, +0xb4, +0xcb, +0xf5, +0x49, +0x10, +0x83, +0x84, +0x8a, +0x96, +0x8f, +0x7d, +0x78, +0x72, +0x66, +0x4d, +0x1e, +0xbe, +0xdf, +0x1d, +0x99, +0xb0, +0xe2, +0x46, +0x0e, +0x9e, +0xbe, +0xfe, +0x7e, +0x7e, +0x7e, +0x7e, +0x5f, +0x1d, +0xbc, +0xf2, +0x47, +0x0c, +0x9a, +0xb6, +0xcf, +0x1c, +0x9b, +0xb4, +0xcb, +0xf5, +0x49, +0x10, +0x83, +0x65, +0x48, +0x12, +0x87, +0x6d, +0x58, +0x32, +0xc7, +0x0c, +0x9a, +0xb6, +0xcf, +0x1c, +0xba, +0xf6, +0x6e, +0x5e, +0x1f, +0xbc, +0xdb, +0x34, +0xcb, +0x14, +0x8b, +0x94, +0xaa, +0xb7, +0xcd, +0xf9, +0x70, +0x43, +0x04, +0xb7, +0x71, +0xbc, +0xbb, +0x4d, +0x30, +0x19, +0x01, +0x73, +0x3f, +0xd7, +0xb9, +0x00, +0x10, +0x96, +0xcd, +0x16, +0xd5, +0x5f, +0xed, +0x63, +0x14, +0xf7, +0x61, +0x6a, +0x4e, +0xb3, +0x8e, +0x70, +0x6e, +0x79, +0x9a, +0x51, +0x24, +0xb4, +0xc7, +0xca, +0x58, +0x33, +0xee, +0x94, +0xc1, +0x2e, +0x50, +0x4c, +0xec, +0x74, +0x6c, +0x4b, +0xe4, +0x5a, +0xf0, +0xbb, +0xb0, +0xba, +0x38, +0x06, +0xf7, +0x9b, +0xac, +0xde, +0x47, +0xc2, +0xf7, +0x3e, +0xa7, +0x4a, +0x33, +0x9d, +0x97, +0x3d, +0x89, +0x9d, +0xf7, +0x28, +0x8a, +0xb2, +0x44, +0x44, +0x49, +0xae, +0xe1, +0xf9, +0xeb, +0x36, +0xd2, +0x5d, +0x43, +0x85, +0x55, +0x88, +0xe8, +0xa9, +0x81, +0xea, +0xf7, +0x52, +0x7d, +0xd4, +0x88, +0x07, +0xda, +0xd8, +0xce, +0x3f, +0xe2, +0xed, +0x6e, +0x7f, +0x28, +0x85, +0x6f, +0xad, +0xdd, +0xf1, +0xf4, +0x23, +0x6b, +0xdd, +0x7c, +0x33, +0x03, +0xb8, +0x2b, +0x5c, +0x33, +0xf9, +0x49, +0x0e, +0x70, +0x4e, +0xd8, +0xeb, +0x50, +0x5b, +0x85, +0xd0, +0x81, +0x72, +0xbc, +0x58, +0x84, +0xdb, +0x76, +0x7b, +0xa2, +0x85, +0x5f, +0x7f, +0xf9, +0xf2, +0xe2, +0x27, +0x6a, +0x82, +0x25, +0xb8, +0x4d, +0x49, +0xb3, +0xfa, +0xb6, +0x7f, +0xbf, +0xb2, +0x65, +0x83, +0x70, +0xc0, +0x51, +0x9d, +0xe2, +0xff, +0x0c, +0x7c, +0xc3, +0x93, +0x2c, +0x62, +0xfd, +0x87, +0xc8, +0xf4, +0x56, +0x15, +0x09, +0xb5, +0xb0, +0x94, +0xa7, +0x1c, +0x94, +0x79, +0x6c, +0x00, +0xd5, +0x31, +0xc2, +0xff, +0x67, +0x5b, +0x3b, +0x0f, +0x97, +0x43, +0xa6, +0x89, +0x07, +0x19, +0x8c, +0x2a, +0x99, +0x10, +0xaa, +0x47, +0xfc, +0x1e, +0x5a, +0x7c, +0xbc, +0x35, +0x7d, +0xc4, +0x9b, +0x51, +0xea, +0x53, +0x84, +0x1d, +0x7c, +0x03, +0xb0, +0x16, +0x5f, +0x3a, +0x3e, +0x66, +0x3c, +0x9d, +0xb8, +0x4a, +0x6e, +0xa8, +0x3e, +0x7d, +0x66, +0x6a, +0xf4, +0xdd, +0x1d, +0x79, +0xd7, +0x31, +0xd6, +0x8c, +0xec, +0x9c, +0x7b, +0xf2, +0x45, +0x32, +0xc6, +0x02, +0x63, +0xc4, +0x2d, +0x40, +0x99, +0xb1, +0xf6, +0xd5, +0xab, +0x21, +0x64, +0x9d, +0x5b, +0xf0, +0x3d, +0x02, +0xd7, +0xeb, +0x3d, +0x65, +0xf7, +0xf8, +0x03, +0x11, +0x5d, +0xcc, +0x97, +0xc1, +0xf5, +0x24, +0x2f, +0xbd, +0xb9, +0x85, +0x7d, +0xd9, +0xdd, +0xbb, +0x52, +0x5f, +0xc9, +0x96, +0x96, +0x6d, +0x65, +0xc5, +0x42, +0xab, +0xde, +0x94, +0x4e, +0xdd, +0xdb, +0x5c, +0xfb, +0x88, +0x3a, +0x83, +0xcc, +0x19, +0xca, +0xef, +0xf5, +0x60, +0xd3, +0x1c, +0xc0, +0xaf, +0x37, +0x67, +0xa8, +0x29, +0xad, +0xaf, +0x77, +0x49, +0x47, +0x47, +0xe6, +0x23, +0x0e, +0x52, +0x7d, +0x15, +0x5a, +0xa6, +0x8e, +0x40, +0x88, +0x5e, +0x02, +0x52, +0xbc, +0x15, +0x90, +0x16, +0x47, +0xd5, +0x49, +0xb1, +0x66, +0x3b, +0xc7, +0xf9, +0x49, +0xce, +0xc6, +0xe4, +0x47, +0xc6, +0x0b, +0x6f, +0x1e, +0x7a, +0x2e, +0x31, +0xe6, +0x30, +0xf4, +0x53, +0x01, +0x39, +0x3e, +0xf4, +0x2d, +0xc4, +0xd4, +0x2f, +0x84, +0xae, +0x5d, +0x78, +0x58, +0xe3, +0xe5, +0xac, +0x09, +0x72, +0x90, +0x24, +0x30, +0xc7, +0x54, +0x0e, +0x3c, +0x9b, +0xbf, +0x68, +0x25, +0xe5, +0xec, +0xb7, +0x14, +0x5e, +0x67, +0xa8, +0x85, +0xbb, +0x80, +0x59, +0x30, +0xc3, +0xe5, +0x29, +0xd0, +0x57, +0x14, +0x2f, +0x9b, +0x86, +0xe4, +0x0d, +0x2d, +0x5b, +0x1f, +0x23, +0xb0, +0x63, +0x57, +0x1a, +0xdd, +0x1d, +0xed, +0xfa, +0xd3, +0xe5, +0x5b, +0x06, +0xa6, +0x9e, +0xf6, +0xec, +0xd9, +0x26, +0x2b, +0x64, +0xa9, +0xe6, +0x2f, +0xbd, +0x8c, +0x5e, +0x62, +0xe4, +0x4a, +0x3c, +0x2b, +0x56, +0xd9, +0x40, +0x70, +0x85, +0x1d, +0xd8, +0xb3, +0x6c, +0xdd, +0xa6, +0x94, +0xab, +0x74, +0x82, +0x2b, +0xbf, +0x75, +0x9f, +0xba, +0x2d, +0xe4, +0x06, +0x31, +0x3d, +0x98, +0x72, +0x03, +0x42, +0xdf, +0x25, +0xc1, +0xa1, +0xf6, +0xac, +0xa9, +0x39, +0x85, +0x81, +0xf1, +0xa2, +0xd3, +0x03, +0xb1, +0xc8, +0x52, +0x89, +0x2f, +0x7a, +0xb3, +0x53, +0x4b, +0x45, +0x8a, +0x83, +0x42, +0xf2, +0x10, +0xac, +0x9b, +0x90, +0x6d, +0xe1, +0xe2, +0x37, +0xf6, +0xff, +0xbf, +0x93, +0xd0, +0xc2, +0xa6, +0x64, +0x5c, +0x87, +0x0d, +0x3b, +0xe7, +0x33, +0x65, +0x8b, +0xf6, +0x7d, +0x09, +0x90, +0x52, +0x76, +0x8a, +0x2d, +0xdd, +0x7b, +0x1b, +0xc0, +0xf2, +0x07, +0x14, +0x29, +0x73, +0x50, +0x05, +0xd7, +0x12, +0x21, +0xff, +0xcc, +0x07, +0x55, +0xc9, +0x59, +0x7a, +0x3f, +0x12, +0xcf, +0x15, +0xc9, +0x6b, +0xd1, +0x63, +0xd9, +0xe2, +0x12, +0xe3, +0xad, +0x7a, +0xea, +0xa7, +0x89, +0xd8, +0xa6, +0x6c, +0x1e, +0xf5, +0xcd, +0xbb, +0xc0, +0x50, +0x41, +0x45, +0x6a, +0x64, +0xc2, +0x36, +0xdc, +0x67, +0x06, +0x4d, +0x6c, +0x42, +0xa1, +0xe5, +0x71, +0x35, +0xf2, +0x42, +0x56, +0xbb, +0x37, +0x51, +0xf0, +0xd2, +0xa3, +0x6f, +0xfa, +0xd2, +0xeb, +0x4f, +0xf0, +0xcb, +0x97, +0xdd, +0x22, +0x72, +0x71, +0x59, +0x47, +0xfb, +0xba, +0x6e, +0x5b, +0xa8, +0x70, +0x32, +0x0d, +0x59, +0xe0, +0x39, +0xf6, +0x50, +0x36, +0xf2, +0x43, +0x5c, +0xf4, +0x89, +0xc7, +0x1c, +0x6c, +0x7f, +0x24, +0x3e, +0xb5, +0xc2, +0xdb, +0x1f, +0x82, +0xce, +0x3b, +0x8d, +0xbc, +0x39, +0xdb, +0xab, +0x70, +0x83, +0x05, +0x23, +0x4b, +0x59, +0xcd, +0x2a, +0x22, +0x51, +0x13, +0x89, +0xa6, +0x4d, +0x91, +0xb9, +0x8e, +0x30, +0x40, +0x8c, +0xac, +0x84, +0xd7, +0x9b, +0xa3, +0x6c, +0x4b, +0xa2, +0x6a, +0x8a, +0x25, +0x2f, +0x09, +0x27, +0xeb, +0xf7, +0xf7, +0x16, +0x7d, +0x4c, +0x8b, +0x7e, +0x17, +0x7a, +0x43, +0x00, +0x0c, +0x80, +0xb0, +0x16, +0x58, +0x01, +0x9c, +0xf8, +0xa6, +0x0e, +0x64, +0x5f, +0xbf, +0xf1, +0xc4, +0x6d, +0x1b, +0x47, +0x2d, +0xde, +0x2a, +0x7a, +0x04, +0xfe, +0xe9, +0xc2, +0x9e, +0xa6, +0xbf, +0x90, +0x74, +0x72, +0xd6, +0xa9, +0x53, +0x65, +0xf4, +0x69, +0xd5, +0x58, +0x90, +0xa8, +0x8d, +0x3c, +0x3a, +0x86, +0x49, +0x6f, +0xdf, +0xa7, +0x33, +0xb1, +0x68, +0x39, +0x51, +0x82, +0xde, +0xf2, +0x69, +0xac, +0x9b, +0x93, +0x38, +0x50, +0x5b, +0x19, +0x5b, +0xc2, +0x14, +0x9c, +0x18, +0x0e, +0x4c, +0x2f, +0xf1, +0xfa, +0xd4, +0xb6, +0x5f, +0xb9, +0xb8, +0x47, +0xa4, +0xeb, +0xdd, +0xce, +0x46, +0x8d, +0x21, +0x88, +0xc3, +0xa6, +0xae, +0x07, +0x4e, +0xbf, +0xb6, +0x8c, +0x3a, +0x14, +0xbd, +0x99, +0xa0, +0x34, +0x49, +0xe2, +0xad, +0x68, +0xb0, +0x45, +0xcf, +0xbc, +0x27, +0x66, +0xcc, +0xeb, +0xb9, +0x14, +0x3c, +0x15, +0xb9, +0x53, +0x37, +0x26, +0x3a, +0x61, +0x4e, +0x1e, +0x2f, +0x1f, +0x1b, +0x33, +0x54, +0x87, +0xa1, +0x17, +0x8c, +0xdf, +0xaa, +0x51, +0x79, +0x55, +0xf2, +0xa5, +0x35, +0x38, +0x63, +0x87, +0x2b, +0x93, +0x04, +0x31, +0x54, +0x01, +0x04, +0x28, +0x2f, +0x0c, +0x2a, +0x34, +0x6c, +0x1d, +0x39, +0x3e, +0x53, +0x86, +0xf2, +0xb4, +0x0e, +0x48, +0x1c, +0xca, +0xb4, +0x57, +0x1d, +0x4c, +0x8d, +0x96, +0x6c, +0x2c, +0x99, +0x1e, +0xe3, +0x73, +0xda, +0xc1, +0x7d, +0x11, +0x79, +0x65, +0xe1, +0xe2, +0xef, +0xa5, +0xb8, +0x7f, +0xa2, +0x68, +0x0f, +0x8a, +0x59, +0xbe, +0xf2, +0xee, +0x0d, +0x8f, +0x70, +0x0a, +0x72, +0xe7, +0x71, +0xe9, +0x82, +0x08, +0x78, +0xa6, +0x6c, +0x3b, +0xff, +0x8c, +0x3a, +0x02, +0xfc, +0xcb, +0x4f, +0x94, +0x9a, +0x8f, +0x77, +0x1f, +0x65, +0x26, +0x27, +0xae, +0xe2, +0x6b, +0x50, +0x7a, +0xb8, +0x28, +0xf7, +0x4b, +0x7e, +0x5a, +0x6e, +0xd9, +0x3d, +0x07, +0x80, +0x20, +0x66, +0x0a, +0x34, +0xca, +0x66, +0xcd, +0xd2, +0xb9, +0x54, +0xea, +0x26, +0xe2, +0xad, +0x5b, +0x91, +0x61, +0x11, +0x26, +0xdb, +0xdd, +0x7b, +0x05, +0x5e, +0xfa, +0x2e, +0xdb, +0x96, +0xcf, +0x57, +0xdc, +0xda, +0xc3, +0xca, +0x00, +0x01, +0x5e, +0xc9, +0x25, +0xe2, +0xb3, +0x46, +0x30, +0x76, +0x3a, +0xbf, +0xbc, +0x7d, +0x2d, +0x02, +0xe1, +0x41, +0xb6, +0xaa, +0x8e, +0x71, +0x58, +0x11, +0x51, +0xd7, +0x09, +0x29, +0xd4, +0xdf, +0xe3, +0xe6, +0x04, +0x34, +0x6f, +0x7d, +0x29, +0x18, +0x13, +0x06, +0xeb, +0xb4, +0x5a, +0xb5, +0x9c, +0x7e, +0x22, +0x45, +0x23, +0x7a, +0x02, +0xe6, +0x27, +0x6c, +0xd9, +0x60, +0x48, +0xc3, +0xf6, +0xbb, +0x56, +0xb2, +0x36, +0x5e, +0xbd, +0x7e, +0xd8, +0xa3, +0x0d, +0xfd, +0xea, +0x4f, +0x7d, +0xe9, +0x55, +0x69, +0x5c, +0xb2, +0x44, +0x4d, +0xbc, +0xee, +0x2d, +0x5b, +0x96, +0x28, +0x95, +0x9d, +0xa9, +0x37, +0x53, +0xce, +0x2f, +0x65, +0xd8, +0x5a, +0x01, +0xd8, +0x11, +0xf6, +0xcc, +0x69, +0x20, +0x57, +0x2f, +0x1d, +0x0f, +0xe2, +0x8c, +0xc7, +0x57, +0x04, +0x7f, +0xfe, +0x3e, +0x5c, +0x57, +0x1e, +0x81, +0xba, +0x5b, +0x39, +0xe9, +0x2e, +0x4e, +0x8f, +0x1f, +0x21, +0x33, +0x91, +0x79, +0xc0, +0xa0, +0x3f, +0x2c, +0x9f, +0xf4, +0xfe, +0xb7, +0xac, +0x6e, +0xd3, +0x86, +0x2e, +0x2f, +0x2c, +0x79, +0x4f, +0xdc, +0x2b, +0x56, +0x1e, +0x70, +0x50, +0xf1, +0x58, +0x52, +0xb8, +0x7d, +0xb2, +0x9a, +0x86, +0x01, +0x31, +0xe4, +0x16, +0x0c, +0xec, +0x5e, +0x0b, +0xa6, +0x5e, +0x6d, +0x37, +0xee, +0xfc, +0x18, +0x9e, +0x5e, +0xb8, +0x7e, +0xca, +0x68, +0x51, +0x8c, +0x23, +0x7e, +0x03, +0xcf, +0x9e, +0xaf, +0x53, +0x36, +0xf9, +0xb3, +0xab, +0x01, +0xde, +0x25, +0x65, +0x55, +0xf0, +0x7d, +0xd3, +0x97, +0x2f, +0x59, +0xb9, +0xd6, +0xa1, +0xd6, +0x6d, +0xa4, +0x18, +0xc7, +0x15, +0xf9, +0xb3, +0x78, +0xa2, +0x62, +0x0e, +0x0a, +0x1f, +0xcd, +0xad, +0x37, +0xb4, +0x28, +0xa2, +0x18, +0xa3, +0x46, +0x10, +0x93, +0xd1, +0x18, +0x33, +0x47, +0x88, +0xbe, +0x17, +0xee, +0x21, +0x10, +0x47, +0x15, +0x6a, +0xc0, +0xa5, +0x1c, +0x0c, +0x4d, +0x82, +0x09, +0x33, +0xc3, +0x05, +0xb7, +0x50, +0x84, +0xbb, +0x36, +0xec, +0xfc, +0x14, +0xe9, +0x18, +0xbd, +0x69, +0xf3, +0x60, +0xc7, +0x52, +0x7b, +0xf3, +0x15, +0xea, +0x37, +0x2f, +0xd3, +0x67, +0x04, +0xa4, +0x29, +0x56, +0xa5, +0xe4, +0x5a, +0x86, +0xc1, +0x25, +0x94, +0xe9, +0x25, +0xeb, +0x80, +0xb0, +0x13, +0xd6, +0x03, +0xe3, +0xe6, +0x4d, +0x55, +0xc8, +0xd4, +0xe0, +0xe9, +0xa8, +0x59, +0x94, +0xc6, +0x53, +0x5a, +0xcc, +0xe6, +0xcc, +0xca, +0x67, +0x16, +0x7f, +0x6e, +0xd8, +0x29, +0x43, +0x36, +0xc1, +0x39, +0xef, +0xb9, +0x76, +0x3a, +0x85, +0x81, +0x1d, +0xee, +0xed, +0x3c, +0xa9, +0xaa, +0x24, +0x12, +0x44, +0x3d, +0x5b, +0x04, +0x98, +0x8e, +0xc7, +0xa9, +0xce, +0xbf, +0x08, +0x10, +0xa1, +0xd2, +0xc7, +0xdd, +0x23, +0x98, +0x63, +0xd4, +0x8a, +0xe0, +0x31, +0xaf, +0x80, +0x00, +0xf1, +0x01, +0x52, +0xba, +0x54, +0x9e, +0x79, +0xf1, +0x65, +0x76, +0x05, +0xbe, +0xfe, +0x2a, +0x81, +0x86, +0x1e, +0xbb, +0x3d, +0x4d, +0x91, +0x2e, +0x76, +0x2a, +0x9f, +0xba, +0xeb, +0xac, +0x73, +0x4c, +0x26, +0x16, +0xd1, +0xce, +0x53, +0xc3, +0x0d, +0x9d, +0xc1, +0xe0, +0x0a, +0xd3, +0xc3, +0x0c, +0xae, +0xca, +0x02, +0xd5, +0x9f, +0x12, +0xe5, +0x4d, +0x28, +0xd7, +0x45, +0x8a, +0x2d, +0xcb, +0x5c, +0x05, +0xb7, +0x63, +0x4b, +0x24, +0x8b, +0xe2, +0x31, +0xad, +0x1d, +0xcf, +0x66, +0xcd, +0x7c, +0x7b, +0x6a, +0x38, +0x50, +0x5a, +0x6c, +0x59, +0x29, +0xbe, +0x20, +0x6c, +0xf8, +0x1c, +0xed, +0x67, +0x47, +0x8e, +0xca, +0xd7, +0x6d, +0x10, +0xa4, +0x2c, +0xad, +0x6b, +0x7b, +0xcf, +0xdd, +0x79, +0xfb, +0x54, +0xb0, +0x40, +0x7d, +0xcc, +0x38, +0x07, +0x2e, +0x27, +0x55, +0x14, +0x00, +0x01, +0xda, +0x6a, +0x69, +0x7a, +0x15, +0xbc, +0x7b, +0x35, +0x81, +0x86, +0xe8, +0x25, +0x9a, +0x87, +0x68, +0xf2, +0x06, +0xc5, +0x09, +0x0a, +0x34, +0x75, +0xbf, +0xff, +0xea, +0xd5, +0xb1, +0x5b, +0x01, +0x03, +0xd3, +0x38, +0x9e, +0x24, +0xee, +0xc5, +0x83, +0xa0, +0x5a, +0x1d, +0x15, +0x94, +0x78, +0x50, +0x91, +0x23, +0x10, +0xe1, +0x79, +0x49, +0x2f, +0xb2, +0x25, +0x97, +0xfa, +0x29, +0x8f, +0x14, +0x2a, +0x55, +0x66, +0x3a, +0x72, +0xce, +0x0d, +0x5a, +0xc3, +0x87, +0xd3, +0x93, +0x41, +0xf8, +0x02, +0x05, +0x27, +0xd9, +0xa4, +0x9c, +0xd7, +0xee, +0xff, +0xd1, +0x3d, +0xcb, +0x77, +0xdd, +0x9b, +0x37, +0xb4, +0x29, +0x8f, +0xfb, +0xe5, +0xea, +0x18, +0xe7, +0x39, +0xa6, +0xe3, +0x84, +0xb8, +0xe8, +0x1a, +0xb8, +0xce, +0x38, +0xac, +0xcc, +0x7d, +0xda, +0x75, +0x44, +0x8b, +0x33, +0x0f, +0xa7, +0x75, +0x82, +0x43, +0xf9, +0xa6, +0xeb, +0xf4, +0x13, +0x06, +0x30, +0xa4, +0xba, +0x54, +0x45, +0x9d, +0x2c, +0xad, +0xd4, +0xfa, +0x05, +0xb7, +0x4e, +0x9d, +0xc9, +0x1a, +0x27, +0x1e, +0xa8, +0x9c, +0xa7, +0x8b, +0xab, +0xc2, +0x80, +0x20, +0xc1, +0x4d, +0xf8, +0xf4, +0x81, +0xab, +0x4d, +0xb2, +0xc2, +0xeb, +0xa2, +0xc2, +0xc6, +0xb7, +0x5e, +0x87, +0x35, +0x42, +0x86, +0xc3, +0x80, +0xd7, +0xa7, +0xa8, +0x9f, +0xb1, +0xa4, +0x92, +0x8b, +0xea, +0xcd, +0x85, +0x2b, +0x1e, +0xfb, +0x0f, +0x6c, +0x12, +0x3e, +0x78, +0x94, +0x23, +0xfb, +0xe7, +0x5d, +0x98, +0xca, +0xd3, +0x48, +0x4d, +0xf2, +0x23, +0xa8, +0x9f, +0x99, +0xe8, +0x9e, +0xc0, +0x19, +0x6d, +0xfb, +0xbe, +0x9a, +0xcc, +0xe8, +0x1a, +0x0f, +0x1a, +0x6a, +0xe9, +0x6f, +0xee, +0x6e, +0xda, +0x94, +0xb9, +0xae, +0x85, +0x7a, +0xdf, +0x85, +0x2f, +0x12, +0x3d, +0xc7, +0xb3, +0x7e, +0xce, +0x40, +0x91, +0x90, +0x07, +0xdb, +0x65, +0xe8, +0xea, +0x93, +0xe9, +0x84, +0x09, +0x25, +0xa9, +0xd1, +0x81, +0x68, +0xe3, +0xd0, +0x0d, +0x1a, +0x7b, +0x96, +0xeb, +0x22, +0x2c, +0xbe, +0xf5, +0x69, +0x54, +0x72, +0x23, +0x47, +0x6c, +0x72, +0x78, +0xfd, +0xbb, +0x93, +0x82, +0xe4, +0x32, +0x98, +0x34, +0xa5, +0xf1, +0xfb, +0xb9, +0xe9, +0x92, +0xb1, +0xf9, +0x14, +0xad, +0x7a, +0x11, +0x86, +0x2b, +0x2c, +0x18, +0xad, +0x3e, +0x00, +0x7d, +0x32, +0xc3, +0xbd, +0xc8, +0xcc, +0xd4, +0xba, +0x64, +0x67, +0x31, +0xb9, +0x02, +0xd8, +0xb9, +0xb5, +0x19, +0x85, +0x8c, +0xc2, +0x32, +0xce, +0x97, +0x46, +0x6a, +0x9c, +0xb9, +0xd5, +0x70, +0x46, +0xa0, +0x39, +0xea, +0x66, +0x65, +0xea, +0xad, +0x04, +0xbf, +0x9d, +0xdd, +0x7b, +0x7e, +0xe1, +0x34, +0x6b, +0x33, +0x2d, +0x78, +0xc2, +0xcd, +0x9f, +0x61, +0xea, +0xf4, +0x3a, +0xfc, +0xeb, +0xbe, +0x7a, +0xb5, +0x74, +0xba, +0x67, +0xae, +0x79, +0xd6, +0x8e, +0x32, +0x38, +0x73, +0x04, +0xc0, +0x09, +0x4b, +0x47, +0x2f, +0x33, +0xae, +0x4d, +0xb9, +0x14, +0xf4, +0xea, +0x81, +0x06, +0x8d, +0x0a, +0x37, +0x1b, +0xb2, +0xfe, +0x4e, +0x3e, +0x7b, +0x7a, +0x2e, +0x41, +0xcd, +0x57, +0x35, +0x96, +0x6e, +0xe1, +0x9f, +0xf4, +0x84, +0x93, +0x17, +0x3a, +0x18, +0x88, +0x45, +0x94, +0x25, +0x23, +0x8c, +0x6a, +0xd0, +0x49, +0x85, +0x38, +0xa2, +0xce, +0xab, +0xf9, +0xb3, +0xfa, +0x38, +0x66, +0x33, +0xc1, +0x58, +0x63, +0x1a, +0xe8, +0x1c, +0x93, +0xf3, +0x76, +0x38, +0x9f, +0x02, +0x82, +0x15, +0x35, +0x81, +0x23, +0x74, +0x2e, +0xe7, +0x59, +0x01, +0x72, +0xa5, +0xd9, +0x38, +0xec, +0xc4, +0xae, +0x76, +0xfb, +0xa2, +0xa6, +0xeb, +0x2d, +0x5e, +0x6c, +0xf2, +0xa3, +0xb7, +0x83, +0xc5, +0x29, +0x72, +0x16, +0x70, +0x9e, +0x66, +0xfa, +0xe9, +0xbd, +0x8c, +0x49, +0x84, +0x80, +0x22, +0xc2, +0x5e, +0xd9, +0xc7, +0x83, +0xda, +0x3e, +0x9b, +0x2b, +0x37, +0x5f, +0x1e, +0xda, +0x6d, +0x80, +0x63, +0x2a, +0xa8, +0x73, +0xc6, +0x6b, +0xb4, +0xd5, +0xb6, +0x39, +0x0b, +0xfd, +0x74, +0x2d, +0x00, +0xc2, +0x7c, +0x1b, +0x91, +0xf8, +0x43, +0x3d, +0x5a, +0xb2, +0x37, +0x6d, +0x3f, +0x60, +0xc1, +0x65, +0xa8, +0xe7, +0x94, +0xaf, +0x56, +0x7d, +0x19, +0x79, +0x10, +0xa2, +0xa7, +0xe9, +0x15, +0x36, +0x4c, +0x0c, +0x5e, +0x3d, +0xcb, +0x39, +0xba, +0x5a, +0xfe, +0xdb, +0x6d, +0xaa, +0xc2, +0x0c, +0x1b, +0x70, +0x3a, +0x73, +0x21, +0xaf, +0x8c, +0x2e, +0x7c, +0x6c, +0xbf, +0x19, +0x69, +0xb1, +0x80, +0xbf, +0xd4, +0x75, +0xbd, +0xa0, +0x92, +0xc2, +0x76, +0x89, +0x27, +0x0c, +0x1d, +0xe0, +0xc1, +0x16, +0x9b, +0x2e, +0x3d, +0xaf, +0xe0, +0x6f, +0x58, +0x6a, +0xf2, +0x25, +0xba, +0x84, +0xa5, +0x2f, +0x5f, +0x17, +0x12, +0xd2, +0x27, +0xde, +0xe8, +0xd4, +0xcf, +0x8a, +0xb3, +0x86, +0xdc, +0x43, +0x5a, +0x59, +0xe3, +0xc6, +0xed, +0xd1, +0x34, +0x1a, +0xc0, +0xa4, +0x1e, +0x2e, +0xb9, +0x5a, +0xb6, +0x2c, +0xda, +0xfb, +0x60, +0x93, +0xd2, +0xa1, +0xf5, +0x99, +0x36, +0x69, +0x8e, +0xae, +0x6d, +0x94, +0x10, +0xfd, +0x6b, +0x81, +0x03, +0xf9, +0xa0, +0xb6, +0x6c, +0x36, +0x1a, +0x31, +0xb5, +0x37, +0x94, +0x54, +0x4f, +0xd9, +0x68, +0xd0, +0x0f, +0x99, +0x82, +0x22, +0x46, +0x49, +0xc4, +0xa9, +0xb9, +0x3d, +0x29, +0xe0, +0xe7, +0x1e, +0x17, +0x2e, +0xdb, +0x2f, +0xbd, +0xbe, +0xc3, +0x15, +0x7f, +0xde, +0xdd, +0x3f, +0x16, +0xf6, +0xcc, +0x0c, +0x6f, +0x4f, +0x83, +0xa1, +0x9b, +0x64, +0x11, +0x3f, +0x44, +0x75, +0x1f, +0x82, +0x75, +0x1f, +0xd1, +0x1c, +0xbf, +0xa4, +0x0b, +0x85, +0xb0, +0xae, +0xcf, +0x04, +0x41, +0x71, +0x00, +0xdd, +0x6b, +0x15, +0x9b, +0x0e, +0x34, +0x0e, +0xb9, +0x19, +0xd8, +0xd2, +0xfb, +0x9c, +0x6e, +0x16, +0x4c, +0x22, +0xa4, +0x7c, +0x75, +0xb2, +0x4c, +0x9f, +0xfa, +0x9f, +0xb5, +0x29, +0x2c, +0x12, +0x51, +0x28, +0x30, +0xfb, +0xd6, +0x98, +0x46, +0x35, +0x5b, +0x72, +0x9f, +0x11, +0x16, +0x77, +0xc2, +0x72, +0x9f, +0x13, +0x37, +0x35, +0x44, +0x8e, +0x3d, +0xfe, +0xba, +0x15, +0x69, +0x13, +0x07, +0x2e, +0x5d, +0x29, +0x73, +0x41, +0xe1, +0x80, +0x87, +0xcf, +0xbf, +0x1c, +0x7d, +0x9a, +0x94, +0x81, +0x7e, +0x3c, +0xba, +0x8e, +0x5b, +0x7a, +0x74, +0xbc, +0x7c, +0x8f, +0x1e, +0x93, +0x50, +0xe7, +0x1e, +0x28, +0x01, +0xa3, +0x77, +0x1b, +0x63, +0x6f, +0x1e, +0xfb, +0xba, +0x3a, +0x34, +0xe3, +0x2e, +0xe8, +0x5c, +0x79, +0x42, +0x5e, +0xbf, +0xec, +0xbf, +0xa4, +0x48, +0x1b, +0x7b, +0x37, +0x2a, +0xde, +0xbe, +0x5d, +0x31, +0x3b, +0xcc, +0x59, +0x02, +0x3e, +0xae, +0x8f, +0x1e, +0xa9, +0x86, +0xb8, +0x1d, +0xfb, +0x46, +0xa7, +0xfc, +0x0a, +0x35, +0xc4, +0x89, +0x58, +0xc0, +0x62, +0x52, +0x7f, +0xdf, +0x09, +0x54, +0xef, +0xa5, +0xb9, +0x80, +0x00, +0x74, +0xa8, +0xc7, +0x45, +0x19, +0xc0, +0xa1, +0xcd, +0x0f, +0x39, +0x29, +0x64, +0x50, +0x99, +0xf3, +0xa6, +0xb9, +0x30, +0xf6, +0x56, +0x1a, +0xf4, +0x63, +0xdb, +0x01, +0xb9, +0xa7, +0x4e, +0xeb, +0x90, +0x97, +0x94, +0x7f, +0xbe, +0xc8, +0xd0, +0x17, +0xf4, +0x5c, +0x99, +0xb8, +0x0e, +0x9d, +0xaa, +0xdb, +0x5d, +0x8b, +0x35, +0xf5, +0x1e, +0xee, +0x63, +0x10, +0xc5, +0xa2, +0x53, +0x3f, +0x67, +0xdc, +0x01, +0xf9, +0x76, +0xe9, +0x39, +0x54, +0x3e, +0xce, +0x8c, +0x57, +0x31, +0x41, +0xc6, +0x39, +0xad, +0x6e, +0xe8, +0x11, +0x9b, +0xe0, +0x1c, +0xe7, +0x0a, +0x47, +0x3f, +0x05, +0x6d, +0x5c, +0x43, +0xe4, +0x50, +0x99, +0x07, +0x9d, +0xbd, +0xb8, +0xc3, +0xe3, +0xe1, +0x7c, +0x38, +0xd1, +0x76, +0x33, +0x52, +0x50, +0x61, +0x5a, +0x8c, +0xfb, +0xc8, +0x75, +0xb9, +0xc3, +0xfd, +0x7c, +0x5f, +0x64, +0x8b, +0x8e, +0x07, +0x38, +0x13, +0xd7, +0x8e, +0xc3, +0x56, +0xde, +0xbc, +0x0c, +0x59, +0x47, +0xd6, +0x1d, +0xcc, +0x32, +0x25, +0xfd, +0x38, +0x62, +0xe3, +0x1a, +0xe0, +0x4e, +0x5f, +0x1e, +0xfc, +0xf3, +0xb7, +0x76, +0x59, +0x2c, +0x16, +0x63, +0x40, +0xbb, +0x71, +0x25, +0x1d, +0x0f, +0xc0, +0x82, +0x22, +0xa2, +0xff, +0xbd, +0x29, +0x47, +0x7d, +0xa2, +0x56, +0x8d, +0xa1, +0x6d, +0xae, +0x07, +0x22, +0x32, +0x1f, +0x13, +0x16, +0x77, +0xc0, +0x82, +0x9c, +0x1e, +0x16, +0x57, +0x85, +0x17, +0x75, +0xa3, +0x4c, +0xb9, +0xfc, +0xaf, +0xe3, +0xda, +0xe3, +0x8c, +0x8c, +0x39, +0xde, +0xed, +0xec, +0x5c, +0xe4, +0x8c, +0xe6, +0x06, +0x76, +0x0e, +0x1c, +0x95, +0x58, +0xb7, +0xa4, +0x52, +0x46, +0xb0, +0x2f, +0x5e, +0x30, +0x36, +0x28, +0x5b, +0x77, +0xee, +0x78, +0xb9, +0x74, +0x68, +0x15, +0x41, +0xe2, +0x63, +0x8e, +0x9e, +0xbb, +0xf0, +0x63, +0x02, +0x74, +0xa8, +0xbe, +0x08, +0xc2, +0xa5, +0xc3, +0x0f, +0x93, +0xb9, +0xe2, +0x60, +0x1e, +0x31, +0xad, +0x99, +0xd7, +0xe6, +0xeb, +0x96, +0xb7, +0x2f, +0x7f, +0x77, +0xb7, +0xd3, +0x2b, +0x77, +0x47, +0x15, +0xdd, +0x34, +0xcd, +0x98, +0x11, +0xa8, +0x4f, +0xb9, +0x29, +0x91, +0xa5, +0x26, +0x77, +0xcf, +0xf5, +0xa5, +0x99, +0xf2, +0x4c, +0xe0, +0x12, +0xe4, +0x40, +0xea, +0x73, +0x1d, +0xfa, +0x7a, +0x92, +0x64, +0x9e, +0x1d, +0xb4, +0x3f, +0x19, +0x69, +0xb3, +0x64, +0x12, +0x75, +0x21, +0x50, +0x80, +0x01, +0xbc, +0x2a, +0x51, +0xd5, +0x8c, +0x38, +0x87, +0xcc, +0xff, +0xdd, +0xf9, +0xe1, +0xe2, +0x8a, +0xd1, +0x89, +0x41, +0xc0, +0x51, +0xf8, +0x7c, +0xf4, +0x77, +0x6b, +0xeb, +0x71, +0x80, +0x1a, +0x0c, +0x69, +0xc5, +0xaa, +0xe3, +0x25, +0x5c, +0x84, +0x94, +0x6a, +0xe4, +0x67, +0x6a, +0x18, +0x8e, +0xb8, +0x8d, +0x80, +0xab, +0x2c, +0xf2, +0xe6, +0x63, +0xc9, +0x54, +0x2a, +0xd6, +0x2e, +0xbf, +0xdd, +0x19, +0xb0, +0xe2, +0x27, +0xad, +0xb9, +0xf0, +0x43, +0xe5, +0x29, +0xb1, +0xe0, +0x42, +0xe7, +0x2d, +0xd8, +0x32, +0xe6, +0x4e, +0x1e, +0xbe, +0xdf, +0x1d, +0x99, +0xb0, +0xc3, +0xe5, +0x48, +0x12, +0xa6, +0xce, +0x1e, +0xbe, +0xdf, +0x3c, +0xfa, +0x57, +0x0d, +0x98, +0xb2, +0xc7, +0xed, +0x39, +0xf0, +0x62, +0x46, +0xef, +0x5c, +0x1b, +0xb4, +0xcb, +0xf5, +0x68, +0x33, +0xc5, +0xe9, +0x50, +0x03, +0x65, +0x48, +0xf3, +0x45, +0x08, +0x92, +0x87, +0x6d, +0x58, +0x13, +0xa4, +0xca, +0x16, +0xae, +0xde, +0x3e, +0xfe, +0x7e, +0x5f, +0x3c, +0xfa, +0x57, +0x2c, +0xda, +0x17, +0x8d, +0x79, +0x70, +0x62, +0x46, +0x0e, +0x9e, +0xbe, +0xfe, +0x5f, +0x1d, +0x99, +0x91, +0x81, +0x61, +0x40, +0xe3, +0x44, +0xeb, +0x54, +0x0b, +0x75, +0x49, +0xf1, +0x41, +0x00, +0x63, +0x25, +0xa9, +0xb1, +0xc1, +0x00, +0x82, +0x86, +0x6f, +0x3d, +0xf8, +0x53, +0x05, +0x88, +0x73, +0x45, +0x08, +0x73, +0x64, +0x4a, +0xf7, +0x6c, +0x5a, +0x17, +0xac, +0xda, +0x17, +0x8d, +0x79, +0x51, +0x20, +0xc2, +0xe7, +0x2d, +0xd8, +0x13, +0xa4, +0xca, +0xf7, +0x4d, +0x18, +0x93, +0x85, +0x69, +0x31, +0xe0, +0x23, +0xc4, +0x0a, +0x77, +0x6c, +0x5a, +0x36, +0xcf, +0xfd, +0x59, +0x11, +0x81, +0x80, +0x82, +0x86, +0x8e, +0x7f, +0x7c, +0x5b, +0x34, +0xea, +0x56, +0x2e, +0xbf, +0xfc, +0x7a, +0x76, +0x4f, +0xfd, +0x59, +0x30, +0xe2, +0x46, +0xef, +0x5c, +0x3a, +0xd7, +0x0d, +0x79, +0x51, +0x20, +0xa3, +0xa5, +0xc8, +0xf3, +0x64, +0x2b, +0xb5, +0xe8, +0x52, +0x07, +0x8c, +0x9a, +0x97, +0x8d, +0x98, +0xb2, +0xc7, +0x0c, +0x7b, +0x74, +0x4b, +0xf5, +0x68, +0x52, +0x07, +0x6d, +0x39, +0xf0, +0x62, +0x27, +0xad, +0xd8, +0x13, +0x85, +0x88, +0x73, +0x45, +0xe9, +0x50, +0x03, +0x84, +0x8a, +0x77, +0x6c, +0x5a, +0x17, +0x8d, +0x98, +0x93, +0x85, +0x88, +0x92, +0xa6, +0xaf, +0xdc, +0x3a, +0xd7, +0x0d, +0x98, +0xb2, +0xe6, +0x2f, +0xdc, +0x1b, +0xb4, +0xcb, +0xf5, +0x68, +0x52, +0x07, +0x6d, +0x39, +0xd1, +0x01, +0x80, +0x63, +0x44, +0xeb, +0x35, +0xc9, +0xf1, +0x60, +0x42, +0x06, +0x8e, +0x9e, +0xbe, +0xfe, +0x7e, +0x7e, +0x5f, +0x1d, +0x99, +0xb0, +0xe2, +0x46, +0xef, +0x5c, +0x1b, +0x95, +0xa8, +0xd2, +0x26, +0xce, +0xff, +0x5d, +0x19, +0xb0, +0xe2, +0x46, +0x0e, +0x7f, +0x5d, +0x38, +0xf2, +0x47, +0x0c, +0x7b, +0x74, +0x4b, +0xf5, +0x68, +0x52, +0x26, +0xce, +0xff, +0x7c, +0x7a, +0x57, +0x2c, +0xbb, +0xd5, +0x09, +0x90, +0x83, +0x84, +0x6b, +0x54, +0x2a, +0xb7, +0xcd, +0xf9, +0x51, +0x01, +0x80, +0x82, +0x86, +0x8e, +0x7f, +0x5d, +0x38, +0xf2, +0x47, +0x0c, +0x9a, +0x97, +0xac, +0xda, +0x17, +0x8d, +0x79, +0x51, +0x01, +0x61, +0x40, +0xe3, +0x44, +0xeb, +0x54, +0x0b, +0x75, +0x68, +0x33, +0xc5, +0x08, +0x73, +0x45, +0xe9, +0x31, +0xe0, +0x23, +0xc4, +0xeb, +0x35, +0xe8, +0x33, +0xc5, +0xe9, +0x31, +0xc1, +0xe1, +0x40, +0x02, +0x86, +0x8e, +0x7f, +0x7c, +0x7a, +0x76, +0x6e, +0x3f, +0xdd, +0x19, +0xb0, +0xe2, +0x46, +0x0e, +0x9e, +0x9f, +0xbc, +0xdb, +0x15, +0xa8, +0xd2, +0x07, +0x6d, +0x39, +0xf0, +0x43, +0xe5, +0x29, +0xb1, +0xe0, +0x23, +0xa5, +0xc8, +0x12, +0xa6, +0xce, +0x1e, +0x9f, +0xbc, +0xfa, +0x76, +0x6e, +0x3f, +0xfc, +0x5b, +0x34, +0xea, +0x56, +0x0f, +0x9c, +0xba, +0xd7, +0x0d, +0x79, +0x51, +0x01, +0x80, +0x63, +0x25, +0xc8, +0x12, +0x87, +0x6d, +0x39, +0xf0, +0x62, +0x46, +0xef, +0x3d, +0xd9, +0x30, +0xe2, +0x27, +0xad, +0xd8, +0x32, +0xe6, +0x4e, +0xff, +0x7c, +0x7a, +0x76, +0x6e, +0x5e, +0x1f, +0xbc, +0xdb, +0x15, +0xa8, +0xd2, +0x26, +0xce, +0x1e, +0x9f, +0x9d, +0x99, +0x91, +0xa0, +0xc2, +0xe7, +0x2d, +0xd8, +0x13, +0x85, +0x69, +0x50, +0x22, +0xa7, +0xcc, +0x1a, +0xb6, +0xcf, +0x1c, +0xba, +0xf6, +0x6e, +0x5e, +0x3e, +0xdf, +0x1d, +0xb8, +0xd3, +0x24, +0xab, +0xd4, +0x2a, +0xd6, +0x0f, +0x7d, +0x59, +0x11, +0xa0, +0xc2, +0xe7, +0x4c, +0x1a, +0x97, +0x8d, +0x98, +0x93, +0xa4, +0xca, +0xf7, +0x6c, +0x5a, +0x17, +0xac, +0xbb, +0xf4, +0x6a, +0x56, +0x0f, +0x9c, +0xba, +0xd7, +0x0d, +0x98, +0x93, +0xa4, +0xca, +0xf7, +0x6c, +0x3b, +0xd5, +0x09, +0x71, +0x60, +0x42, +0x06, +0x6f, +0x3d, +0xd9, +0x30, +0xc3, +0x04, +0x8a, +0x96, +0x8f, +0x7d, +0x78, +0x53, +0x24, +0xca, +0xf7, +0x4d, +0x18, +0xb2, +0xe6, +0x4e, +0xff, +0x5d, +0x38, +0xd3, +0x05, +0x69, +0x50, +0x03, +0x84, +0x8a, +0x96, +0x8f, +0x9c, +0x9b, +0xb4, +0xea, +0x37, +0xec, +0x5a, +0x17, +0xac, +0xbb, +0xf4, +0x6a, +0x37, +0xcd, +0xf9, +0x70, +0x43, +0xe5, +0x48, +0xf3, +0x45, +0x08, +0x92, +0x87, +0x8c, +0x7b, +0x74, +0x4b, +0xf5, +0x49, +0xf1, +0x41, +0xe1, +0x40, +0x02, +0x86, +0x6f, +0x3d, +0xd9, +0x11, +0x81, +0x61, +0x40, +0x02, +0x86, +0x6f, +0x3d, +0xf8, +0x53, +0x24, +0xca, +0x16, +0xae, +0xde, +0x3e, +0xdf, +0x1d, +0x99, +0x91, +0xa0, +0xa3, +0xc4, +0xeb, +0x35, +0xe8, +0x52, +0x07, +0x8c, +0x7b, +0x74, +0x6a, +0x37, +0xcd, +0xf9, +0x51, +0x20, +0xc2, +0x06, +0x8e, +0x7f, +0x7c, +0x7a, +0x57, +0x0d, +0x79, +0x51, +0x20, +0xc2, +0x06, +0x8e, +0x7f, +0x5d, +0x19, +0xb0, +0xc3, +0xe5, +0x29, +0xd0, +0x22, +0xa7, +0xcc, +0xfb, +0x55, +0x28, +0xb3, +0xc5, +0xe9, +0x50, +0x22, +0xa7, +0xcc, +0x1a, +0xb6, +0xcf, +0x1c, +0x9b, +0xb4, +0xea, +0x56, +0x2e, +0xbf, +0xdd, +0x19, +0xb0, +0xe2, +0x46, +0xef, +0x5c, +0x3a, +0xd7, +0x0d, +0x79, +0x70, +0x62, +0x27, +0xad, +0xd8, +0x13, +0xa4, +0xab, +0xd4, +0x2a, +0xb7, +0xec, +0x5a, +0x17, +0x8d, +0x79, +0x70, +0x43, +0x04, +0x8a, +0x77, +0x4d, +0xf9, +0x70, +0x62, +0x27, +0xcc, +0x1a, +0xb6, +0xee, +0x3f, +0xdd, +0x38, +0xf2, +0x47, +0x0c, +0x7b, +0x55, +0x28, +0xd2, +0x07, +0x8c, +0x9a, +0xb6, +0xcf, +0x1c, +0x9b, +0x95, +0x89, +0x71, +0x60, +0x42, +0xe7, +0x2d, +0xd8, +0x13, +0x85, +0x88, +0x92, +0xa6, +0xce, +0x1e, +0xbe, +0xfe, +0x7e, +0x7e, +0x7e, +0x7e, +0x7e, +0x7e, +0x5f, +0x3c, +0xdb, +0x34, +0xea, +0x56, +0x2e, +0xde, +0x1f, +0xbc, +0xfa, +0x76, +0x4f, +0x1c, +0x9b, +0x95, +0x89, +0x71, +0x60, +0x23, +0xa5, +0xc8, +0xf3, +0x64, +0x4a, +0x16, +0xae, +0xbf, +0xfc, +0x7a, +0x76, +0x6e, +0x3f, +0xdd, +0x19, +0x91, +0xa0, +0xa3, +0xc4, +0x0a, +0x77, +0x4d, +0x18, +0xb2, +0xe6, +0x2f, +0xdc, +0x1b, +0x95, +0xa8, +0xb3, +0xc5, +0xe9, +0x50, +0x22, +0xc6, +0x0e, +0x9e, +0x9f, +0x9d, +0xb8, +0xf2, +0x47, +0xed, +0x58, +0x13, +0x85, +0x69, +0x50, +0x22, +0xa7, +0xad, +0xb9, +0xd1, +0x01, +0x80, +0x82, +0x86, +0x8e, +0x7f, +0x5d, +0x19, +0x91, +0x81, +0x80, +0x82, +0x67, +0x4c, +0xfb, +0x55, +0x28, +0xb3, +0xe4, +0x2b, +0xd4, +0x2a, +0xd6, +0x2e, +0xde, +0x3e, +0xfe, +0x5f, +0x1d, +0xb8, +0xd3, +0x24, +0xab, +0xb5, +0xe8, +0x52, +0x26, +0xaf, +0xbd, +0xd9, +0x30, +0xc3, +0x04, +0x6b, +0x54, +0x2a, +0xb7, +0xcd, +0xf9, +0x70, +0x43, +0xe5, +0x48, +0x12, +0xa6, +0xaf, +0xdc, +0x1b, +0xb4, +0xcb, +0x14, +0x8b, +0x75, +0x49, +0x10, +0x83, +0x65, +0x29, +0xb1, +0xc1, +0x00, +0x63, +0x44, +0xeb, +0x54, +0x0b, +0x94, +0x8b, +0x75, +0x68, +0x33, +0xc5, +0xe9, +0x31, +0xe0, +0x42, +0x06, +0x8e, +0x7f, +0x7c, +0x7a, +0x57, +0x0d, +0x79, +0x70, +0x62, +0x46, +0x0e, +0x9e, +0x9f, +0x9d, +0xb8, +0xd3, +0x05, +0x69, +0x31, +0xc1, +0xe1, +0x21, +0xa1, +0xc0, +0x02, +0x67, +0x2d, +0xd8, +0x13, +0xa4, +0xca, +0x16, +0x8f, +0x7d, +0x78, +0x53, +0x05, +0x69, +0x50, +0x03, +0x65, +0x48, +0x12, +0x87, +0x6d, +0x39, +0xf0, +0x43, +0xe5, +0x48, +0x12, +0x87, +0x8c, +0x9a, +0x97, +0x8d, +0x79, +0x51, +0x20, +0xc2, +0x06, +0x6f, +0x5c, +0x3a, +0xf6, +0x6e, +0x3f, +0xdd, +0x19, +0xb0, +0xc3, +0xe5, +0x29, +0xb1, +0xc1, +0x00, +0x63, +0x25, +0xa9, +0xb1, +0xe0, +0x42, +0xe7, +0x2d, +0xb9, +0xd1, +0x20, +0xa3, +0xc4, +0xeb, +0x54, +0x2a, +0xd6, +0x0f, +0x7d, +0x78, +0x72, +0x66, +0x2f, +0xdc, +0x3a, +0xf6, +0x4f, +0x1c, +0xba, +0xf6, +0x6e, +0x3f, +0xfc, +0x5b, +0x15, +0x89, +0x71, +0x60, +0x23, +0xa5, +0xc8, +0x12, +0x87, +0x6d, +0x58, +0x32, +0xc7, +0x0c, +0x9a, +0x97, +0x8d, +0x98, +0xb2, +0xe6, +0x4e, +0x1e, +0x9f, +0x9d, +0x99, +0xb0, +0xe2, +0x46, +0xef, +0x5c, +0x3a, +0xd7, +0x0d, +0x98, +0xb2, +0xe6, +0x2f, +0xbd, +0xf8, +0x72, +0x47, +0xed, +0x58, +0x13, +0xa4, +0xca, +0x16, +0x8f, +0x9c, +0x9b, +0x95, +0xa8, +0xb3, +0xe4, +0x2b, +0xd4, +0x2a, +0xb7, +0xcd, +0x18, +0x93, +0xa4, +0xab, +0xb5, +0xc9, +0x10, +0x83, +0x65, +0x48, +0x12, +0x87, +0x6d, +0x39, +0xd1, +0x01, +0x80, +0x82, +0x86, +0x6f, +0x5c, +0x1b, +0xb4, +0xcb, +0xf5, +0x68, +0x33, +0xe4, +0x4a, +0x16, +0x8f, +0x7d, +0x78, +0x53, +0x24, +0xab, +0xb5, +0xe8, +0x33, +0xe4, +0x4a, +0xf7, +0x6c, +0x5a, +0x17, +0xac, +0xbb, +0xd5, +0x28, +0xb3, +0xc5, +0x08, +0x92, +0x87, +0x6d, +0x39, +0xd1, +0x20, +0xa3, +0xa5, +0xc8, +0x12, +0xa6, +0xaf, +0xdc, +0x1b, +0xb4, +0xcb, +0x14, +0xaa, +0xb7, +0xcd, +0x18, +0x93, +0x85, +0x69, +0x50, +0x03, +0x65, +0x29, +0xb1, +0xc1, +0x00, +0x82, +0x86, +0x6f, +0x3d, +0xd9, +0x30, +0xc3, +0x04, +0x6b, +0x35, +0xe8, +0x33, +0xe4, +0x2b, +0xd4, +0x0b, +0x75, +0xa9, +0x6b, +0xbb, +0xff +}; diff --git a/srom_3360_0x05.h b/srom_3360_0x05.h new file mode 100644 index 0000000..bed6865 --- /dev/null +++ b/srom_3360_0x05.h @@ -0,0 +1,4099 @@ +#define SROM_LENGTH (4094) + +const uint8_t PROGMEM srom[SROM_LENGTH] = +{ +0x01, +0x05, +0x8d, +0x92, +0x66, +0x67, +0x1e, +0xbe, +0xfe, +0x5f, +0x1d, +0xb8, +0xf2, +0x66, +0x4e, +0xff, +0x5d, +0x38, +0xf2, +0x46, +0x0c, +0x98, +0x97, +0x8d, +0x79, +0x51, +0x20, +0xc2, +0x06, +0x8e, +0x9e, +0xbe, +0xfe, +0x7e, +0x5f, +0x1d, +0xb8, +0xd3, +0x24, +0xca, +0x16, +0x8f, +0x7d, +0x78, +0x53, +0x05, +0x88, +0x73, +0x45, +0xe9, +0x55, +0x22, +0xa7, +0xae, +0xd8, +0x32, +0xe6, +0x2f, +0xbd, +0xf8, +0x72, +0x47, +0x0c, +0x7b, +0x74, +0x6a, +0x56, +0x2e, +0xbf, +0xdd, +0x38, +0xd5, +0x20, +0xca, +0x16, +0xae, +0xde, +0x1f, +0x9d, +0xb8, +0xf2, +0x47, +0x0c, +0x7b, +0x55, +0x28, +0xd2, +0x26, +0xaf, +0xdc, +0x3a, +0xd7, +0x2c, +0xbb, +0xd5, +0x09, +0x90, +0xa2, +0xa7, +0xcc, +0xfb, +0x74, +0x4b, +0xf5, +0x49, +0x10, +0x83, +0x84, +0x8a, +0x77, +0x4d, +0x18, +0xb2, +0xe6, +0x4e, +0x1e, +0x9f, +0xbc, +0xfa, +0x6a, +0xea, +0xab, +0x55, +0x91, +0xa9, +0xda, +0x58, +0xa9, +0xe1, +0x1a, +0xc2, +0x52, +0x1c, +0x0d, +0xef, +0x50, +0x71, +0x04, +0x21, +0x93, +0x87, +0x0e, +0xb1, +0xa9, +0x4a, +0xc0, +0x24, +0xaf, +0xe3, +0x26, +0xa2, +0x8d, +0xa1, +0x6d, +0xf2, +0x88, +0x9e, +0x99, +0xbb, +0xf2, +0x62, +0x38, +0xfe, +0x78, +0x1d, +0x58, +0x19, +0x9b, +0xbe, +0x10, +0x6c, +0x15, +0x9e, +0x50, +0x8b, +0x99, +0x40, +0x92, +0x01, +0x38, +0xb6, +0x97, +0x83, +0x51, +0x59, +0xa6, +0xb7, +0xc9, +0x48, +0xfd, +0x68, +0x21, +0x78, +0xf4, +0x2e, +0x86, +0x61, +0xb0, +0xb2, +0x2b, +0x5b, +0xf0, +0x1b, +0x71, +0xa3, +0x0a, +0xd5, +0xd6, +0x30, +0x7a, +0x0c, +0xf8, +0xaf, +0xc6, +0x54, +0x6b, +0x89, +0x30, +0x58, +0xe8, +0xe2, +0x0d, +0x39, +0x2f, +0x47, +0xa0, +0x41, +0x74, +0x5d, +0xd6, +0xf3, +0x85, +0xb7, +0x66, +0x59, +0x51, +0x74, +0x3d, +0xfe, +0xee, +0x3a, +0x1e, +0x2a, +0x5f, +0x93, +0x0c, +0x3f, +0xd4, +0x4d, +0x24, +0x13, +0x2c, +0xf2, +0x7b, +0x4d, +0x06, +0x60, +0x2e, +0x39, +0xa9, +0xd4, +0x72, +0x36, +0xb6, +0x4d, +0xea, +0x8c, +0xd9, +0xa7, +0xbc, +0x38, +0xe7, +0xbb, +0xb7, +0x7b, +0x04, +0x08, +0x83, +0x5a, +0x27, +0x6f, +0x42, +0xc6, +0x7e, +0xbd, +0x97, +0x0e, +0x55, +0xdc, +0x79, +0x63, +0xd8, +0x89, +0xc1, +0x83, +0x3d, +0x34, +0x01, +0x76, +0xff, +0xde, +0x7f, +0x65, +0x4b, +0xb3, +0x46, +0x56, +0x8d, +0x9e, +0x6f, +0x1f, +0x2b, +0xa4, +0x69, +0x54, +0xde, +0x1c, +0x2d, +0xa8, +0x51, +0x7e, +0xdf, +0xbb, +0x18, +0x90, +0x27, +0xaf, +0x79, +0xd1, +0x86, +0x4f, +0x44, +0x88, +0x7f, +0xb9, +0x80, +0x21, +0xa9, +0x5d, +0x7b, +0xd4, +0x81, +0x21, +0xa9, +0x13, +0x59, +0x72, +0x58, +0x11, +0xe3, +0xf2, +0xf7, +0xae, +0xc3, +0xc2, +0x64, +0x1d, +0xfb, +0xd8, +0x91, +0x2d, +0x13, +0xb5, +0x0e, +0x67, +0xdb, +0xbc, +0x63, +0xde, +0xa0, +0x86, +0x49, +0x6c, +0x40, +0x82, +0x82, +0x3f, +0xeb, +0x38, +0x22, +0xa8, +0x20, +0x1e, +0xc5, +0x5f, +0x25, +0xea, +0xaf, +0xe6, +0x78, +0x1c, +0x41, +0x0b, +0x5a, +0x94, +0xcc, +0x8d, +0x0d, +0xc5, +0xb8, +0x9c, +0x1a, +0x9f, +0x6d, +0xa8, +0x57, +0xe9, +0x1a, +0xf0, +0xad, +0x6c, +0x26, +0x5f, +0xb8, +0x38, +0x16, +0x0e, +0x28, +0xd6, +0x76, +0x5a, +0xc2, +0xb7, +0x6a, +0x9e, +0x26, +0x9d, +0x3e, +0x1f, +0x25, +0xb0, +0x14, +0x46, +0xcd, +0x67, +0x49, +0x93, +0x13, +0x81, +0x01, +0x46, +0x72, +0x31, +0x42, +0x91, +0x87, +0x6c, +0x1c, +0xb8, +0x08, +0x72, +0x6a, +0x33, +0x64, +0xed, +0xc0, +0x99, +0xb9, +0xf6, +0x34, +0xe9, +0xa5, +0x6c, +0x57, +0x9a, +0x72, +0x18, +0x48, +0x62, +0xc1, +0x88, +0xcf, +0xa3, +0x50, +0x53, +0x50, +0xdf, +0xc8, +0x9f, +0xf0, +0xb6, +0xa2, +0x23, +0xc4, +0xaa, +0xe3, +0xd0, +0xe2, +0xab, +0x76, +0xc8, +0x4a, +0x02, +0x21, +0xdd, +0xf3, +0x59, +0xdc, +0x30, +0x6e, +0xb5, +0x42, +0xe2, +0x9d, +0x8a, +0xdf, +0xfd, +0xa5, +0x41, +0x75, +0x01, +0x83, +0xbe, +0x47, +0xa5, +0x21, +0x30, +0x3b, +0x0e, +0x33, +0x2e, +0x74, +0xaf, +0x27, +0x90, +0xf4, +0x20, +0xa7, +0x1b, +0xff, +0x77, +0x01, +0xab, +0x79, +0x0a, +0xfb, +0x86, +0x1e, +0x1f, +0x22, +0x6d, +0x75, +0x75, +0xfc, +0xe0, +0x8c, +0xa2, +0x72, +0x0f, +0x45, +0x48, +0xf9, +0x43, +0x10, +0xf0, +0x57, +0x15, +0x17, +0x74, +0x40, +0x8f, +0x77, +0x69, +0x8a, +0xd4, +0x0f, +0x25, +0x27, +0x0a, +0xe8, +0x84, +0x73, +0x41, +0xb9, +0x5f, +0xb6, +0xc8, +0x2f, +0x02, +0x83, +0xdc, +0x1e, +0x1c, +0xdb, +0x3f, +0x2d, +0x58, +0xf7, +0x5e, +0xfd, +0x6f, +0xda, +0xad, +0xdc, +0x43, +0x01, +0x22, +0xc6, +0x45, +0x9c, +0xec, +0x56, +0x8a, +0x1a, +0x4e, +0xaa, +0xae, +0x3a, +0xa1, +0xf3, +0xf1, +0x9a, +0x97, +0x8d, +0x79, +0x51, +0x01, +0xf5, +0x31, +0x04, +0xcd, +0x2a, +0xbc, +0xfd, +0xac, +0x59, +0x1b, +0x0a, +0xe2, +0x26, +0xdd, +0x2f, +0x96, +0xaa, +0x62, +0xc5, +0x6d, +0xb8, +0xe1, +0x72, +0x4e, +0x4e, +0xb7, +0x4f, +0x9f, +0xaa, +0x33, +0x75, +0x8b, +0x43, +0x44, +0x0a, +0xc3, +0x0a, +0x5e, +0x9c, +0xdb, +0x1e, +0x4e, +0xbd, +0x0f, +0xec, +0x09, +0x96, +0x5a, +0x37, +0x6d, +0x10, +0x44, +0xd4, +0x91, +0xc0, +0xc3, +0x0d, +0x35, +0x62, +0xcf, +0x0a, +0xb1, +0x1a, +0x8a, +0xda, +0xa8, +0xcf, +0xbc, +0x3a, +0xb2, +0x4f, +0x59, +0x29, +0xd9, +0x91, +0x96, +0x0d, +0x6b, +0x9c, +0xcf, +0x34, +0x5b, +0x76, +0x7b, +0xb2, +0xb2, +0xce, +0xbf, +0x72, +0xd9, +0x96, +0x4a, +0xc0, +0x2d, +0x89, +0x33, +0xd0, +0xe4, +0xbe, +0x69, +0x7f, +0x1c, +0x9e, +0x71, +0x19, +0x12, +0xf6, +0x74, +0xfb, +0xd6, +0x41, +0x95, +0x69, +0xf0, +0xe9, +0xa7, +0x50, +0x82, +0x04, +0x78, +0x4d, +0x99, +0xb3, +0xa7, +0xfe, +0xee, +0x7f, +0xed, +0x56, +0x57, +0x57, +0xe9, +0xd3, +0x6a, +0x43, +0xf4, +0x0b, +0x6d, +0xba, +0x34, +0xde, +0xf8, +0x4c, +0x45, +0xae, +0x00, +0x32, +0x1a, +0x4e, +0xff, +0x54, +0x60, +0x6a, +0xd9, +0x59, +0x18, +0xd3, +0xbe, +0x5a, +0x94, +0x16, +0x9d, +0xec, +0xdf, +0xb4, +0x48, +0x8e, +0x6f, +0x19, +0xf8, +0xe6, +0xec, +0x7f, +0xb7, +0x49, +0x92, +0xb3, +0xb6, +0xec, +0x7e, +0xdc, +0x08, +0x3b, +0xe5, +0x5b, +0x88, +0xf9, +0x92, +0xf3, +0x7c, +0x9d, +0x7c, +0x22, +0xf2, +0x5d, +0x7d, +0x76, +0x07, +0x2e, +0x42, +0xd6, +0x9e, +0x5a, +0xbc, +0x7d, +0xfd, +0xb5, +0x92, +0x4a, +0x7f, +0xbf, +0xac, +0xc0, +0xb6, +0x18, +0x8b, +0x02, +0x71, +0xae, +0xc7, +0xa8, +0x8c, +0x19, +0xc1, +0x0a, +0x36, +0x3e, +0xa4, +0x2d, +0xa6, +0xbb, +0xe8, +0x77, +0x34, +0x45, +0xca, +0x60, +0x52, +0xf0, +0x26, +0xf7, +0x58, +0x68, +0x34, +0x28, +0xb5, +0x29, +0xe5, +0xb8, +0x65, +0x0f, +0xc8, +0xc2, +0x64, +0x50, +0x91, +0x12, +0xa1, +0x7b, +0xd7, +0x09, +0x74, +0x5f, +0xcc, +0xac, +0x9d, +0xac, +0x0a, +0xd1, +0x46, +0xbe, +0xc2, +0x2d, +0xa6, +0x67, +0x69, +0x69, +0x55, +0x8a, +0xbd, +0x67, +0xd9, +0x31, +0xc7, +0x80, +0x7c, +0xd5, +0xb2, +0xbe, +0x83, +0x17, +0x7a, +0x2e, +0xf4, +0x3e, +0x14, +0xa5, +0x62, +0x77, +0xa5, +0xdb, +0x77, +0x58, +0x35, +0x5f, +0xc4, +0x6c, +0xd2, +0xf2, +0x38, +0x91, +0x74, +0x80, +0x95, +0x52, +0xd2, +0xaf, +0xe2, +0x1b, +0x12, +0xfe, +0x4b, +0x5f, +0x84, +0x5f, +0x7d, +0x7e, +0x0b, +0xd9, +0x42, +0x72, +0xf1, +0x32, +0x1d, +0x8d, +0x5c, +0xcb, +0x20, +0x05, +0x4f, +0xbe, +0xbf, +0x40, +0xe9, +0xa6, +0x9f, +0xff, +0x05, +0xe1, +0x73, +0x52, +0x65, +0xb4, +0x59, +0x45, +0x04, +0x10, +0xe1, +0xdc, +0x0b, +0x30, +0xaa, +0x23, +0x4d, +0xb9, +0x58, +0xe5, +0xf1, +0xa3, +0x9c, +0xf2, +0xf7, +0xaf, +0xbc, +0xe3, +0xa7, +0x0d, +0x68, +0x97, +0x6c, +0x2b, +0x33, +0x60, +0xe3, +0xce, +0x7c, +0xda, +0xd1, +0x2d, +0x78, +0x52, +0x10, +0xa0, +0xf7, +0x9a, +0xf4, +0x79, +0xdb, +0xa5, +0x2a, +0x71, +0xc6, +0xcf, +0xa0, +0x68, +0xd0, +0x32, +0x2a, +0xd3, +0xb2, +0xe8, +0x03, +0x27, +0xbe, +0x55, +0xfd, +0x0e, +0x90, +0xa2, +0x76, +0x8c, +0xdc, +0xbd, +0x69, +0x9c, +0xb6, +0x18, +0x92, +0xe3, +0xb3, +0x23, +0x1d, +0x3c, +0x85, +0x2a, +0x2b, +0x04, +0x3a, +0xf5, +0xee, +0xf8, +0xd2, +0xdd, +0x6d, +0x52, +0xa2, +0x45, +0x75, +0xd9, +0xa1, +0x03, +0x23, +0x83, +0x24, +0x04, +0xe7, +0xee, +0xa2, +0x14, +0x4e, +0xa9, +0xde, +0x4e, +0x9d, +0x24, +0x1a, +0x63, +0xd3, +0x4b, +0xf7, +0x71, +0xc1, +0xe7, +0xfb, +0x48, +0xa4, +0x7c, +0x39, +0xcb, +0x80, +0xdd, +0x5e, +0xaf, +0x0d, +0xca, +0xef, +0x58, +0x17, +0xf4, +0xca, +0x0c, +0x00, +0x30, +0x68, +0x3e, +0x5d, +0x9b, +0xc3, +0x19, +0x27, +0x7a, +0x35, +0x32, +0x5c, +0x7b, +0x92, +0x16, +0x7f, +0x6e, +0x86, +0x6b, +0x50, +0x7a, +0xd6, +0x15, +0x10, +0x16, +0xa8, +0x28, +0xb1, +0xa1, +0xd8, +0xda, +0xc8, +0xfd, +0x5b, +0xe2, +0xc0, +0xd6, +0x8d, +0x75, +0xbd, +0x1c, +0x0b, +0x27, +0xfe, +0x1d, +0x09, +0x23, +0x13, +0x4f, +0x5a, +0x5a, +0xf8, +0xbe, +0x5d, +0x31, +0x8a, +0x81, +0xaf, +0xbe, +0xed, +0x00, +0x43, +0x14, +0x8f, +0xa5, +0x4a, +0xfe, +0x90, +0xe1, +0x67, +0x25, +0x29, +0x52, +0x2f, +0x26, +0x17, +0xef, +0x6e, +0xe6, +0x1e, +0xaf, +0x7f, +0x4a, +0x40, +0x15, +0xc7, +0x6e, +0x8d, +0x60, +0x92, +0xd6, +0x8d, +0x95, +0xca, +0xff, +0x8e, +0xfe, +0x4b, +0x8d, +0x1a, +0x83, +0x40, +0xe6, +0xb7, +0xbc, +0x6b, +0xd6, +0x39, +0x53, +0xd0, +0x4a, +0xe6, +0x1f, +0x1f, +0xb1, +0x16, +0x6a, +0xae, +0x6a, +0x6d, +0xe3, +0xe6, +0xed, +0x4e, +0xff, +0x49, +0x28, +0xc7, +0xaf, +0xb4, +0x14, +0x9f, +0x85, +0x9f, +0xfe, +0x6a, +0x92, +0x93, +0x9c, +0x6f, +0xff, +0x4a, +0xd4, +0x3e, +0x26, +0xd9, +0x72, +0x4f, +0x01, +0xe2, +0x54, +0x06, +0xc6, +0x7d, +0xb8, +0xef, +0x0b, +0x04, +0x56, +0x3a, +0x51, +0x41, +0xe2, +0x1d, +0xc2, +0x96, +0x95, +0xd1, +0x66, +0x16, +0x3b, +0x50, +0x36, +0x3f, +0x2e, +0xf2, +0xb2, +0x25, +0x2d, +0x59, +0x0f, +0x23, +0xf2, +0x9d, +0xb0, +0xee, +0x59, +0x89, +0xd0, +0x79, +0x30, +0xc7, +0x54, +0x9b, +0xec, +0xf8, +0xd7, +0xdc, +0x5a, +0x11, +0x1d, +0xfb, +0xf0, +0x82, +0x33, +0x3c, +0xff, +0x17, +0xff, +0xfc, +0x92, +0xc6, +0x6f, +0x3d, +0x5d, +0x99, +0x85, +0x2a, +0xa1, +0x04, +0xe8, +0x21, +0xed, +0x12, +0x2b, +0x7d, +0xbc, +0xa3, +0x36, +0x9b, +0x9f, +0xfd, +0x5d, +0x60, +0x66, +0xe9, +0x39, +0x5e, +0x34, +0x29, +0xa7, +0x08, +0x56, +0xf7, +0x4d, +0x19, +0x8d, +0x91, +0xff, +0xc8, +0x8a, +0xe7, +0xe8, +0x22, +0x00, +0x35, +0x68, +0x34, +0x93, +0xe7, +0x3b, +0x41, +0xbb, +0xf6, +0x58, +0x2f, +0x10, +0x66, +0x77, +0x69, +0xcd, +0x94, +0xb9, +0xbe, +0x59, +0x73, +0x4f, +0xc3, +0x11, +0xa1, +0xb3, +0x13, +0xe2, +0x82, +0xf1, +0x05, +0xcb, +0xa7, +0x75, +0xf6, +0x01, +0xb2, +0x24, +0xa9, +0x59, +0x05, +0x59, +0x46, +0xc9, +0x25, +0x39, +0x36, +0xee, +0x48, +0x90, +0x83, +0x89, +0xc4, +0xdb, +0xa3, +0x83, +0xd0, +0xd3, +0x62, +0x3f, +0x5e, +0x0e, +0x0c, +0xb7, +0x77, +0xb3, +0xd6, +0xbb, +0x37, +0x70, +0xb2, +0xb3, +0x87, +0x60, +0xd7, +0x8a, +0xe2, +0x99, +0xa9, +0x0f, +0x18, +0x16, +0xf6, +0xcd, +0x14, +0x4e, +0x2c, +0x7e, +0xfe, +0xf9, +0xa4, +0x48, +0xfb, +0xb9, +0x60, +0x13, +0x01, +0xd2, +0x6e, +0xdc, +0x3f, +0xe7, +0x2d, +0x7f, +0xe1, +0x11, +0x96, +0x12, +0x9a, +0x90, +0x48, +0x2b, +0x76, +0x78, +0xa6, +0xdd, +0x67, +0x48, +0x68, +0x42, +0xfd, +0x74, +0xb6, +0x51, +0xd7, +0x99, +0x07, +0x7d, +0x8b, +0x02, +0xd6, +0x68, +0x36, +0x97, +0x6d, +0x49, +0x28, +0xbf, +0xcc, +0x23, +0x8f, +0xed, +0x78, +0x4c, +0x49, +0xb0, +0xd1, +0x9a, +0x3d, +0x1c, +0xdd, +0xf0, +0xeb, +0xd5, +0xd4, +0xc2, +0x12, +0xae, +0x5d, +0x00, +0xe0, +0xf4, +0x84, +0x10, +0x08, +0x76, +0x28, +0x5a, +0x5e, +0xde, +0xe3, +0xad, +0x4e, +0x56, +0xcc, +0x22, +0x85, +0x5f, +0xa9, +0xca, +0xa5, +0x4e, +0xc6, +0x82, +0xf0, +0xbb, +0x5a, +0x82, +0xbf, +0x32, +0x54, +0xd2, +0x8a, +0x12, +0x05, +0x6f, +0xd8, +0xd1, +0xc0, +0x60, +0x00, +0x41, +0x03, +0xf4, +0xa8, +0xd6, +0xee, +0x9e, +0x5a, +0x75, +0xea, +0x76, +0x88, +0xf1, +0x2d, +0x8d, +0x63, +0xfc, +0x14, +0xe9, +0x7b, +0xeb, +0x0b, +0x49, +0xa4, +0x8b, +0x86, +0xf4, +0x97, +0x61, +0x22, +0x29, +0x32, +0x23, +0x80, +0x2e, +0x59, +0x44, +0xea, +0xf5, +0x56, +0x18, +0x51, +0xc0, +0x60, +0xe1, +0x83, +0x66, +0x1f, +0x1f, +0xa1, +0x13, +0x64, +0xae, +0xbc, +0x59, +0xd0, +0xc4, +0x38, +0x70, +0x3f, +0xb5, +0xb5, +0xa2, +0xdc, +0x89, +0x77, +0x70, +0x5a, +0x86, +0xb7, +0xde, +0x67, +0x3c, +0x22, +0x83, +0xc8, +0x62, +0x77, +0xb6, +0x5d, +0x7e, +0x41, +0x99, +0x70, +0x7d, +0xc3, +0x27, +0x90, +0x7f, +0x3c, +0xc6, +0x90, +0xc7, +0xb9, +0x32, +0xd8, +0x01, +0xdf, +0x02, +0x20, +0x27, +0x8f, +0x7b, +0x76, +0xb3, +0x0d, +0xfa, +0x93, +0x46, +0x6f, +0xde, +0x23, +0x12, +0xb9, +0x4e, +0xb8, +0x36, +0x8e, +0x9c, +0x3a, +0x2f, +0xd4, +0x2b, +0x54, +0xab, +0x63, +0xe6, +0xf1, +0x62, +0x8c, +0xd1, +0x1e, +0x87, +0x48, +0x2d, +0x83, +0x93, +0xfe, +0xac, +0x29, +0x82, +0xc2, +0x3c, +0x4f, +0xd0, +0x19, +0xe7, +0xa3, +0x99, +0x8d, +0x7d, +0x64, +0x15, +0xde, +0x64, +0xdb, +0xc1, +0x73, +0xe0, +0x78, +0x24, +0x23, +0x9e, +0x8a, +0xfb, +0xe2, +0xea, +0xd5, +0x0f, +0x93, +0x51, +0x62, +0x38, +0x41, +0x3e, +0x40, +0xa4, +0x2f, +0x7e, +0xb8, +0x11, +0x5c, +0xd3, +0x46, +0x0a, +0x74, +0xcb, +0xb7, +0xd0, +0x15, +0x96, +0xf1, +0xe7, +0x48, +0x32, +0x05, +0x69, +0xa8, +0xda, +0x56, +0xee, +0x9f, +0x6a, +0x95, +0xe6, +0x0d, +0xd2, +0x2c, +0xc1, +0xc2, +0xa5, +0xf4, +0xd8, +0xc6, +0xd7, +0xf6, +0x1f, +0x6f, +0x88, +0x78, +0xab, +0xd4, +0x1f, +0x53, +0xa0, +0xa1, +0x3b, +0x03, +0xb1, +0x4a, +0xcd, +0xbe, +0x25, +0x1c, +0x6f, +0xb4, +0x30, +0x41, +0xb5, +0x4a, +0xaa, +0xa5, +0x38, +0x91, +0x77, +0xce, +0x48, +0xc8, +0xe1, +0x34, +0xc2, +0x85, +0xdc, +0x9b, +0x24, +0x6f, +0x63, +0x12, +0xaa, +0x97, +0xaf, +0x9e, +0x37, +0x1e, +0xaf, +0x94, +0x2c, +0x5c, +0x43, +0xa6, +0x93, +0x17, +0x7d, +0x1c, +0x77, +0x18, +0x0f, +0xb5, +0xf2, +0x66, +0x4a, +0xaf, +0xd9, +0x92, +0xfb, +0x47, +0xfc, +0x1f, +0x7a, +0xdb, +0x77, +0x0b, +0x11, +0x61, +0xe0, +0x85, +0x12, +0x96, +0xf7, +0x55, +0x09, +0x90, +0xa2, +0x77, +0xdb, +0x9c, +0x9c, +0x8b, +0x04, +0x55, +0x45, +0x39, +0x64, +0x4e, +0x46, +0x5f, +0xa2, +0x98, +0xbc, +0xd6, +0x1b, +0x5d, +0x5f, +0x67, +0x21, +0xc7, +0x12, +0xe5, +0xe6, +0x13, +0x93, +0x7b, +0x83, +0xd8, +0x5b, +0xcc, +0x2e, +0x77, +0xce, +0x56, +0x97, +0xdc, +0x96, +0x70, +0xcc, +0x47, +0x1a, +0x79, +0x1f, +0xb0, +0x6a, +0xe4, +0x7c, +0xd6, +0xa7, +0x28, +0x72, +0x7a, +0x1e, +0xac, +0x54, +0xc0, +0x5d, +0x8c, +0xa1, +0x00, +0xf4, +0x2e, +0x86, +0x28, +0x3a, +0x82, +0xce, +0xbc, +0xf0, +0xfd, +0x2d, +0xb1, +0xc4, +0x9f, +0x6d, +0x6b, +0xba, +0x9e, +0x9b, +0xec, +0xb5, +0x38, +0xe2, +0xe9, +0xf8, +0x57, +0x74, +0xa6, +0x9b, +0x7b, +0xec, +0xe2, +0x90, +0x0d, +0xec, +0x3e, +0xf0, +0x1b, +0x2b, +0x38, +0x9c, +0x82, +0xd9, +0xd1, +0xbe, +0xe1, +0x08, +0x7f, +0x02, +0x54, +0xbc, +0x0b, +0x90, +0x14, +0x57, +0xa2, +0x4e, +0x56, +0xbe, +0x1b, +0xdf, +0x48, +0x9c, +0x17, +0xa1, +0x70, +0xa2, +0x8c, +0x74, +0x74, +0x24, +0xbf, +0xe0, +0x46, +0xb7, +0xdc, +0xa4, +0xb5, +0x66, +0x44, +0xb3, +0x53, +0x0e, +0xa4, +0xe5, +0xb4, +0x83, +0x06, +0x1f, +0x78, +0x2a, +0xe2, +0x16, +0x5c, +0x79, +0x00, +0xab, +0x0a, +0x08, +0x57, +0xe5, +0xbc, +0x2c, +0x9b, +0x91, +0x19, +0xf6, +0x1d, +0x31, +0x25, +0xbb, +0x9b, +0xb5, +0x89, +0x32, +0xb7, +0x53, +0xb9, +0x49, +0xa4, +0x55, +0xc5, +0x9d, +0x2b, +0xa1, +0xeb, +0xd5, +0xec, +0x02, +0x40, +0x14, +0x44, +0x35, +0xc1, +0x65, +0xd7, +0xae, +0x4c, +0xf8, +0x16, +0xf5, +0x70, +0x62, +0x28, +0xcd, +0x58, +0x71, +0x01, +0xcb, +0x85, +0x09, +0x24, +0x91, +0xf0, +0x18, +0xfa, +0xc6, +0x37, +0x07, +0xde, +0xe7, +0x43, +0xed, +0x3a, +0xeb, +0x98, +0x97, +0xf4, +0xc5, +0xf3, +0x60, +0xa5, +0x83, +0x60, +0x1a, +0xf1, +0x81, +0x03, +0x06, +0x2c, +0x1f, +0x38, +0x71, +0x61, +0x30, +0x21, +0x8a, +0x49, +0xb4, +0x2a, +0xa6, +0x03, +0x0e, +0x1d, +0x1d, +0x79, +0xc0, +0xe5, +0x5d, +0xd1, +0x82, +0x37, +0x1b, +0x70, +0x3a, +0xd2, +0x65, +0x48, +0x59, +0xc0, +0xa2, +0xf3, +0x8b, +0x82, +0x24, +0xf5, +0xfe, +0x2a, +0xdd, +0x8d, +0x3a, +0xe9, +0xe5, +0x1c, +0x92, +0xc7, +0x6a, +0x43, +0xde, +0x78, +0xb3, +0x33, +0xa0, +0x9a, +0x78, +0x4a, +0x54, +0xba, +0x01, +0x84, +0xd2, +0xb2, +0xa4, +0x6f, +0x28, +0x21, +0xf2, +0xc4, +0x21, +0x9f, +0x18, +0x72, +0x16, +0x46, +0x6d, +0xfa, +0xf2, +0xa7, +0x7c, +0x99, +0xa4, +0x2c, +0x93, +0x4d, +0xba, +0xdd, +0xa7, +0x59, +0x50, +0x0b, +0x34, +0x48, +0x63, +0x6f, +0x0d, +0x4b, +0x81, +0x22, +0x3b, +0x24, +0x9b, +0x37, +0x4b, +0xd3, +0x94, +0x23, +0xc0, +0x71, +0x39, +0x91, +0xd0, +0x06, +0x2e, +0xd2, +0xae, +0x7c, +0xfd, +0xfd, +0x4d, +0x4a, +0x95, +0x0a, +0xd0, +0x84, +0xbf, +0x8c, +0x5c, +0xe4, +0xc1, +0x10, +0xfa, +0xe6, +0x26, +0x18, +0xea, +0x75, +0x3e, +0x7d, +0x0b, +0xc5, +0x9d, +0xbb, +0x14, +0x3c, +0xa5, +0xe3, +0x19, +0x2b, +0xdd, +0xcd, +0xbb, +0xb4, +0x48, +0x9e, +0x8c, +0xa5, +0xf2, +0xcb, +0x19, +0xa9, +0x8f, +0x0c, +0x0b, +0x36, +0x73, +0xd7, +0x78, +0x2b, +0x64, +0xc9, +0x8c, +0x4a, +0xb2, +0x8f, +0xe9, +0xd9, +0x51, +0xb1, +0x84, +0x49, +0xd1, +0xec, +0x73, +0xa6, +0xb1, +0x41, +0x70, +0xa0, +0xd3, +0xea, +0xb4, +0xf8, +0x50, +0x57, +0xb6, +0x69, +0xda, +0x4a, +0xe6, +0xe0, +0x73, +0xba, +0xdc, +0x98, +0xc4, +0x0e, +0xab, +0xc7, +0xbd, +0x8a, +0xf6, +0xe3, +0xc1, +0x0b, +0xc3, +0x5b, +0x48, +0xa1, +0x79, +0xab, +0xae, +0x9b, +0x17, +0xbd, +0x56, +0x3b, +0x0c, +0x38, +0xbd, +0xed, +0x86, +0x95, +0x05, +0xf4, +0x32, +0xf9, +0xdc, +0x87, +0x4f, +0x78, +0x9a, +0xb0, +0x6f, +0x2b, +0x76, +0xd2, +0xf4, +0x1f, +0x65, +0xf8, +0xd0, +0x9f, +0x8d, +0x3c, +0xb2, +0x53, +0x8c, +0xca, +0xa0, +0x2b, +0x6d, +0xfb, +0x65, +0x96, +0xde, +0x7c, +0x64, +0xbb, +0xf7, +0x7e, +0x3d, +0x8d, +0xfb, +0xd1, +0x2d, +0xf1, +0xc3, +0x1a, +0x66, +0x8a, +0x8f, +0x5e, +0x89, +0x37, +0x19, +0xe7, +0x9b, +0xee, +0xf0, +0xc1, +0xe7, +0xac, +0xe5, +0x15, +0x2f, +0x6d, +0xfb, +0x57, +0xca, +0x78, +0xd0, +0xaa, +0x19, +0xc0, +0x80, +0x67, +0xc9, +0x2f, +0x81, +0x26, +0x7f, +0xbe, +0xdf, +0xde, +0x50, +0x00, +0x2b, +0x1b, +0x17, +0x2a, +0x5d, +0x54, +0xfa, +0x46, +0xc1, +0x3f, +0xb7, +0x2f, +0xc8, +0x31, +0xf4, +0x58, +0x43, +0x36, +0xae, +0x91, +0xc4, +0x46, +0xc4, +0x93, +0xaf, +0x05, +0x9e, +0xa3, +0xba, +0x0c, +0x07, +0x2f, +0x0c, +0xeb, +0x2f, +0x4d, +0x4a, +0x90, +0xd8, +0xc0, +0x51, +0x0f, +0xa5, +0x97, +0x09, +0x16, +0xfa, +0x24, +0xc3, +0x99, +0xe6, +0x1c, +0x9e, +0xed, +0x03, +0x76, +0x57, +0xce, +0x29, +0x73, +0x54, +0x19, +0x5a, +0x20, +0x65, +0x52, +0xa6, +0xfa, +0x97, +0x00, +0x52, +0x23, +0xbb, +0x74, +0x9b, +0x6e, +0xf3, +0x25, +0x94, +0x9c, +0x66, +0x0f, +0x8b, +0x67, +0x62, +0x1a, +0x13, +0xdb, +0xd5, +0xdb, +0xdb, +0xb9, +0x11, +0x02, +0x13, +0x63, +0xe4, +0x6e, +0x41, +0x8a, +0xa0, +0xc2, +0x52, +0x71, +0x66, +0xde, +0x3b, +0x3d, +0x6c, +0xd3, +0xaa, +0x5f, +0x78, +0x3b, +0xf2, +0x7b, +0xad, +0x71, +0x48, +0x2e, +0x06, +0x90, +0x4c, +0x76, +0x89, +0x99, +0xb5, +0x91, +0x61, +0x29, +0x74, +0x8d, +0x90, +0xd6, +0x1b, +0x60, +0x11, +0xf6, +0xc0, +0xa0, +0xc7, +0x3c, +0x1e, +0xf6, +0xec, +0x80, +0x91, +0xe8, +0x6d, +0x46, +0xe0, +0x2c, +0xda, +0x25, +0xdb, +0x18, +0xdb, +0xb1, +0xbe, +0x7c, +0x87, +0x14, +0xa9, +0xa3, +0x46, +0xdb, +0x6e, +0xeb, +0x5d, +0x98, +0xd2, +0x4c, +0xfa, +0x09, +0x13, +0x71, +0xee, +0x51, +0xae, +0x5d, +0x57, +0x79, +0x80, +0x02, +0x43, +0x7b, +0xf7, +0x92, +0x3c, +0xf9, +0x03, +0x07, +0x4f, +0x6a, +0x53, +0x9e, +0x35, +0x2d, +0x40, +0x29, +0x7d, +0x44, +0x39, +0xd2, +0xb4, +0x48, +0xa7, +0x4f, +0xa5, +0x90, +0x9d, +0xb7, +0x4e, +0xa0, +0xb5, +0xb7, +0x92, +0x0f, +0x1c, +0x18, +0xdd, +0x4c, +0xff, +0xd4, +0xf9, +0x53, +0xd1, +0x82, +0x38, +0xc5, +0xcc, +0xe2, +0x36, +0x2d, +0xf7, +0x18, +0x07, +0xda, +0x5b, +0xf6, +0xef, +0xe5, +0xcb, +0xaa, +0x90, +0xd2, +0x84, +0x25, +0xbc, +0x4f, +0x4a, +0x3b, +0x10, +0x0f, +0x81, +0x92, +0xe4, +0xda, +0x84, +0xad, +0x8b, +0xbb, +0x94, +0xc5, +0xf4, +0x4c, +0x25, +0xd2, +0x08, +0x97, +0xe0, +0x98, +0x0b, +0xbe, +0xe7, +0xaa, +0x40, +0x06, +0xfa, +0xe4, +0x79, +0xab, +0x76, +0x1f, +0xb6, +0x7f, +0x72, +0x48, +0x5c, +0x27, +0x8b, +0xab, +0xef, +0x13, +0xe1, +0x0c, +0xb1, +0x79, +0x7b, +0x6d, +0x8f, +0x0b, +0x90, +0x22, +0x7f, +0x2f, +0xa5, +0x71, +0xca, +0xb7, +0xc0, +0xbb, +0x31, +0x23, +0x03, +0x44, +0xd2, +0x51, +0x74, +0x08, +0x85, +0xad, +0x1e, +0xfb, +0xc3, +0xa2, +0xa1, +0xe1, +0x3e, +0x14, +0x0e, +0xf2, +0x0a, +0xb3, +0x9d, +0x74, +0x14, +0x50, +0xff, +0xfe, +0x95, +0xed, +0x02, +0x76, +0xe6, +0xf7, +0x0b, +0x32, +0x4e, +0x40, +0xb0, +0xd2, +0x67, +0x74, +0x92, +0x51, +0x1e, +0x54, +0x6f, +0x30, +0x6f, +0x58, +0x6a, +0xbb, +0x8a, +0x6c, +0xa6, +0x6d, +0x92, +0xe3, +0x3e, +0x0c, +0x33, +0x7c, +0xfc, +0x87, +0x12, +0xb8, +0x61, +0x70, +0xa6, +0x6c, +0x28, +0xad, +0xa2, +0x55, +0x81, +0x58, +0xd5, +0xc7, +0xb6, +0xd1, +0xdf, +0x47, +0x5d, +0x07, +0x1f, +0xed, +0xfd, +0x4e, +0x0f, +0x3c, +0xe3, +0x9d, +0xae, +0xeb, +0xf6, +0x3a, +0xb6, +0x0e, +0x5e, +0xc9, +0x9f, +0xc9, +0x5e, +0xbc, +0x37, +0xcf, +0x81, +0x04, +0x60, +0x26, +0xe4, +0x8b, +0x90, +0xdb, +0xf1, +0xc2, +0x66, +0x87, +0xd2, +0x29, +0x72, +0x01, +0xa6, +0xcd, +0x01, +0xdf, +0x9a, +0xfb, +0x4d, +0x62, +0xcb, +0x4d, +0x59, +0x18, +0xd2, +0x3f, +0x79, +0xf7, +0xaf, +0xda, +0x10, +0x66, +0xb6, +0x3e, +0x7e, +0x7b, +0xcb, +0xb6, +0xa0, +0xd7, +0xa8, +0x5b, +0xe7, +0x8e, +0xa0, +0x24, +0xf4, +0x55, +0x43, +0x00, +0xda, +0x86, +0x50, +0xec, +0x0a, +0x04, +0x27, +0xb1, +0x98, +0x40, +0x5c, +0xb1, +0xa5, +0x18, +0x87, +0xa9, +0x88, +0x87, +0x85, +0xe0, +0x89, +0xd5, +0xe2, +0x24, +0xef, +0x65, +0xac, +0x2c, +0xd1, +0x3a, +0xe7, +0x67, +0xee, +0xc4, +0xd6, +0x3a, +0x76, +0x2a, +0x55, +0x03, +0x5b, +0x0b, +0xde, +0x5e, +0x38, +0x5a, +0xb7, +0x7d, +0xb3, +0x82, +0x39, +0x5c, +0x98, +0xc3, +0x2f, +0x8d, +0x53, +0xa0, +0x41, +0x7d, +0xa8, +0x83, +0x47, +0x4a, +0xb0, +0x42, +0xc8, +0xeb, +0xf4, +0xfb, +0x9e, +0xe9, +0x82, +0xe3, +0xf6, +0x4d, +0x16, +0xe4, +0xd9, +0xd1, +0xca, +0x56, +0xae, +0x09, +0xe7, +0xcf, +0xaa, +0x25, +0x15, +0x91, +0xce, +0x15, +0xa9, +0x87, +0x50, +0x80, +0x38, +0xcd, +0x6a, +0x64, +0x4d, +0xb5, +0x55, +0x63, +0xc7, +0x9c, +0xb0, +0x52, +0xb0, +0x3d, +0x5a, +0x8b, +0x65, +0x19, +0x33, +0x43, +0xa2, +0x97, +0x20, +0xad, +0x79, +0xa6, +0xe8, +0x82, +0x06, +0x39, +0x45, +0x8b, +0x22, +0x35, +0x28, +0x72, +0x45, +0xc8, +0xca, +0xa4, +0xc3, +0x10, +0x20, +0x22, +0x83, +0x8f, +0x39, +0x49, +0x83, +0x72, +0x6d, +0xf4, +0x56, +0xfd, +0x55, +0x43, +0x60, +0x3d, +0x75, +0xa3, +0x4e, +0x14, +0x5b, +0xb8, +0xff, +0x4f, +0x17, +0xd9, +0x93, +0xd7, +0xc0, +0xaf, +0x5c, +0xb9, +0x65, +0xa5, +0x86, +0x8a, +0x9a, +0x35, +0x5d, +0x95, +0x30, +0x21, +0xc3, +0x38, +0x82, +0x05, +0x0b, +0xb8, +0x02, +0x20, +0xf1, +0x8a, +0x37, +0x15, +0x0a, +0xc2, +0x46, +0x8a, +0x16, +0x6f, +0x0d, +0x3a, +0x5b, +0x12, +0x6e, +0xee, +0xbf, +0xaf, +0xfb, +0x04, +0xe5, +0x34, +0xcc, +0x44, +0x2c, +0x3c, +0x22, +0x7c, +0x4f, +0xd7, +0xad, +0xe1, +0xe2, +0x12, +0xe6, +0xda, +0x69, +0x6f, +0x9c, +0xc8, +0x1f, +0xb9, +0x7e, +0x42, +0x20, +0x7d, +0x21, +0x0a, +0x0f, +0xb6, +0x16, +0x59, +0x01, +0x91, +0x16, +0xfe, +0xa4, +0x7b, +0xb6, +0x36, +0x43, +0x72, +0xbf, +0x33, +0x71, +0xb8, +0x5d, +0x8a, +0x4f, +0x91, +0xe0, +0x79, +0xb5, +0x40, +0xda, +0x9f, +0x02, +0xbe, +0x35, +0x60, +0xc0, +0xef, +0xc9, +0x2f, +0x42, +0xd3, +0xcd, +0xef, +0xde, +0x10, +0x71, +0x14, +0x8d, +0x86, +0x29, +0xcd, +0x31, +0x39, +0x90, +0xe0, +0x2d, +0x28, +0x97, +0xe4, +0xb3, +0xe5, +0xd7, +0x61, +0xe3, +0x2b, +0x21, +0xe7, +0xc5, +0x4b, +0xd6, +0xe9, +0xdb, +0x51, +0x03, +0xa2, +0x0e, +0x7c, +0x7e, +0x95, +0xa8, +0xf6, +0x8b, +0x95, +0x8f, +0x6e, +0xfd, +0x54, +0xfd, +0x28, +0x71, +0x4a, +0xfc, +0x75, +0x54, +0x19, +0x8c, +0xd3, +0x8a, +0x9b, +0x94, +0xcd, +0x33, +0x60, +0x80, +0x7a, +0xd4, +0x68, +0x38, +0x29, +0x0e, +0xf0, +0xc1, +0xeb, +0xac, +0xaf, +0xb1, +0xe6, +0xce, +0xbd, +0xd1, +0xfd, +0xbc, +0x23, +0x85, +0x8d, +0x97, +0xf4, +0xc9, +0xf9, +0xbd, +0x69, +0xd2, +0x0c, +0x60, +0x12, +0x05, +0x82, +0x6e, +0x5a, +0x6e, +0xfd, +0x55, +0xcc, +0xd8, +0xe6, +0xed, +0x54, +0xde, +0xdb, +0xcc, +0xf9, +0x85, +0x0b, +0xf6, +0x42, +0x39, +0x76, +0xde, +0xab, +0x08, +0xd7, +0x65, +0xe8, +0x19, +0xbd, +0x72, +0xec, +0x53, +0x7d, +0xc8, +0xa6, +0x00, +0xb3, +0x3e, +0x5b, +0x7d, +0xa0, +0x7b, +0xaa, +0x6e, +0xc5, +0x45, +0x12, +0xe3, +0xac, +0x02, +0x1c, +0x01, +0xb8, +0x2b, +0x2b, +0xd6, +0xf8, +0x2e, +0x96, +0x3a, +0x5e, +0x6e, +0xda, +0xf9, +0x6c, +0xac, +0x36, +0xf8, +0xcd, +0xef, +0x05, +0x8d, +0x8f, +0xe7, +0x6c, +0x39, +0x24, +0xb3, +0x8d, +0xed, +0xd1, +0x70, +0xa6, +0x20, +0x1e, +0x2b, +0x1d, +0x2c, +0x40, +0x16, +0xd6, +0x23, +0xb0, +0x99, +0xaa, +0x74, +0x31, +0xbe, +0xdc, +0x28, +0xd4, +0x64, +0xfa, +0xd2, +0x8d, +0xdb, +0xa1, +0x32, +0xaf, +0xdc, +0xb1, +0x71, +0xb3, +0x4d, +0x0a, +0x3a, +0x3a, +0x53, +0x11, +0x8c, +0x11, +0x8c, +0xe7, +0xd5, +0xdb, +0xdd, +0x67, +0xb8, +0x1a, +0x39, +0x0e, +0xf6, +0x69, +0xd8, +0x1b, +0xcb, +0xe5, +0xc5, +0xa6, +0x3d, +0x3b, +0xfe, +0xe1, +0x05, +0x48, +0x83, +0x67, +0x7f, +0xf1, +0x9c, +0x70, +0x7e, +0x70, +0x5c, +0xc4, +0xd3, +0x78, +0x8b, +0x80, +0x87, +0xf5, +0x94, +0x2d, +0x0a, +0xbf, +0x82, +0x13, +0xad, +0x36, +0x10, +0x0a, +0x60, +0xaa, +0xc4, +0xa3, +0xcd, +0xf1, +0xa9, +0xa1, +0x49, +0xf5, +0x41, +0x14, +0xd6, +0xd1, +0xa7, +0xe0, +0x50, +0xce, +0xe2, +0x76, +0xbe, +0x09, +0xc4, +0x3a, +0x68, +0xc5, +0x8a, +0x1f, +0x8e, +0xd0, +0x4d, +0x90, +0x92, +0xc8, +0x3b, +0x63, +0xae, +0xc2, +0xfe, +0x77, +0x8c, +0x4b, +0xa6, +0x6c, +0x04, +0xff, +0x62, +0xe1, +0x32, +0x04, +0xb8, +0xfd, +0xb3, +0x34, +0x47, +0x85, +0x32, +0x6b, +0x50, +0xce, +0xcf, +0x4f, +0x0f, +0x72, +0x41, +0x09, +0x7f, +0xde, +0x5c, +0xe7, +0x08, +0xdf, +0x63, +0x09, +0x89, +0xd1, +0x23, +0xb6, +0xe3, +0xbc, +0xff, +0xe4, +0x88, +0x61, +0x67, +0x8e, +0x4a, +0xb6, +0x86, +0x08, +0x33, +0xad, +0xac, +0x9f, +0xf3, +0x37, +0xbd, +0xcc, +0xd6, +0x0e, +0x3e, +0x4e, +0x4f, +0xc9, +0xff, +0xc8, +0xf6, +0xd8, +0x2a, +0x43, +0x3d, +0x79, +0xf2, +0x5d, +0x87, +0x33, +0x1d, +0xf4, +0xfd, +0x80, +0x2c, +0x4f, +0xc4, +0xa5, +0x3a, +0x2f, +0x51, +0xb1, +0x19, +0xf8, +0xed, +0xe0, +0xc9, +0x6c, +0x82, +0x2d, +0x43, +0xdd, +0x71, +0x27, +0x32, +0x8b, +0x51, +0x3d, +0xbc, +0x83, +0x6b, +0xa8, +0xda, +0x2b, +0xbb, +0xb0, +0xba, +0x5b, +0x30, +0x4f, +0x44, +0xad, +0x99, +0xb7, +0x47, +0x35, +0x6f, +0x1f, +0xbe, +0x5f, +0x24, +0x4e, +0xba, +0x92, +0x89, +0xc8, +0xb6, +0x45, +0x12, +0x19, +0xee, +0xe7, +0xd8, +0x74, +0xb3, +0x33, +0x41, +0x39, +0x26, +0x4c, +0xc3, +0xb0, +0x22, +0x1e, +0xee, +0xd0, +0xfb, +0xc6, +0xa3, +0x7d, +0xaa, +0x7d, +0xa1, +0x51, +0x98, +0xe8, +0xcc, +0x58, +0x39, +0x22, +0x1e, +0xe7, +0xf0, +0xb4, +0xd3, +0x7c, +0xa4, +0xa6, +0x10, +0xba, +0x2f, +0x41, +0xd6, +0x17, +0x95, +0x76, +0xe1, +0xbb, +0xec, +0x43, +0x99, +0x87, +0xd4, +0x13, +0x9b, +0x85, +0x4f, +0x44, +0x32, +0x5a, +0xe0, +0x9a, +0xee, +0x29, +0x15, +0x45, +0x05, +0xf7, +0xe4, +0xc9, +0x4d, +0x6b, +0x45, +0xad, +0x1f, +0x13, +0x06, +0x29, +0xb4, +0x2b, +0x74, +0x83, +0xe1, +0xdb, +0x3d, +0x99, +0x28, +0xbd, +0x4f, +0xfb, +0x0d, +0x03, +0x4d, +0x79, +0x09, +0x7f, +0x12, +0x91, +0xe9, +0x69, +0x40, +0x84, +0xc7, +0x10, +0xd5, +0xce, +0xae, +0xbb, +0xa5, +0xb2, +0x35, +0xdb, +0x24, +0xa4, +0x0e, +0xe4, +0x6f, +0x80, +0xb4, +0xb6, +0x94, +0xf7, +0x51, +0x5b, +0x0c, +0x5b, +0xae, +0x3f, +0xa5, +0x17, +0xe0, +0x9c, +0xd1, +0x05, +0x31, +0x05, +0xc4, +0x14, +0xdd, +0xde, +0x6f, +0x39, +0xa1, +0x9a, +0x46, +0x3d, +0x68, +0x3c, +0xfe, +0x04, +0x8e, +0xc2, +0x11, +0x9d, +0xc2, +0x3a, +0xaa, +0xcf, +0x22, +0x26, +0x54, +0xcb, +0x8d, +0x47, +0x61, +0x9e, +0xf4, +0x2e, +0xe7, +0x3c, +0xe6, +0xf0, +0xd6, +0x1a, +0xe5, +0x18, +0xbd, +0x9f, +0xa4, +0x3e, +0x47, +0xdb, +0x85, +0xe0, +0x8c, +0xbf, +0xdd, +0x19, +0x91, +0x81, +0x80, +0x63, +0x44, +0x0a, +0x96, +0xae, +0xde, +0x1f, +0xbc, +0xdb, +0x15, +0x89, +0x71, +0x60, +0x23, +0xc4, +0x0a, +0x96, +0xae, +0xbf, +0xfc, +0x7a, +0x76, +0x4f, +0x1c, +0x9b, +0xb4, +0xcb, +0x14, +0x8b, +0x94, +0x8b, +0x94, +0xaa, +0xd6, +0x0f, +0x7d, +0x78, +0x72, +0x47, +0x0c, +0x9a, +0x97, +0xac, +0xbb, +0xf4, +0x6a, +0x56, +0x0f, +0x7d, +0x59, +0x30, +0xc3, +0x04, +0x6b, +0x54, +0x0b, +0x75, +0x49, +0x10, +0xa2, +0xa7, +0xad, +0xd8, +0x13, +0x85, +0x88, +0x73, +0x45, +0xe9, +0x31, +0xc1, +0x00, +0x82, +0x67, +0x4c, +0xfb, +0x74, +0x6a, +0x56, +0x2e, +0xbf, +0xdd, +0x19, +0x91, +0x81, +0x80, +0x82, +0x86, +0x6f, +0x5c, +0x3a, +0xf6, +0x4f, +0x1c, +0xba, +0xf6, +0x4f, +0xfd, +0x59, +0x11, +0x81, +0x61, +0x21, +0xa1, +0xc0, +0x02, +0x86, +0x6f, +0x3d, +0xf8, +0x53, +0x24, +0xca, +0xf7, +0x6c, +0x5a, +0x36, +0xcf, +0xfd, +0x59, +0x11, +0xa0, +0xa3, +0xc4, +0x0a, +0x96, +0x8f, +0x9c, +0xba, +0xd7, +0x0d, +0x98, +0xb2, +0xc7, +0xed, +0x58, +0x32, +0xc7, +0xed, +0x39, +0xf0, +0x43, +0x04, +0x6b, +0x54, +0x2a, +0xb7, +0xec, +0x5a, +0x36, +0xee, +0x3f, +0xfc, +0x7a, +0x76, +0x6e, +0x5e, +0x1f, +0x9d, +0x99, +0x91, +0x81, +0x80, +0x82, +0x86, +0x6f, +0x5c, +0x1b, +0x95, +0x89, +0x90, +0xa2, +0xa7, +0xcc, +0x1a, +0x97, +0xac, +0xbb, +0xf4, +0x6a, +0x37, +0xec, +0x3b, +0xf4, +0x6a, +0x37, +0xec, +0x3b, +0xf4, +0x4b, +0xf5, +0x49, +0xf1, +0x60, +0x23, +0xa5, +0xa9, +0xb1, +0xc1, +0xe1, +0x21, +0xa1, +0xa1, +0xc0, +0xe3, +0x25, +0xa9, +0xb1, +0xe0, +0x42, +0xe7, +0x4c, +0xfb, +0x74, +0x6a, +0x37, +0xec, +0x5a, +0x17, +0xac, +0xbb, +0xd5, +0x28, +0xd2, +0x07, +0x6d, +0x58, +0x13, +0x85, +0x69, +0x31, +0xe0, +0x42, +0xe7, +0x4c, +0xfb, +0x55, +0x28, +0xd2, +0x07, +0x8c, +0x7b, +0x74, +0x4b, +0x14, +0xaa, +0xd6, +0x2e, +0xde, +0x3e, +0xfe, +0x7e, +0x5f, +0x1d, +0xb8, +0xf2, +0x47, +0x0c, +0x7b, +0x55, +0x09, +0x90, +0x83, +0x65, +0x48, +0x12, +0x87, +0x6d, +0x39, +0xf0, +0x62, +0x46, +0x0e, +0x9e, +0x9f, +0xbc, +0xfa, +0x57, +0x2c, +0xbb, +0xd5, +0x09, +0x71, +0x60, +0x5b, +0x08, +0xf7, +0x2b +}; diff --git a/tester.c b/tester.c new file mode 100644 index 0000000..faba9ba --- /dev/null +++ b/tester.c @@ -0,0 +1,62 @@ +#include + +#include +#include +#include +#include +#include + +#include "mouse.h" + +int main ( int argc, char *argv[], char *env[] ) +{ + if ( argc != 2 ) + return -1; + + int keys[] = {KEY_Z, KEY_X, KEY_L, KEY_ESC}; + bool states[] = {0, 0, 0, 0}; + FILE *kbd = fopen(argv[1], "r"); + + char key_map[KEY_MAX/8 + 1]; // Create a byte array the size of the number of keys + + bool running = true; + int32_t time_ticks = 0; + while (running) { + memset(key_map, 0, sizeof(key_map)); // Initate the array to zero's + ioctl(fileno(kbd), EVIOCGKEY(sizeof(key_map)), key_map); // Fill the keymap with the current keyboard state + + int i; + for (i = 0; i < 4; ++i) { + const int keyb = key_map[keys[i]/8]; + const int mask = 1 << (keys[i] % 8); + states[i] = !!(keyb & mask); + } + const bool kleft = states[0], + kright = states[1], + ktrack = states[2], + kquit = states[3]; + if (kquit) + running = false; + static int16_t in_x = 0, in_y = 0; + ++in_x, --in_y; + bool out_left, out_right; + int16_t out_x, out_y; + bool use_out = mouse_step(time_ticks, kleft, kright, ktrack, + &out_left, &out_right, &out_x, &out_y); + if (!use_out) { + out_x = in_x; + out_y = in_y; + } + int16_t cpi; + bool as; + int8_t lod; + mouse_get_params(&cpi, &as, &lod); + fprintf(stderr, "\rIN l=%i, r=%i, track=%i OUT l=%i, r=%i, x=%6.5ji, y=%6.5ji, cpi=%i, mode=%i%i", + kleft, kright, ktrack, + out_left, out_right, (intmax_t)out_x, (intmax_t)out_y, (int)cpi, (int)as, (int)lod); + + time_ticks += 8; + + usleep(1000); + } +} diff --git a/tester_buttons.c b/tester_buttons.c new file mode 100644 index 0000000..d9d14eb --- /dev/null +++ b/tester_buttons.c @@ -0,0 +1,56 @@ +#include + +#include +#include +#include +#include +#include + +#include "buttons.h" + +int main ( int argc, char *argv[], char *env[] ) +{ + if ( argc != 2 ) + return -1; + + int keys[] = {KEY_A, KEY_Z, KEY_S, KEY_X, KEY_ESC}; + bool states[] = {0, 0, 0, 0, 0}; + FILE *kbd = fopen(argv[1], "r"); + + char key_map[KEY_MAX/8 + 1]; // Create a byte array the size of the number of keys + + bool running = true; + int32_t time_ticks = 0; + + BUTTONS_set_debounce_delay(4*1000); + while (running) { + memset(key_map, 0, sizeof(key_map)); // Initate the array to zero's + ioctl(fileno(kbd), EVIOCGKEY(sizeof(key_map)), key_map); // Fill the keymap with the current keyboard state + + int i; + for (i = 0; i < 5; ++i) { + const int keyb = key_map[keys[i]/8]; + const int mask = 1 << (keys[i] % 8); + states[i] = !!(keyb & mask); + } + const bool kleftT = states[0], + kleftB = states[1], + krightT = states[2], + krightB = states[3], + kquit = states[4]; + if (kquit) + running = false; + struct input inputs[2] = { + {.T = kleftT, .B = kleftB}, + {.T = krightT, .B = krightB} + }; + time_ticks += 8; + BUTTONS_task(8, inputs); + fprintf(stderr, "\rIN lT=%i,lB=%i, rT=%i,rB=%i OUT l=%i, r=%i", + kleftT, kleftB, krightT, krightB, + BUTTONS_get(0), BUTTONS_get(1)); + + + usleep(1000); + } +} diff --git a/usb_mouse.c b/usb_mouse.c new file mode 100644 index 0000000..166718d --- /dev/null +++ b/usb_mouse.c @@ -0,0 +1,561 @@ +/* USB Mouse Plus Debug Channel Example for Teensy USB Development Board + * http://www.pjrc.com/teensy/usb_mouse.html + * Copyright (c) 2009 PJRC.COM, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Version 1.0: Initial Release +// Version 1.1: Add support for Teensy 2.0 + +// modified by Furiosus to support 16 bit motion data +// modified by qsxcv for use with the "g102" + +#define USB_SERIAL_PRIVATE_INCLUDE +#include "usb_mouse.h" + +/************************************************************************** + * + * Configurable Options + * + **************************************************************************/ + +// You can change these to give your code its own name. +#define STR_MANUFACTURER L"Zaunkoenig" +#define STR_PRODUCT L"M1K" + + +// Mac OS-X and Linux automatically load the correct drivers. On +// Windows, even though the driver is supplied by Microsoft, an +// INF file is needed to load the driver. These numbers need to +// match the INF file. +#define VENDOR_ID 0x04D8 +#define PRODUCT_ID 0xEEFC + + +// USB devices are supposed to implment a halt feature, which is +// rarely (if ever) used. If you comment this line out, the halt +// code will be removed, saving 102 bytes of space (gcc 4.3.0). +// This is not strictly USB compliant, but works with all major +// operating systems. +#define SUPPORT_ENDPOINT_HALT + + + +/************************************************************************** + * + * Endpoint Buffer Configuration + * + **************************************************************************/ + +#define ENDPOINT0_SIZE 32 + +#define MOUSE_INTERFACE 0 +//#define MOUSE_ENDPOINT 3 // moved to usb_mouse.h for use in main +#define MOUSE_SIZE 8 +#define MOUSE_BUFFER EP_SINGLE_BUFFER + +static const uint8_t PROGMEM endpoint_config_table[] = { + 0, + 0, + 1, EP_TYPE_INTERRUPT_IN, EP_SIZE(MOUSE_SIZE) | MOUSE_BUFFER, + 0 +}; + + +/************************************************************************** + * + * Descriptor Data + * + **************************************************************************/ + +// Descriptors are the data that your computer reads when it auto-detects +// this USB device (called "enumeration" in USB lingo). The most commonly +// changed items are editable at the top of this file. Changing things +// in here should only be done by those who've read chapter 9 of the USB +// spec and relevant portions of any USB class specifications! + + +static const uint8_t PROGMEM device_descriptor[] = { + 18, // bLength + 1, // bDescriptorType + 0x00, 0x02, // bcdUSB + 0, // bDeviceClass + 0, // bDeviceSubClass + 0, // bDeviceProtocol + ENDPOINT0_SIZE, // bMaxPacketSize0 + LSB(VENDOR_ID), MSB(VENDOR_ID), // idVendor + LSB(PRODUCT_ID), MSB(PRODUCT_ID), // idProduct + 0x00, 0x01, // bcdDevice + 1, // iManufacturer + 2, // iProduct + 0, // iSerialNumber + 1 // bNumConfigurations +}; + +// Mouse Protocol 1, HID 1.11 spec, Appendix B, page 59-60, with wheel extension +/* +static uint8_t PROGMEM mouse_hid_report_desc[] = { + 0x05, 0x01, // Usage Page (Generic Desktop) + 0x09, 0x02, // Usage (Mouse) + 0xA1, 0x01, // Collection (Application) + 0x05, 0x09, // Usage Page (Button) + 0x19, 0x01, // Usage Minimum (Button #1) + 0x29, 0x03, // Usage Maximum (Button #3) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x95, 0x03, // Report Count (3) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data, Variable, Absolute) + 0x95, 0x01, // Report Count (1) + 0x75, 0x05, // Report Size (5) + 0x81, 0x03, // Input (Constant) + 0x05, 0x01, // Usage Page (Generic Desktop) + 0x09, 0x30, // Usage (X) + 0x09, 0x31, // Usage (Y) + 0x15, 0x80, // Logical Minimum (-128) + 0x25, 0x7F, // Logical Maximum (127) + 0x75, 0x08, // Report Size (8), + 0x95, 0x02, // Report Count (2), + 0x81, 0x06, // Input (Data, Variable, Relative) + 0x09, 0x38, // Usage (Wheel) + 0x95, 0x01, // Report Count (1), + 0x81, 0x06, // Input (Data, Variable, Relative) + 0xC0 // End Collection +}; +*/ +static const uint8_t PROGMEM mouse_hid_report_desc[] = { + 0x05, 0x01, // Usage Page (Generic Desktop) + 0x09, 0x02, // Usage (Mouse) + 0xA1, 0x01, // Collection (Application) + 0x05, 0x09, // Usage Page (Button) + 0x19, 0x01, // Usage Minimum (Button #1) + 0x29, 0x03, // Usage Maximum (Button #3) + 0x15, 0x00, // Logical Minimum (0) + 0x25, 0x01, // Logical Maximum (1) + 0x95, 0x03, // Report Count (3) + 0x75, 0x01, // Report Size (1) + 0x81, 0x02, // Input (Data, Variable, Absolute) + 0x95, 0x01, // Report Count (1) + 0x75, 0x05, // Report Size (5) + 0x81, 0x03, // Input (Constant) // Byte 1 + 0x05, 0x01, // Usage Page (Generic Desktop) + 0x09, 0x30, // Usage (X) + 0x09, 0x31, // Usage (Y) + 0x16, 0x01, 0x80, // Logical Minimum (-32,767) + 0x26, 0xFF, 0x7F, // Logical Maximum (32,767) + 0x36, 0x01, 0x80, // Physical Minimum (-32,767) + 0x46, 0xFF, 0x7F, // Physical Maxiumum (32,767) + 0x75, 0x10, // Report Size (16), + 0x95, 0x02, // Report Count (2), + 0x81, 0x06, // Input (Data, Variable, Relative) // Byte 3, 5 + 0x09, 0x38, // Usage (Wheel) + 0x15, 0x81, // Logical Minimum (-127) + 0x25, 0x7F, // Logical Maximum (127) + 0x35, 0x81, // Phyiscal Minimum (-127) + 0x45, 0x7F, // Physical Maxiumum (127) + 0x75, 0x08, // Report Size (8) + 0x95, 0x01, // Report Count (1) + 0x81, 0x06, // Input (Data, Variable, Relative) // Byte 6 + 0xC0 // End Collection +}; + +#define CONFIG1_DESC_SIZE (9+9+9+7) +#define MOUSE_HID_DESC_OFFSET (9+9) +static const uint8_t PROGMEM config1_descriptor[CONFIG1_DESC_SIZE] = { + // configuration descriptor, USB spec 9.6.3, page 264-266, Table 9-10 + 9, // bLength; + 2, // bDescriptorType; + LSB(CONFIG1_DESC_SIZE), // wTotalLength + MSB(CONFIG1_DESC_SIZE), + 1, // bNumInterfaces + 1, // bConfigurationValue + 0, // iConfiguration + 0xC0, // bmAttributes + 50, // bMaxPower + // interface descriptor, USB spec 9.6.5, page 267-269, Table 9-12 + 9, // bLength + 4, // bDescriptorType + MOUSE_INTERFACE, // bInterfaceNumber + 0, // bAlternateSetting + 1, // bNumEndpoints + 0x03, // bInterfaceClass (0x03 = HID) + 0x01, // bInterfaceSubClass (0x01 = Boot) + 0x02, // bInterfaceProtocol (0x02 = Mouse) + 0, // iInterface + // HID interface descriptor, HID 1.11 spec, section 6.2.1 + 9, // bLength + 0x21, // bDescriptorType + 0x11, 0x01, // bcdHID + 0, // bCountryCode + 1, // bNumDescriptors + 0x22, // bDescriptorType + sizeof(mouse_hid_report_desc), // wDescriptorLength + 0, + // endpoint descriptor, USB spec 9.6.6, page 269-271, Table 9-13 + 7, // bLength + 5, // bDescriptorType + MOUSE_ENDPOINT | 0x80, // bEndpointAddress + 0x03, // bmAttributes (0x03=intr) + 6, 0, // wMaxPacketSize + 1 // bInterval +}; + +// If you're desperate for a little extra code memory, these strings +// can be completely removed if iManufacturer, iProduct, iSerialNumber +// in the device desciptor are changed to zeros. +struct usb_string_descriptor_struct { + uint8_t bLength; + uint8_t bDescriptorType; + int16_t wString[]; +}; +static const struct usb_string_descriptor_struct PROGMEM string0 = { + 4, + 3, + {0x0409} +}; +static const struct usb_string_descriptor_struct PROGMEM string1 = { + sizeof(STR_MANUFACTURER), + 3, + STR_MANUFACTURER +}; +static const struct usb_string_descriptor_struct PROGMEM string2 = { + sizeof(STR_PRODUCT), + 3, + STR_PRODUCT +}; + +// This table defines which descriptor data is sent for each specific +// request from the host (in wValue and wIndex). +static const struct descriptor_list_struct { + uint16_t wValue; + uint16_t wIndex; + const uint8_t *addr; + uint8_t length; +} PROGMEM descriptor_list[] = { + {0x0100, 0x0000, device_descriptor, sizeof(device_descriptor)}, + {0x0200, 0x0000, config1_descriptor, sizeof(config1_descriptor)}, + {0x2200, MOUSE_INTERFACE, mouse_hid_report_desc, sizeof(mouse_hid_report_desc)}, + {0x2100, MOUSE_INTERFACE, config1_descriptor+MOUSE_HID_DESC_OFFSET, 9}, + {0x0300, 0x0000, (const uint8_t *)&string0, 4}, + {0x0301, 0x0409, (const uint8_t *)&string1, sizeof(STR_MANUFACTURER)}, + {0x0302, 0x0409, (const uint8_t *)&string2, sizeof(STR_PRODUCT)} +}; +#define NUM_DESC_LIST (sizeof(descriptor_list)/sizeof(struct descriptor_list_struct)) + + +/************************************************************************** + * + * Variables - these are the only non-stack RAM usage + * + **************************************************************************/ + +// zero when we are not configured, non-zero when enumerated +static volatile uint8_t usb_configuration=0; + +// protocol setting from the host. We use exactly the same report +// either way, so this variable only stores the setting since we +// are required to be able to report which setting is in use. +static uint8_t mouse_protocol=1; + + +/************************************************************************** + * + * Public Functions - these are the API intended for the user + * + **************************************************************************/ + + +// initialize USB +void usb_init(void) +{ + HW_CONFIG(); + USB_FREEZE(); // enable USB + PLL_CONFIG(); // config PLL + while (!(PLLCSR & (1<= NUM_DESC_LIST) { + UECONX = (1< desc_length) len = desc_length; + do { + // wait for host ready for IN packet + do { + i = UEINTX; + } while (!(i & ((1<= 1 && i <= MAX_ENDPOINT) { + usb_send_in(); + UENUM = i; + if (bRequest == SET_FEATURE) { + UECONX = (1< + +void usb_init(void); // initialize everything +uint8_t usb_configured(void); // is the USB port configured +/* +void usb_mouse_update(const uint8_t button_mask, + const uint8_t x_lo, const uint8_t x_hi, + const uint8_t y_lo, const uint8_t y_hi, + const int8_t wheel); +*/ +#define MOUSE_ENDPOINT 3 +// This file does not include the HID debug functions, so these empty +// macros replace them with nothing, so users can compile code that +// has calls to these functions. +#define usb_debug_putchar(c) +#define usb_debug_flush_output() + + + + +// Everything below this point is only intended for usb_serial.c +#ifdef USB_SERIAL_PRIVATE_INCLUDE +#include +#include +#include + +#define EP_TYPE_CONTROL 0x00 +#define EP_TYPE_BULK_IN 0x81 +#define EP_TYPE_BULK_OUT 0x80 +#define EP_TYPE_INTERRUPT_IN 0xC1 +#define EP_TYPE_INTERRUPT_OUT 0xC0 +#define EP_TYPE_ISOCHRONOUS_IN 0x41 +#define EP_TYPE_ISOCHRONOUS_OUT 0x40 + +#define EP_SINGLE_BUFFER 0x02 +#define EP_DOUBLE_BUFFER 0x06 + +#define EP_SIZE(s) ((s) == 64 ? 0x30 : \ + ((s) == 32 ? 0x20 : \ + ((s) == 16 ? 0x10 : \ + 0x00))) + +#define MAX_ENDPOINT 4 + +#define LSB(n) (n & 255) +#define MSB(n) ((n >> 8) & 255) + +#if defined(__AVR_ATmega32U2__) +#define HW_CONFIG() +#define PLL_CONFIG() (PLLCSR = 0x06) +#define USB_CONFIG() (USBCON = (1<