merge from master

This commit is contained in:
Christian Kroll 2014-03-25 23:26:34 +01:00
commit 45457e2c31
253 changed files with 3290 additions and 2860 deletions

64
.gitignore vendored
View File

@ -7,27 +7,12 @@
.settings
.simulated_eeprom.bin
.subdirs
animations/bitmapscroller/obj_avr
animations/bitmapscroller/obj_sim
animations/obj_avr
animations/obj_sim
autoconf.h
borg_hw/obj_avr
borgsim
borgsim.exe
can/obj_avr
can/obj_sim
config.mk
games/breakout/obj_avr
games/breakout/obj_sim
games/snake/obj_avr
games/snake/obj_sim
games/space_invaders/obj_avr
games/space_invaders/obj_sim
games/tetris/obj_avr
games/tetris/obj_sim
doc/html
doc/latex
gmon.out
html
image
image.bin
image.elf
@ -38,23 +23,38 @@ image.srec
image_eeprom.bin
image_eeprom.hex
image_eeprom.srec
joystick/obj_avr
joystick/obj_sim
latex
menu/obj_avr
menu/obj_sim
obj_avr
obj_sim
random/obj_avr
random/obj_sim
rfm12/obj_avr
rfm12/obj_sim
scripts/lxdialog/*.o
scripts/lxdialog/a.exe
scripts/lxdialog/lxdialog
scripts/lxdialog/lxdialog.exe
scripts/lxdialog/*.o
scrolltext/obj_avr
scrolltext/obj_sim
simulator/obj_sim
smallani/obj_avr
smallani/obj_sim
src/animations/bitmapscroller/obj_avr
src/animations/bitmapscroller/obj_sim
src/animations/obj_avr
src/animations/obj_sim
src/autoconf.h
src/borg_hw/obj_avr
src/can/obj_avr
src/can/obj_sim
src/games/breakout/obj_avr
src/games/breakout/obj_sim
src/games/snake/obj_avr
src/games/snake/obj_sim
src/games/space_invaders/obj_avr
src/games/space_invaders/obj_sim
src/games/tetris/obj_avr
src/games/tetris/obj_sim
src/joystick/obj_avr
src/joystick/obj_sim
src/menu/obj_avr
src/menu/obj_sim
src/random/obj_avr
src/random/obj_sim
src/rfm12/obj_avr
src/rfm12/obj_sim
src/scrolltext/obj_avr
src/scrolltext/obj_sim
src/simulator/obj_sim
src/smallani/obj_avr
src/smallani/obj_sim

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/rfm12/rfm12_lib"]
path = src/rfm12/rfm12_lib
url = https://github.com/das-labor/librfm12.git

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
language: c
# install dependencies
before_install:
- uname -a
- lsb_release -a
install:
- sudo apt-get install -qq libncurses5-dev gcc-avr avr-libc
# run tests
script:
- make test

View File

@ -1,27 +0,0 @@
**** Ubuntu Linux *****
To Compile for the AVR you'll need the packages gcc-avr and avr-libc. You'll
also need gcc and libncurses to be able to use menuconfig. To use the simulator
you'll also need libglut.
Type
$ make menuconfig
and set your settings or load one of the default profiles. Then type
$ make
to compile for the avr. You can upload the image to a borg-16's serial
bootloader (foodloader) by typing
$ make sflash
.
****Windows XP****
Under Windows you'll need to install the following things:
-WinAVR
-Cygwin with the following packages:
--gcc
--libncurses-devel
--make (the one that WinAVR delivers doesn't work right)
--opengl (for the simulator)
now go to the cygwin bash shell and use the same commands as with Linux to
compile and flash.

View File

@ -52,7 +52,7 @@ PROJECT_LOGO =
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY =
OUTPUT_DIRECTORY = doc
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@ -647,7 +647,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT =
INPUT = src
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

106
Makefile
View File

@ -1,17 +1,18 @@
TARGET := image
TARGET_SIM := borgsim
TOPDIR = .
TOPDIR = src
MAKETOPDIR = .
SRC = \
main.c \
display_loop.c \
eeprom_reserve.c \
pixel.c \
util.c \
$(TOPDIR)/main.c \
$(TOPDIR)/display_loop.c \
$(TOPDIR)/eeprom_reserve.c \
$(TOPDIR)/pixel.c \
$(TOPDIR)/util.c \
SRC_SIM = \
display_loop.c \
pixel.c \
$(TOPDIR)/display_loop.c \
$(TOPDIR)/pixel.c \
LAUNCH_BOOTLOADER = launch-bootloader
@ -24,26 +25,26 @@ all: compile-$(TARGET)
@echo "==============================="
@echo "$(TARGET) compiled for: $(MCU)"
@echo "size is: "
@$(CONFIG_SHELL) ${TOPDIR}/scripts/size $(TARGET)
@$(CONFIG_SHELL) scripts/size $(TARGET)
@echo "==============================="
##############################################################################
# generic fluff
include defaults.mk
#include $(TOPDIR)/rules.mk
include $(MAKETOPDIR)/defaults.mk
#include $(MAKETOPDIR)/rules.mk
##############################################################################
# generate SUBDIRS variable
#
.subdirs: autoconf.h
.subdirs: $(TOPDIR)/autoconf.h
@ echo "checking in which subdirs to build"
@ $(RM) -f $@
@ echo "SUBDIRS += animations" >> $@
@ echo "SUBDIRS += animations/bitmapscroller" >> $@
@ echo "SUBDIRS += smallani" >> $@
@ (for subdir in `grep -e "^#define .*_SUPPORT" autoconf.h \
| sed -e "s/^#define //" -e "s/_SUPPORT.*//" \
@ echo "SUBDIRS += $(TOPDIR)/animations" >> $@
@ echo "SUBDIRS += $(TOPDIR)/animations/bitmapscroller" >> $@
@ echo "SUBDIRS += $(TOPDIR)/smallani" >> $@
@ (for subdir in `grep -e "^#define .*_SUPPORT" $(TOPDIR)/autoconf.h \
| sed -e "s/^#define /$(TOPDIR)\//" -e "s/_SUPPORT.*//" \
| tr "[A-Z]\\n" "[a-z] " `; do \
test -d $$subdir && echo "SUBDIRS += $$subdir" ; \
done) | sort -u >> $@
@ -53,8 +54,8 @@ ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),mrproper)
ifneq ($(MAKECMDGOALS),menuconfig)
include $(TOPDIR)/.subdirs
include $(TOPDIR)/.config
-include $(MAKETOPDIR)/.subdirs
include $(MAKETOPDIR)/.config
include $(TOPDIR)/games/games.mk
endif # MAKECMDGOALS!=menuconfig
@ -65,7 +66,7 @@ endif # no_deps!=t
##############################################################################
SUBDIRS_AVR = borg_hw
SUBDIRS_AVR = $(TOPDIR)/borg_hw
SUBDIRS_AVR += $(SUBDIRS)
.PHONY: compile-subdirs_avr
@ -77,7 +78,7 @@ compile-$(TARGET): compile-subdirs_avr $(TARGET).hex $(TARGET).bin $(TARGET).lst
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC})
OBJECTS += $(patsubst $(TOPDIR)/%.c,$(TOPDIR)/obj_avr/%.o,${SRC})
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS_AVR),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects 2>/dev/null),$(subdir)/$(object)))
$(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
@ -86,8 +87,8 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
##############################################################################
#generic rules for AVR-Build
./obj_avr/%.o: %.c
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
$(TOPDIR)/obj_avr/%.o: $(TOPDIR)/%.c
@ if [ ! -d $(TOPDIR)/obj_avr ]; then mkdir $(TOPDIR)/obj_avr ; fi
@ echo "compiling $<"
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
@ -109,25 +110,25 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
##############################################################################
#Rules for simulator build
SUBDIRS_SIM = simulator
SUBDIRS_SIM = $(TOPDIR)/simulator
SUBDIRS_SIM += $(SUBDIRS)
.PHONY: compile-subdirs_sim
compile-subdirs_sim:
@ for dir in $(SUBDIRS_SIM); do $(MAKE) -C $$dir objects_sim || exit 5; done
@ $(MAKE) -C ./simulator/ objects_sim || exit 5;
@ $(MAKE) -C $(TOPDIR)/simulator/ objects_sim || exit 5;
simulator: autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM)
simulator: $(TOPDIR)/autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM)
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS_SIM),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects 2>/dev/null),$(subdir)/$(object)))
OBJECTS_SIM = $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
OBJECTS_SIM = $(patsubst $(TOPDIR)/%.c,$(TOPDIR)/obj_sim/%.o,${SRC_SIM})
$(TARGET_SIM): $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM)
$(HOSTCC) $(LDFLAGS_SIM) -o $@ $(OBJECTS_SIM) $(SUBDIROBJECTS_SIM) $(LIBS_SIM)
./obj_sim/%.o: %.c
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
$(TOPDIR)/obj_sim/%.o: $(TOPDIR)/%.c
@ if [ ! -d $(TOPDIR)/obj_sim ]; then mkdir $(TOPDIR)/obj_sim ; fi
@ echo "compiling $<"
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $<
@ -145,6 +146,21 @@ menuconfig:
@echo "Next, you can: "
@echo " * 'make' to compile your borgware"
test:
@echo $(CONFIG_SHELL)
@echo
@echo "========== Testing borg-16 ========== "
$(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig config.in profiles/borg-16
$(MAKE)
$(MAKE) clean
@echo
@echo "========== Testing borg-ls ========== "
$(MAKE) -C scripts/lxdialog all
$(CONFIG_SHELL) scripts/Menuconfig config.in profiles/borg-ls
$(MAKE)
$(MAKE) clean
#%/menuconfig:
# $(SH) "$(@D)/configure"
# @$(MAKE) what-now-msg
@ -152,44 +168,48 @@ menuconfig:
##############################################################################
clean:
$(MAKE) -f rules.mk no_deps=t clean-common
$(RM) $(TARGET) $(TARGET).bin $(TARGET).hex $(TARGET).lst .subdirs
for subdir in `find . -type d` ; do \
$(RM) -f $(TARGET) $(TARGET).bin $(TARGET).hex $(TARGET).lst .subdirs
$(RM) -f $(TARGET).map
for subdir in `find . -type d ! -iwholename './src/rfm12/rfm12_lib/examples/*'` ; do \
test "x$$subdir" != "x." \
&& test -e $$subdir/Makefile \
&& $(MAKE) no_deps=t -C $$subdir clean ; done ; true
$(RM) -fr $(TOPDIR)/obj_avr $(TOPDIR)/obj_sim
$(RM) -f $(TARGET_SIM) $(TARGET_SIM).exe
mrproper:
$(MAKE) clean
$(RM) -f autoconf.h .config config.mk .menuconfig.log .config.old
$(RM) -f $(TOPDIR)/autoconf.h .config config.mk .menuconfig.log .config.old
sflash: $(TARGET).hex
#sflash: $(TARGET).hex
# $(LAUNCH_BOOTLOADER) $(SERIAL) 115200
avrdude -p m32 -b 115200 -u -c avr109 -P $(SERIAL) -U f:w:$< -F
echo X > $(SERIAL)
# avrdude -p m32 -b 115200 -u -c avr109 -P $(SERIAL) -U f:w:$< -F
# echo X > $(SERIAL)
uflash: $(TARGET).hex
avrdude -c usbasp -p atmega32 -V -U f:w:$< -F
#uflash: $(TARGET).hex
# avrdude -c usbasp -p atmega32 -V -U f:w:$< -F
.PHONY: clean mrproper sflash uflash
##############################################################################
# configure ethersex
#
show-config: autoconf.h
show-config: $(TOPDIR)/autoconf.h
@echo
@echo "These modules are currently enabled: "
@echo "======================================"
@grep -e "^#define .*_SUPPORT" autoconf.h | sed -e "s/^#define / * /" -e "s/_SUPPORT.*//"
@grep -e "^#define .*_SUPPORT" $(TOPDIR)/autoconf.h | sed -e "s/^#define / * /" -e "s/_SUPPORT.*//"
.PHONY: show-config
autoconf.h .config:
$(TOPDIR)/autoconf.h .config:
@echo make\'s goal: $(MAKECMDGOALS)
ifneq ($(MAKECMDGOALS),menuconfig)
# make sure menuconfig isn't called twice, on `make menuconfig'
test -s autoconf.h -a -s .config || $(MAKE) no_deps=t menuconfig
#test -s $(TOPDIR)/autoconf.h -a -s .config || $(MAKE) no_deps=t menuconfig
# test the target file, test fails if it doesn't exist
# and will keep make from looping menuconfig.
test -s autoconf.h -a -s .config
#test -s $(TOPDIR)/autoconf.h -a -s .config
touch $(TOPDIR)/autoconf.h .config
endif
include depend.mk
include $(MAKETOPDIR)/depend.mk

View File

@ -1,32 +0,0 @@
OBJ = borg_hw.o main.o util.o pixel.o program.o borg_can.o can.o \
spi.o scrolltext3.o font_arial8.o joystick.o snake.o \
eeprom_reserve.o persistentCounter.o prng.o matrix.o \
invader_draw.o invader_init.o invader_proc.o invaders2.o \
tetris/tetris.o menu.o gameoflife.o memxor.o noekeon_asm.o \
mcuf.o uart.o
CANADDR = 0x43
SERIAL = /dev/ttyUSB0
include ../../make/avr.mk
.PHONY: tetris/tetris.o
tetris/tetris.o:
$(MAKE) "MCU_CC=$(MCU_CC)" "MCU_LD=$(MCU_LD)" "LDFLAGS=$(LDFLAGS)" \
"CFLAGS=$(CFLAGS) -DNDEBUG -pedantic -std=c99" --directory=tetris
LAUNCH_BOOTLOADER = launch-bootloader
sflash: $(OUT).hex
$(LAUNCH_BOOTLOADER) $(SERIAL) 115200
avrdude -p m32 -b 115200 -u -c avr109 -P $(SERIAL) -U f:w:$(OUT).hex -F
echo X > $(SERIAL)
urflash: image_with_bootloader.hex
avrdude -p m32 -c bsd -P /dev/parport0 -U hfuse:w:0xdc:m
avrdude -p m32 -c bsd -P /dev/parport0 -U lfuse:w:0xef:m
avrdude -p m32 -c bsd -P /dev/parport0 -U f:w:image_with_bootloader.hex
avrdude -p m32 -c bsd -P /dev/parport0 -U e:w:image_eeprom.hex
avrdude -p m32 -c bsd -P /dev/parport0 -U lock:w:0x2f:m

122
README.md Normal file
View File

@ -0,0 +1,122 @@
Borgware-2D
===========
Firmware for AVR based two-dimensional LED matrices, especially the
[Blinken Borgs](http://www.das-labor.org/wiki/Blinken_Borgs) from
[Das LABOR](http://das-labor.org/index.en.php).
Main platform is the [Borg16](http://www.das-labor.org/wiki/Borg16) construction
kit. Other supported platforms are the
[LED Brett](http://www.hackerspace-ffm.de/wiki/index.php?title=LedBrett)
projector from [Hackerspace FFM](http://www.hackerspace-ffm.de) or the
[ELO Ping-Pong Board](http://www.elo-web.de/elo/mikrocontroller-und-programmierung/ping-pong/das-franzis-pingpong).
![Small Borg16](/doc/img/Borg16-small.jpg)
![Glow Lamp Borg](/doc/img/Glow_Lamp_Borg.jpg)
Animations
----------
![Matrix](/doc/img/anim-matrix.png)
![Fire](/doc/img/anim-feuer.png)
![Scrolling Text](/doc/img/anim-scroll.png)
[Animated GIF (3.5 MB)](/doc/img/borg_anim.gif)
Games
-----
![Snake](/doc/img/game-snake.png)
![Tetris](/doc/img/game-tetris.png)
* Tetris
* Classic: Standard Tetris Clone
* First Person Tetris: Rotate the bucket instead of the Tetromino.
* Bastet: Dices the worst the possible Tetromino the whole time.
* Snake
* Breakout
* Space Invaders
Build
=====
Supported build platforms are Linux, FreeBSD and Windows (via Cygwin). Due to
customized linker scripts, simulator support is currently limited to x86 and
x86_64 archs. Following dependencies have to be met:
Linux / FreeBSD
---------------
Package names are based on Debian/Ubuntu repositories. Please adapt the names
according to your Linux distribution (or FreeBSD for that matter).
* build-essential (pulls in an ordinary gcc build tool chain for the host)
* bc
* make (gmake on FreeBSD)
* libncurses5-dev
* gcc-avr
* avr-libc
* binutils-avr
* avrdude
* freeglut3-dev
Windows
-------
* AVR GCC toolchain for Windows, choose your poison:
* [WinAVR](http://winavr.sourceforge.net)
* already includes [avrdude](http://www.nongnu.org/avrdude/)
* installer offers to add the toolchain to the system path
* straight forward download from SourceForge
* project abandoned in 2010, therefore heavily outdated (avr-gcc 4.3.3)
* [Atmel AVR Toolchain for Windows](http://www.atmel.com/tools/atmelavrtoolchainforwindows.aspx)
* actively maintained, therefore fairly up to date
* homepage nags you with rather awkward registration process before download
* you have to add the toolchain to the system path manually
* avrdude is not included (but it is possible to install WinAVR in parallel)
* [Cygwin(64)](http://www.cygwin.com/)
* bc
* make
* gcc-core
* gdb (in case you want to debug your code in the simulator)
* libncurses-devel (Cygwin)
* libncursesw-devel (Cygwin64)
* [libusb-win32](http://sourceforge.net/apps/trac/libusb-win32/wiki) in case you
want to use an USBasp programmer device with avrdude
Configure
---------
Open a (Cygwin) terminal, change to your checkout directory and type:
> make menuconfig
This starts a curses based text interface for configuring certain aspects of
your target platform. Be careful if you use an IDE like Eclipse to manage the
build, as integrated terminal emulators tend to choke on curses generated shell
output. Make sure that 'make menuconfig' has been run at least once in an
ordinary terminal emulator after a fresh checkout or after issuing 'make
mrproper'.
Compile
-------
To build for the actual target platform, just type:
> make
If you want to test and debug your code within a GUI application, you can use
the simulator:
> make simulator
In case you build on FreeBSD, just use 'gmake' instead of 'make'.
You can start the simulator by typing ./borgsim(.exe)
Simulator Handling
------------------
Please keep in mind that the simulator is NOT an emulator. All it does is
compile the source code to a native host application so you can step through
your C-Code. The GUI thread reads the simulated frame buffer every 40ms and
draws its contents.
Joystick directions are simulated by the WASD keys and SPACE acts as the fire
button. The OpenGL based simulator (Linux/FreeBSD) enables you to adjust the
viewing angle of the LED matrix via the arrow keys (not available on Windows).

View File

@ -1,7 +0,0 @@
Hier liegt der Versuch, eine universelle Codebasis für 2d-borgs zu bauen, die
durch 'make menuconfig' konfigurierbar ist.
Zur Zeit ist es bereits möglich, gewisse Dinge in menuconfig einzustellen.
Einfach mal ansehen! Compiliert werden kann das Ganze auch schon.
Außerdem wird grade versucht, das Ganze mit dem Borg-api-Simulator zu
integrieren.

View File

@ -1,13 +0,0 @@
TARGET = libcan.a
TOPDIR = ..
include $(TOPDIR)/defaults.mk
ifeq ($(CAN_SUPPORT),y)
SRC = can.c
SRC += borg_can.c
SRC += lap.c
SRC += spi.c
endif
include $(TOPDIR)/rules.mk

View File

@ -11,6 +11,8 @@ comment "General Setup"
ATmega328 atmega328 \
ATmega644 atmega644 \
ATmega644p atmega644p \
ATmega1284 atmega1284 \
ATmega1284p atmega1284p \
ATmega8515 atmega8515" \
'ATmega32' MCU
@ -20,7 +22,7 @@ endmenu
### Borg Hardware Menu ########################################################
source borg_hw/config.in
source src/borg_hw/config.in
###############################################################################
@ -34,22 +36,22 @@ endmenu
### Scrolltext Menu ###########################################################
source scrolltext/config.in
source src/scrolltext/config.in
###############################################################################
### RFM12 Menu ################################################################
source rfm12/config.in
source src/rfm12/config.in
###############################################################################
### Joystick Menu #############################################################
source joystick/config.in
source src/joystick/config.in
###############################################################################
### CAN Menu ##################################################################
source can/config.in
source src/can/config.in
###############################################################################
@ -60,15 +62,15 @@ depends on JOYSTICK_SUPPORT
### Game Menu #################################################################
source games/config.in
source src/games/config.in
###############################################################################
### Animations Menu ###########################################################
source animations/config.in
source src/animations/config.in
###############################################################################
### small Animations Menu #####################################################
source smallani/config.in
source src/smallani/config.in
###############################################################################

View File

@ -23,10 +23,6 @@ LIBS = -lm
CFLAGS ?= -Wall -W -Wno-unused-parameter -Wno-sign-compare
CFLAGS += -g -Os -std=gnu99 -fgnu89-inline -D_XOPEN_SOURCE=600 -DNDEBUG
# flags for the linker
LDFLAGS += -T ./avr5.x -Wl,-Map,image.map -mmcu=$(MCU)
#############################################################################
#Settings for Simulator build
@ -42,27 +38,28 @@ MACHINE = $(shell uname -m)
ifeq ($(findstring CYGWIN,$(OSTYPE)),CYGWIN)
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O0 -D_WIN32 -D_XOPEN_SOURCE=600
ifeq ($(MACHINE),x86_64)
LDFLAGS_SIM = -T simulator/i386pep.x
LDFLAGS_SIM = -T ld_scripts/i386pep.x
else
LDFLAGS_SIM = -T simulator/i386pe.x
LDFLAGS_SIM = -T ld_scripts/i386pe.x
endif
LIBS_SIM = -lgdi32 -lwinmm -lm
else
ifeq ($(OSTYPE),FreeBSD)
CFLAGS_SIM = -g -I/usr/local/include -Wall -pedantic -std=c99 -O0 -D_XOPEN_SOURCE=600
CFLAGS_SIM = -g -I/usr/local/include -Wall -pedantic -std=c99 -O0
CFLAGS_SIM += -D_XOPEN_SOURCE=600
ifeq ($(MACHINE),amd64)
LDFLAGS_SIM = -L/usr/local/lib -T simulator/elf_x86_64_fbsd.x
LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_x86_64_fbsd.x
else
LDFLAGS_SIM = -L/usr/local/lib -T simulator/elf_i386_fbsd.x
LDFLAGS_SIM = -L/usr/local/lib -T ld_scripts/elf_i386_fbsd.x
endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
else
ifeq ($(OSTYPE),Linux)
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O0 -D_XOPEN_SOURCE=600
ifeq ($(MACHINE),x86_64)
LDFLAGS_SIM = -g -T simulator/elf_x86_64.x
LDFLAGS_SIM = -T ld_scripts/elf_x86_64.x
else
LDFLAGS_SIM = -T simulator/elf_i386.x
LDFLAGS_SIM = -T ld_scripts/elf_i386.x
endif
LIBS_SIM = -lglut -lpthread -lGL -lGLU -lm
else
@ -82,12 +79,17 @@ $(TARGET):
##############################################################################
# include user's config.mk file
$(TOPDIR)/config.mk:
@echo "# Put your own config here!" > $@
@echo "#F_CPU = $(F_CPU)" >> $@
@echo "#MCU = $(MCU)" >> $@
@echo "created default config.mk, tune your settings there!"
-include $(TOPDIR)/config.mk
$(MAKETOPDIR)/config.mk:
@echo "# Customize your config here!" >$@
@echo "# Add further CFLAGS by using the += operator, eg." >>$@
@echo "# CFLAGS += -mstrict-X" >>$@
@echo "#" >>$@
@echo "# In case you wonder: -mstrict-X produces smaller code, but" >>$@
@echo "# is only available on avr-gcc 4.7.0 or higher." >>$@
@echo "#" >>$@
@echo "# Other flags you might want to tune: CPPFLAGS, LDFLAGS ..." >>$@
@echo "Created default config.mk, tune your settings there!"
-include $(MAKETOPDIR)/config.mk
##############################################################################
@ -97,17 +99,24 @@ ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),mrproper)
ifneq ($(MAKECMDGOALS),menuconfig)
include $(TOPDIR)/.config
include $(MAKETOPDIR)/.config
CPPFLAGS += -DF_CPU=$(FREQ)UL -mmcu=$(MCU)
# flags for the linker, choose appropriate linker script
ifeq ($(findstring atmega128,$(MCU)),atmega128)
LDFLAGS += -T ld_scripts/avr51.x -Wl,-Map,image.map -mmcu=$(MCU)
else
LDFLAGS += -T ld_scripts/avr5.x -Wl,-Map,image.map -mmcu=$(MCU)
endif
endif # MAKECMDGOALS!=menuconfig
endif # MAKECMDGOALS!=mrproper
endif # MAKECMDGOALS!=clean
ifeq ($(BOOTLOADER_SUPPORT),y)
LDFLAGS += -Wl,--section-start=.text=0xE000
CFLAGS += -mcall-prologues
LDFLAGS += -Wl,--section-start=.text=0xE000
CFLAGS += -mcall-prologues
endif

BIN
doc/img/Borg16-small.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
doc/img/Glow_Lamp_Borg.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
doc/img/anim-feuer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
doc/img/anim-matrix.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
doc/img/anim-scroll.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
doc/img/borg_anim.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

BIN
doc/img/game-snake.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
doc/img/game-tetris.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -1,10 +0,0 @@
TARGET =
TOPDIR = ../..
include $(TOPDIR)/defaults.mk
ifeq ($(GAME_BREAKOUT),y)
SRC = breakout.c playfield.c rebound.c score.c level.c ball.c messages.c
endif
include $(TOPDIR)/rules.mk

View File

@ -1,8 +0,0 @@
TARGET =
TOPDIR = ../..
include $(TOPDIR)/defaults.mk
SRC = kart.c
include $(TOPDIR)/rules.mk

View File

@ -1,8 +0,0 @@
TARGET =
TOPDIR = ../..
include $(TOPDIR)/defaults.mk
SRC = snake_game.c
include $(TOPDIR)/rules.mk

View File

@ -1,8 +0,0 @@
TARGET =
TOPDIR = ../..
include $(TOPDIR)/defaults.mk
SRC = invader_init.c invader_draw.c invader_proc.c invaders2.c
include $(TOPDIR)/rules.mk

231
ld_scripts/avr51.x Normal file
View File

@ -0,0 +1,231 @@
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
OUTPUT_ARCH(avr:51)
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = 128K
data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
}
SECTIONS
{
/* Read-only sections, merged into text segment: */
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text :
{
*(.rel.text)
*(.rel.text.*)
*(.rel.gnu.linkonce.t*)
}
.rela.text :
{
*(.rela.text)
*(.rela.text.*)
*(.rela.gnu.linkonce.t*)
}
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata :
{
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.gnu.linkonce.r*)
}
.rela.rodata :
{
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.gnu.linkonce.r*)
}
.rel.data :
{
*(.rel.data)
*(.rel.data.*)
*(.rel.gnu.linkonce.d*)
}
.rela.data :
{
*(.rela.data)
*(.rela.data.*)
*(.rela.gnu.linkonce.d*)
}
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
/* Internal text space or external memory. */
.text :
{
*(.vectors)
KEEP(*(.vectors))
/* For data that needs to reside in the lower 64k of progmem. */
*(.progmem.gcc*)
*(.progmem*)
. = ALIGN(2);
__trampolines_start = . ;
/* The jump trampolines for the 16-bit limited relocs will reside here. */
*(.trampolines)
*(.trampolines*)
__trampolines_end = . ;
/* For future tablejump instruction arrays for 3 byte pc devices.
We don't relax jump/call instructions within these sections. */
*(.jumptables)
*(.jumptables*)
/* For code that needs to reside in the lower 128k progmem. */
*(.lowtext)
*(.lowtext*)
__ctors_start = . ;
*(.ctors)
__ctors_end = . ;
__dtors_start = . ;
*(.dtors)
__dtors_end = . ;
KEEP(SORT(*)(.ctors))
KEEP(SORT(*)(.dtors))
/* From this point on, we don't bother about wether the insns are
below or above the 16 bits boundary. */
*(.init0) /* Start here after reset. */
KEEP (*(.init0))
*(.init1)
KEEP (*(.init1))
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
KEEP (*(.init2))
*(.init3)
KEEP (*(.init3))
*(.init4) /* Initialize data and BSS. */
KEEP (*(.init4))
*(.init5)
KEEP (*(.init5))
*(.init6) /* C++ constructors. */
KEEP (*(.init6))
*(.init7)
KEEP (*(.init7))
*(.init8)
KEEP (*(.init8))
*(.init9) /* Call main(). */
KEEP (*(.init9))
*(.text)
. = ALIGN(2);
*(.text.*)
. = ALIGN(2);
*(.fini9) /* _exit() starts here. */
KEEP (*(.fini9))
*(.fini8)
KEEP (*(.fini8))
*(.fini7)
KEEP (*(.fini7))
*(.fini6) /* C++ destructors. */
KEEP (*(.fini6))
*(.fini5)
KEEP (*(.fini5))
*(.fini4)
KEEP (*(.fini4))
*(.fini3)
KEEP (*(.fini3))
*(.fini2)
KEEP (*(.fini2))
*(.fini1)
KEEP (*(.fini1))
*(.fini0) /* Infinite loop after program termination. */
KEEP (*(.fini0))
_etext = . ;
} > text
.data : AT (ADDR (.text) + SIZEOF (.text))
{
PROVIDE (__data_start = .) ;
*(.data)
*(.data*)
*(.rodata) /* We need to include .rodata here if gcc is used */
*(.rodata*) /* with -fdata-sections. */
*(.gnu.linkonce.d*)
PROVIDE (_game_descriptors_start__ = .) ;
*(.game_descriptors)
PROVIDE (_game_descriptors_end__ = .) ;
. = ALIGN(2);
_edata = . ;
PROVIDE (__data_end = .) ;
} > data
.bss SIZEOF(.data) + ADDR(.data) :
{
PROVIDE (__bss_start = .) ;
*(.bss)
*(.bss*)
*(COMMON)
PROVIDE (__bss_end = .) ;
} > data
__data_load_start = LOADADDR(.data);
__data_load_end = __data_load_start + SIZEOF(.data);
/* Global data not cleared after reset. */
.noinit SIZEOF(.bss) + ADDR(.bss) :
{
PROVIDE (__noinit_start = .) ;
*(.noinit*)
PROVIDE (__noinit_end = .) ;
_end = . ;
PROVIDE (__heap_start = .) ;
} > data
.eeprom :
{
*(.eeprom*)
__eeprom_end = . ;
} > eeprom
.fuse :
{
KEEP(*(.fuse))
KEEP(*(.lfuse))
KEEP(*(.hfuse))
KEEP(*(.efuse))
} > fuse
.lock :
{
KEEP(*(.lock*))
} > lock
.signature :
{
KEEP(*(.signature*))
} > signature
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
}

View File

@ -1,9 +0,0 @@
TARGET = libanimations.a
TOPDIR = ..
include $(TOPDIR)/defaults.mk
SRC = menu.c
include $(TOPDIR)/rules.mk

View File

@ -1,8 +0,0 @@
TARGET = objects
TOPDIR = ..
include $(TOPDIR)/defaults.mk
SRC = rfm12.c borg_rfm12.c
include $(TOPDIR)/rules.mk

View File

@ -1,4 +0,0 @@
#include "rfm12_config.h"
#include "rfm12_lib/rfm12.c"

View File

@ -1,4 +0,0 @@
#include "rfm12_config.h"
#include "rfm12_lib/rfm12.h"

View File

@ -1,5 +1,3 @@
##############################################################################
# rules for buildung AVR objects
@ -35,17 +33,14 @@ objects_sim: $(OBJECTS_SIM)
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
@ echo $(OBJECTS_SIM) > obj_sim/.objects
clean-common:
$(RM) $(TARGET) *.[odasE] *.d.new *~
$(RM) -r ./obj_avr
$(RM) -r ./obj_sim
$(RM) -r obj_avr
$(RM) -r obj_sim
clean: clean-common
all:
$(MAKE) -C $(TOPDIR) all
include $(TOPDIR)/depend.mk
#include depend.mk

View File

@ -1564,7 +1564,7 @@ save_configuration () {
echo -n "."
DEF_CONFIG="${1:-.config}"
DEF_CONFIG_H="autoconf.h"
DEF_CONFIG_H="src/autoconf.h"
CONFIG=.tmpconfig
CONFIG_H=.tmpconfig.h
@ -1722,32 +1722,40 @@ echo -n ", parsing"
parse_config_files $CONFIG_IN
echo "done."
#
# Start the ball rolling from the top.
#
activate_menu MCmenu0
#
# All done!
#
cleanup1
if [ -z $2 ]; then # Interactive mode
#
# Start the ball rolling from the top.
#
activate_menu MCmenu0
#
# Confirm and Save
#
if $DIALOG --backtitle "$backtitle" \
--yesno "Do you wish to save your new Borg configuration?" 5 60
then
#
# All done!
#
cleanup1
#
# Confirm and Save
#
if $DIALOG --backtitle "$backtitle" \
--yesno "Do you wish to save your new Borg configuration?" 5 60
then
save_configuration
echo
echo
echo "*** End of Borg configuration."
echo
else
echo
echo
echo Your Borg configuration changes were NOT saved.
echo
fi
else # Second argument give; noninteractive!
echo "Loading configuration file $2"
load_config_file $2
cleanup1
save_configuration
echo
echo
echo "*** End of Borg configuration."
echo
else
echo
echo
echo Your Borg configuration changes were NOT saved.
echo
fi
# Remove log if empty.

View File

@ -1,10 +0,0 @@
TARGET = objects
TOPDIR = ..
include $(TOPDIR)/defaults.mk
SRC = scrolltext3.c
SRC += $(shell echo $(SCROLLTEXT_FONT) | tr A-Z a-z).c
include $(TOPDIR)/rules.mk

View File

@ -1,102 +0,0 @@
PRG = borgSim
APP = $(PRG).app/Contents/MacOS/$(PRG)
OPTIMIZE = -O2
LIBS = -lpthread -framework Carbon -framework GLUT -framework OpenGL -framework Foundation -framework AppKit
CC = gcc
LD = ld
override CFLAGS = -g -Wall -pedantic -std=c99 $(OPTIMIZE) -DOSX_
$(DEFS)
override LDFLAGS = -Wl --prebind
OBJ = breakpoint.o font_arial8.o font_small6.o font_uni53.o invader_draw.o \
invader_init.o invader_proc.o invaders2.o joystick.o main.o menu.o pixel.o \
program.o scrolltext3.o snake.o trackball.o util.o tetris/input.o \
tetris/logic.o tetris/piece.o tetris/playfield.o tetris/view.o
all: Makefile.osx $(APP)
$(APP): $(OBJ)
test -d $(PRG).app/Contents/MacOS/ || mkdir -p $(PRG).app/Contents/MacOS/
test -d $(PRG).app/Contents/Resources/ || mkdir -p $(PRG).app/Resources/
test $(PRG).app/Contents/Rescources/borg3d.icns || cp -f borg3d.icns $(PRG).app/Contents/Rescources/
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o $@
clean:
rm -rf $(OBJ) $(PRG) $(PRG).app/
breakpoint.o: breakpoint.c pixel.h util.h config.h
$(CC) $(CFLAGS) -c -o breakpoint.o breakpoint.c
font_arial8.o: font_arial8.c font.h
$(CC) $(CFLAGS) -c -o font_arial8.o font_arial8.c
font_small6.o: font_small6.c font.h
$(CC) $(CFLAGS) -c -o font_small6.o font_small6.c
font_uni53.o: font_uni53.c font.h
$(CC) $(CFLAGS) -c -o font_uni53.o font_uni53.c
invader_draw.o: invader_draw.c invaders2.h pixel.h util.h config.h \
scrolltext.h joystick.h
$(CC) $(CFLAGS) -c -o invader_draw.o invader_draw.c
invader_init.o: invader_init.c invaders2.h pixel.h util.h config.h \
scrolltext.h joystick.h
$(CC) $(CFLAGS) -c -o invader_init.o invader_init.c
invader_proc.o: invader_proc.c invaders2.h pixel.h util.h config.h \
scrolltext.h joystick.h
$(CC) $(CFLAGS) -c -o invader_proc.o invader_proc.c
invaders2.o: invaders2.c util.h invaders2.h pixel.h config.h scrolltext.h \
joystick.h
$(CC) $(CFLAGS) -c -o invaders2.o invaders2.c
joystick.o: joystick.c joystick.h
$(CC) $(CFLAGS) -c -o joystick.o joystick.c
main.o: main.c config.h pixel.h util.h program.h menu.h tetris/logic.h \
tetris/piece.h trackball.h snake.h scrolltext.h
$(CC) $(CFLAGS) -c -o main.o main.c
menu.o: menu.c menu.h config.h util.h pixel.h joystick.h snake.h \
tetris/logic.h tetris/piece.h invaders2.h scrolltext.h
$(CC) $(CFLAGS) -c -o menu.o menu.c
pixel.o: pixel.c pixel.h util.h config.h
$(CC) $(CFLAGS) -c -o pixel.o pixel.c
program.o: program.c pixel.h util.h config.h program.h joystick.h
$(CC) $(CFLAGS) -c -o program.o program.c
scrolltext3.o: scrolltext3.c config.h scrolltext.h pixel.h util.h \
font_arial8.h font.h font_small6.h font_uni53.h
$(CC) $(CFLAGS) -c -o scrolltext3.o scrolltext3.c
snake.o: snake.c pixel.h util.h config.h joystick.h
$(CC) $(CFLAGS) -c -o snake.o snake.c
trackball.o: trackball.c trackball.h
$(CC) $(CFLAGS) -c -o trackball.o trackball.c
util.o: util.c joystick.h
$(CC) $(CFLAGS) -c -o util.o util.c
tetris/input.o: tetris/input.c joystick.h util.h tetris/input.h
$(CC) $(CFLAGS) -c -o tetris/input.o tetris/input.c
tetris/logic.o: tetris/logic.c tetris/logic.h tetris/piece.h \
tetris/playfield.h tetris/view.h tetris/input.h
$(CC) $(CFLAGS) -c -o tetris/logic.o tetris/logic.c
tetris/piece.o: tetris/piece.c tetris/piece.h
$(CC) $(CFLAGS) -c -o tetris/piece.o tetris/piece.c
tetris/playfield.o: tetris/playfield.c tetris/playfield.h tetris/piece.h
$(CC) $(CFLAGS) -c -o tetris/playfield.o tetris/playfield.c
tetris/view.o: tetris/view.c config.h pixel.h util.h scrolltext.h \
tetris/logic.h tetris/piece.h tetris/playfield.h tetris/view.h
$(CC) $(CFLAGS) -c -o tetris/view.o tetris/view.c

View File

@ -1,7 +1,8 @@
TARGET = libanimations.a
TOPDIR = ..
MAKETOPDIR = ../..
include $(TOPDIR)/defaults.mk
TARGET = libanimations.a
include $(MAKETOPDIR)/defaults.mk
SRC = program.c
@ -29,6 +30,10 @@ ifeq ($(ANIMATION_MHERWEG),y)
SRC += mherweg.c
endif
ifeq ($(ANIMATION_MOIRE),y)
SRC += moire.c
endif
ifeq ($(ANIMATION_BREAKOUT),y)
SRC += breakout_demo.c
endif
@ -53,4 +58,6 @@ ifeq ($(ANIMATION_TIME),y)
SRC += borg_time.c
endif
include $(TOPDIR)/rules.mk
include $(MAKETOPDIR)/rules.mk
include $(MAKETOPDIR)/depend.mk

View File

@ -1,6 +1,6 @@
TOPDIR = ../..
MAKETOPDIR = ../../..
include $(TOPDIR)/defaults.mk
include $(MAKETOPDIR)/defaults.mk
ifeq ($(ANIMATION_BMSCROLLER),y)
SRC = bitmapscroller.c
@ -22,4 +22,6 @@ ifeq ($(ANIMATION_FAIRYDUST),y)
SRC += fairydust.c
endif
include $(TOPDIR)/rules.mk
include $(MAKETOPDIR)/rules.mk
include $(MAKETOPDIR)/depend.mk

View File

@ -7,6 +7,8 @@
#ifndef BORG_TIME_H_
#define BORG_TIME_H_
#include <stdint.h>
//send a time request packet via can
void time_request(void);

View File

@ -42,6 +42,7 @@ comment "Animations"
dep_bool "Breakout Demo" ANIMATION_BREAKOUT $GAME_BREAKOUT
dep_bool "Martin Herweg" ANIMATION_MHERWEG $RANDOM_SUPPORT
dep_bool "Moire" ANIMATION_MOIRE $RANDOM_SUPPORT
dep_bool "Langton Ant" ANIMATION_LTN_ANT $RANDOM_SUPPORT
dep_bool_menu "Time Display" ANIMATION_TIME $SCROLLTEXT_SUPPORT $LAP_TIME_EXTENSION
@ -49,7 +50,7 @@ comment "Animations"
int "Request Timeout (ms)" TIME_UPDATE_TIMEOUT 50
endmenu
source animations/bitmapscroller/config.in
source src/animations/bitmapscroller/config.in
mainmenu_option next_comment
comment "Fixed-point math patterns"

View File

@ -27,51 +27,6 @@
#define PGM(x) pgm_read_byte(&(x))
#if NUM_ROWS < 64 && NUM_COLS < 64
/** use 8 bit operands where feasible */
typedef signed char operand_t;
#else
/** use 16 bit operands if either width or height are >= 64 */
typedef int operand_t;
#endif
/**
* An implementation of Bresenham's line drawing algorithm.
* @param p1 first coordinate of the line
* @param p2 second coordinate of the line
* @param color brightness level of the line
*/
static void line(pixel p1,
pixel const p2,
unsigned char const color)
{
operand_t const dx = p1.x < p2.x ? p2.x - p1.x : p1.x - p2.x;
operand_t const sx = p1.x < p2.x ? 1 : -1;
operand_t const dy = p1.y < p2.y ? p2.y - p1.y : p1.y - p2.y;
operand_t const sy = p1.y < p2.y ? 1 : -1;
operand_t error = dx - dy;
while(1)
{
setpixel(p1, color);
if ((p1.x == p2.x) && (p1.y == p2.y))
break;
operand_t const error2 = 2 * error;
if (error2 > -dy)
{
error -= dy;
p1.x += sx;
}
if (error2 < dx)
{
error += dx;
p1.y += sy;
}
}
}
/**
* Draws a rectangle at the given coordinates.
* @param p coordinate of the rectangle's upper right corner

88
src/animations/moire.c Normal file
View File

@ -0,0 +1,88 @@
/**
* \defgroup moire A moire like pattern.
* @{
*/
/**
* @file moire.c
* @brief Implementation of a simple moire like pattern.
* @author Christian Kroll
*/
#include "../config.h"
#include "../pixel.h"
#include "../util.h"
/**
* Number of pixels of the complete border.
*/
#define NUMBER_OF_BORDER_PIXELS (2u * UNUM_COLS + 2u * (UNUM_ROWS - 2u))
/**
* Draws a moire like pattern. Works best if the number of border pixels is a
* multiple of the size of the gradient color map.
*/
void moire(void)
{
// add rotating color map
#if NUMPLANE == 3
static unsigned char const gradient[] = {0, 1, 2, 3, 2, 1};
#else
static unsigned char gradient[NUMPLANE * 2u] = {0};
for (unsigned char i = 1; i <= NUMPLANE; ++i)
{
gradient[i] = i;
gradient[(NUMPLANE * 2) - i] = i;
}
#endif
unsigned int cycles = 30000;
unsigned char pos = 0, color_index = 0;
pixel p1 = (pixel){0 ,0};
while(cycles--)
{
// walk around the border; do that by mapping a linear increasing value
// to appropriate screen coordinates
// first pixel is between top right and top left corner
if (pos < NUM_COLS)
{
p1.x = pos;
}
// first pixel is between top left and bottom left corner
else if (pos < (NUM_COLS + NUM_ROWS - 1))
{
p1.y = pos - (NUM_COLS - 1);
}
// first pixel is between bottom left and bottom right corner
else if (pos < (2 * NUM_COLS + NUM_ROWS - 2))
{
p1.x = 2 * NUM_COLS + NUM_ROWS - 3 - pos;
}
// first pixel is between bottom right and top left corner
else
{
p1.y = 3 * NUM_COLS + NUM_ROWS - 4 - pos;
}
// second pixel in opposite direction
pixel const p2 = (pixel){NUM_COLS - 1 - p1.x, NUM_ROWS - 1 - p1.y};
// draw line right accross the display and switch to next color
line(p1, p2, gradient[color_index++]);
// if we have reached the origin, reset position, rotate color index and
// wait for 40 ms (25 fps) to make the frame visible for human viewers
if (++pos == NUMBER_OF_BORDER_PIXELS)
{
pos = 0;
++color_index;
wait(40);
}
// ensure the color index keeps within bounds
color_index %= (2u * NUMPLANE);
}
}
/*@}*/

19
src/animations/moire.h Normal file
View File

@ -0,0 +1,19 @@
/**
* \defgroup moire A moire like pattern.
* @{
*/
/**
* @file moire.h
* @brief Interface file for a moire pattern implementation.
* @author Christian Kroll
*/
#ifndef MOIRE_H_
#define MOIRE_H_
void moire(void);
#endif /* MOIRE_H_ */
/*@}*/

View File

@ -1,9 +1,10 @@
MAKETOPDIR = ../..
TARGET = libborg_hw.a
TOPDIR = ..
SRC_SIM :=
include $(TOPDIR)/defaults.mk
include $(MAKETOPDIR)/defaults.mk
ifeq ($(BORG_HW),HW_BORG_16)
@ -66,4 +67,6 @@ ifeq ($(SRC),'')
$(error no valid hardware driver selected )
endif
include $(TOPDIR)/rules.mk
include $(MAKETOPDIR)/rules.mk
include $(MAKETOPDIR)/depend.mk

View File

@ -62,7 +62,7 @@ void timer0_off(){
COLPORT = 0;
ROWPORT = 0;
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x00;
TCCR0B = 0x00;
TIMSK0 = 0;
@ -86,7 +86,7 @@ static void timer0_on(){
*/
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x03; // clk/64
TCNT0 = 0x00; // reset timer

View File

@ -34,7 +34,7 @@
#define COLDDR2 DDR(COLPORT2)
#define ROWDDR DDR(ROWPORT)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
/* more ifdef magic :-( */
#define OCR0 OCR0A
#define TIMER0_COMP_vect TIMER0_COMPA_vect
@ -120,7 +120,7 @@ void timer0_off() {
COLPORT2 = 0;
ROWPORT = 0;
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x00;
TCCR0B = 0x00;
#else
@ -141,7 +141,7 @@ static void timer0_on() {
1 0 1 clk/1024
*/
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x03; // clk/64
TCNT0 = 0; // reset timer

View File

@ -33,7 +33,7 @@
#define COLDDR2 DDR(COLPORT2)
#define ROWDDR DDR(ROWPORT)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
/* more ifdef magic :-( */
#define OCR0 OCR0A
#define TIMER0_COMP_vect TIMER0_COMPA_vect
@ -153,7 +153,7 @@ void timer0_off() {
COLPORT2 = 0;
ROWPORT = 0;
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x00;
TCCR0B = 0x00;
#else
@ -175,7 +175,7 @@ static void timer0_on() {
1 0 1 clk/1024
*/
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer

View File

@ -34,7 +34,7 @@
}
/* more ifdef magic :-( */
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
#define OCR0 OCR0A
#define TIMER0_COMP_vect TIMER0_COMPA_vect
#endif
@ -195,7 +195,7 @@ void timer0_off() {
TLCPORT = 0;
ROWPORT = 0;
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x00;
TCCR0B = 0x00;
#else
@ -221,7 +221,7 @@ static void timer0_on() {
* 1 0 1 clk/1024
*/
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer

View File

@ -33,7 +33,7 @@
#define COLDDR2 DDR(COLPORT2)
#define ROWDDR DDR(ROWPORT)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
/* more ifdef magic :-( */
#define OCR0 OCR0A
#define TIMER0_COMP_vect TIMER0_COMPA_vect
@ -62,7 +62,7 @@ void timer0_off() {
COLPORT2 = 0;
ROWPORT = 0;
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x00;
TCCR0B = 0x00;
#else
@ -83,7 +83,7 @@ void timer0_on() {
1 0 0 clk/256
1 0 1 clk/1024
*/
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer

View File

@ -31,7 +31,7 @@
#define MUX_ROWS 4
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
/* more ifdef magic :-( */
#define OCR0 OCR0A
#define SIG_OUTPUT_COMPARE0 SIG_OUTPUT_COMPARE0A
@ -283,7 +283,7 @@ void timer0_off() {
ROW3_OFF();
ROW4_OFF();
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x00;
TCCR0B = 0x00;
#else
@ -305,7 +305,7 @@ static void timer0_on() {
1 0 1 clk/1024
*/
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__)
#if defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644__) || (__AVR_ATmega1284P__) || defined (__AVR_ATmega1284__)
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x04; // clk/256
TCNT0 = 0; // reset timer

View File

@ -26,59 +26,59 @@ choice 'Hardware Driver' \
if [ "$BORG_HW" == "HW_BORG_16" ] ; then
source borg_hw/config_borg16.in
source src/borg_hw/config_borg16.in
fi
if [ "$BORG_HW" == "HW_BORG_16_HGM" ] ; then
source borg_hw/config_borg16_hgmod.in
source src/borg_hw/config_borg16_hgmod.in
fi
if [ "$BORG_HW" == "HW_BORG_ANDRE" ] ; then
source borg_hw/config_andreborg.in
source src/borg_hw/config_andreborg.in
fi
if [ "$BORG_HW" == "HW_BORG_LS" ] ; then
source borg_hw/config_borg_ls.in
source src/borg_hw/config_borg_ls.in
fi
if [ "$BORG_HW" == "HW_BORG_MH" ] ; then
source borg_hw/config_borg_mh.in
source src/borg_hw/config_borg_mh.in
fi
if [ "$BORG_HW" == "HW_BORG_LSJO" ] ; then
source borg_hw/config_borg_lsjo.in
source src/borg_hw/config_borg_lsjo.in
fi
if [ "$BORG_HW" == "HW_LEDBRETT" ] ; then
source borg_hw/config_ledbrett.in
source src/borg_hw/config_ledbrett.in
fi
if [ "$BORG_HW" == "HW_BORG_MINI" ] ; then
source borg_hw/config_borg_mini.in
source src/borg_hw/config_borg_mini.in
fi
if [ "$BORG_HW" == "HW_PANEL_ONE" ] ; then
source borg_hw/config_panel_one.in
source src/borg_hw/config_panel_one.in
fi
if [ "$BORG_HW" == "HW_PD1165" ] ; then
source borg_hw/config_pd1165.in
source src/borg_hw/config_pd1165.in
fi
if [ "$BORG_HW" == "HW_PINGPONG" ] ; then
source borg_hw/config_pingpong.in
source src/borg_hw/config_pingpong.in
fi
if [ "$BORG_HW" == "HW_ROTOR" ] ; then
source borg_hw/config_rotor.in
source src/borg_hw/config_rotor.in
fi
if [ "$BORG_HW" == "HW_GIGABORG" ] ; then
source borg_hw/config_gigaborg.in
source src/borg_hw/config_gigaborg.in
fi
if [ "$BORG_HW" == "HW_ANCIENTBORG" ] ; then
source borg_hw/config_ancient.in
source src/borg_hw/config_ancient.in
fi
endmenu

Some files were not shown because too many files have changed in this diff Show More