added experimental driver for the ancient borg (not testet, yet!)

This commit is contained in:
Christian Kroll 2011-12-04 06:31:48 +00:00
parent 21a842a54b
commit 4bdb0d419d
5 changed files with 259 additions and 17 deletions

View File

@ -46,6 +46,10 @@ ifeq ($(BORG_HW),HW_GIGABORG)
SRC = borg_hw_gigaborg.c SRC = borg_hw_gigaborg.c
endif endif
ifeq ($(BORG_HW),HW_ANCIENTBORG)
SRC = borg_hw_ancient.c
endif
ifeq ($(SRC),'') ifeq ($(SRC),'')
$(error no valid hardware driver selected ) $(error no valid hardware driver selected )
endif endif

119
borg_hw/borg_hw_ancient.c Normal file
View File

@ -0,0 +1,119 @@
#include <avr/interrupt.h>
#include <avr/io.h>
#undef WATCHDOG_ENABLED
#ifdef WATCHDOG_ENABLED
# include <avr/wdt.h>
#endif
#include "../config.h"
#include "../makros.h"
#include "borg_hw.h"
// define row port
#ifndef ROWPORT
# define ROWPORT PORTA
#endif
#define ROWDDR DDR(ROWPORT)
// define column port
#ifndef COLPORT
# define COLPORT PORTC
#endif
#define COLDDR DDR(COLPORT)
// buffer which holds the currently shown frame
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
SIGNAL(SIG_OUTPUT_COMPARE0)
{
static unsigned char plane = 0;
static unsigned char row = 0;
#ifdef WATCHDOG_ENABLED
// reset watchdog
wdt_reset();
#endif
ROWPORT = 0;
row++;
if ((COLPORT <<= 1) == 0) {
row = 0;
COLPORT = 1;
if (++plane == NUMPLANE)
{
plane = 0;
}
}
for (unsigned char x = 0; x < 10; x++) {
asm volatile ("nop");
}
ROWPORT = pixmap[plane][row][0];
}
void timer0_off(){
cli();
COLPORT = 0;
ROWPORT = 0;
#ifdef __AVR_ATmega644P__
TCCR0A = 0x00;
TCCR0B = 0x00;
TIMSK0 = 0;
#else
TCCR0 = 0x00;
TIMSK = 0;
#endif
sei();
}
static void timer0_on(){
/* TCCR0: FOC0 WGM00 COM01 COM00 WGM01 CS02 CS01 CS00
CS02 CS01 CS00
0 0 0 stop
0 0 1 clk
0 1 0 clk/8
0 1 1 clk/64
1 0 0 clk/256
1 0 1 clk/1024
*/
#ifdef __AVR_ATmega644P__
TCCR0A = 0x02; // CTC Mode
TCCR0B = 0x03; // clk/64
TCNT0 = 0x00; // reset timer
OCR0 = 0x0A; // compare with this value
TIMSK0 = 0x02; // compare match Interrupt on
#else
TCCR0 = 0x0B; // CTC Mode, clk/64
TCNT0 = 0x00; // reset timer
OCR0 = 0x0A; // compare with this value
TIMSK = 0x02; // compare match Interrupt on
#endif
}
void borg_hw_init(){
// switch all pins of both the row and the column port to output mode
ROWDDR = 0xFF;
COLDDR = 0xFF;
// switch off all rows and columns for now
COLPORT = 0;
ROWPORT = 0;
timer0_on();
#ifdef WATCHDOG_ENABLED
// activate watchdog timer
wdt_reset();
wdt_enable(0x00); // 17ms watchdog
#endif
}

View File

@ -10,14 +10,15 @@ int "Number of brightnes-levels" NUMPLANE 3
choice 'Hardware Driver' \ choice 'Hardware Driver' \
"Borg-16 HW_BORG_16 \ "Borg-16 HW_BORG_16 \
Andre-borg HW_BORG_ANDRE \ Andre-Borg HW_BORG_ANDRE \
Laufschrift-borg HW_BORG_LS \ Laufschrift-Borg HW_BORG_LS \
Laufschrift-borg-mh HW_BORG_MH \ Laufschrift-Borg-MH HW_BORG_MH \
Borg-mini HW_BORG_MINI \ Borg-Mini HW_BORG_MINI \
Panel-One HW_PANEL_ONE \ Panel-One HW_PANEL_ONE \
4xPD1165 HW_PD1165 \ 4xPD1165 HW_PD1165 \
PingPong HW_PINGPONG \ Ping-Pong HW_PINGPONG \
Gigaborg HW_GIGABORG" \ Giga-Borg HW_GIGABORG \
Ancient-Borg HW_ANCIENTBORG" \
'Borg-16' BORG_HW 'Borg-16' BORG_HW
@ -61,17 +62,9 @@ if [ "$BORG_HW" == "HW_GIGABORG" ] ; then
source borg_hw/config_gigaborg.in source borg_hw/config_gigaborg.in
fi fi
if [ "$BORG_HW" == "HW_ANCIENTBORG" ] ; then
source borg_hw/config_ancient.in
fi
# case $x in
# y) flag="*" ;;
# m) flag="M" ;;
# *) flag=" " ;;
# esac
endmenu endmenu

