@ -0,0 +1,3 @@ |
|||
[submodule "src/rfm12/rfm12_lib"] |
|||
path = src/rfm12/rfm12_lib |
|||
url = https://github.com/das-labor/librfm12.git |
@ -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 |
@ -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. |
@ -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 |
@ -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). |
@ -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. |
@ -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 |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.3 MiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.2 KiB |
@ -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 |
@ -1,8 +0,0 @@ |
|||
TARGET = |
|||
TOPDIR = ../.. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = kart.c |
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -1,8 +0,0 @@ |
|||
TARGET = |
|||
TOPDIR = ../.. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = snake_game.c |
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -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 |
@ -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) } |
|||
} |
@ -1,9 +0,0 @@ |
|||
TARGET = libanimations.a |
|||
TOPDIR = .. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = menu.c |
|||
|
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -1,8 +0,0 @@ |
|||
TARGET = objects |
|||
TOPDIR = .. |
|||
|
|||
include $(TOPDIR)/defaults.mk |
|||
|
|||
SRC = rfm12.c borg_rfm12.c |
|||
|
|||
include $(TOPDIR)/rules.mk |
@ -1,4 +0,0 @@ |
|||
|
|||
#include "rfm12_config.h" |
|||
#include "rfm12_lib/rfm12.c" |
|||
|
@ -1,4 +0,0 @@ |
|||
|
|||
#include "rfm12_config.h" |
|||
#include "rfm12_lib/rfm12.h" |
|||
|
@ -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 |
@ -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 |
|||
|
@ -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); |
|||
} |
|||
} |
|||
|
|||
/*@}*/ |
@ -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_ */ |
|||
|
|||
/*@}*/ |