18
borg_hw/config_ancient.in Normal file
View File

@ -0,0 +1,18 @@
mainmenu_option next_comment
comment "Ancient Borg Port Setup"
choice 'Column Port' \
"PORTA PORTA \
PORTB PORTB \
PORTC PORTC \
PORTD PORTD" \
'PORTC' COLPORT
choice 'Row Port' \
"PORTA PORTA \
PORTB PORTB \
PORTC PORTC \
PORTD PORTD" \
'PORTA' ROWPORT
endmenu

108
profiles/borg-ancient Normal file
View File

@ -0,0 +1,108 @@
#
# Automatically generated by make menuconfig: don't edit
#
#
# General Setup
#
MCU=atmega32
FREQ=16000000
#
# Borg Hardware
#
NUM_ROWS=8
NUM_COLS=8
NUMPLANE=3
BORG_HW=HW_ANCIENTBORG
#
# Ancient Borg Port Setup
#
COLPORT=PORTC
ROWPORT=PORTA
#
# Features
#
RANDOM_SUPPORT=y
# LAP_TIME_EXTENSION is not set
SCROLLTEXT_SUPPORT=y
SCROLLTEXT_FONT=FONT_ARIAL8
SCROLLTEXT_BUFFER_SIZE=128
SCROLL_X_SPEED=20
SCROLL_Y_SPEED=20
SCROLLTEXT_TEXT="</#www.das-labor.org"
# JOYSTICK_SUPPORT is not set
# CAN_SUPPORT is not set
# MENU_SUPPORT is not set
#
# Games
#
# GAME_TETRIS_CORE is not set
# GAME_TETRIS is not set
# GAME_BASTET is not set
# GAME_TETRIS_FP is not set
# GAME_SPACE_INVADERS is not set
# GAME_SNAKE is not set
# GAME_BREAKOUT is not set
#
# Animations
#
ANIMATION_SCROLLTEXT=y
ANIMATION_SPIRAL=y
ANIMATION_JOERN1=y
ANIMATION_SNAKE=y
SNAKE_CYCLE_DELAY=100
SNAKE_TERMINATION_DELAY=60
SNAKE_MAX_LENGTH=64
SNAKE_MAX_APPLES=10
ANIMATION_CHECKERBOARD=y
ANIMATION_FIRE=y
FIRE_S=30
FIRE_N=5
FIRE_DIV=44
FIRE_DELAY=50
FIRE_CYCLES=800
ANIMATION_MATRIX=y
MATRIX_STREAMER_NUM=30
MATRIX_CYCLES=500
ANIMATION_RANDOM_BRIGHT=y
# ANIMATION_STONEFLY is not set
ANIMATION_FLYINGDOTS=y
ANIMATION_GAMEOFLIFE=y
GOL_DELAY=100
GOL_CYCLES=360
# ANIMATION_BREAKOUT is not set
# ANIMATION_MHERWEG is not set
# ANIMATION_LTN_ANT is not set
# ANIMATION_TIME is not set
TIME_MASTER_ADDR=00
TIME_UPDATE_TIMEOUT=50
# ANIMATION_BMSCROLLER is not set
# ANIMATION_LABORLOGO is not set
# ANIMATION_AMPHIBIAN is not set
# ANIMATION_LOGO_OOS is not set
# ANIMATION_LOGO_28C3 is not set
ANIMATION_PLASMA=y
ANIMATION_PSYCHEDELIC=y
# ANIMATION_TESTS is not set
# ANIMATION_OFF is not set
#
# small Animations
#
# SMALLANIMATION_ROWWALK is not set
SMALLANIMATION_ROWWALK_SPEED=50
SMALLANIMATION_ROWWALK_COUNT=10
# SMALLANIMATION_COLWALK is not set
SMALLANIMATION_COLWALK_SPEED=50
SMALLANIMATION_COLWALK_COUNT=10
# SMALLANIMATION_ROWBOUNCE is not set
SMALLANIMATION_ROWBOUNCE_SPEED=50
SMALLANIMATION_ROWBOUNCE_COUNT=10
# SMALLANIMATION_COLBOUNCE is not set
SMALLANIMATION_COLBOUNCE_SPEED=50
SMALLANIMATION_COLBOUNCE_COUNT=10