renamed project because it is to cool for stupid name
This commit is contained in:
commit
fe14b29d15
106 changed files with 16442 additions and 0 deletions
31
borg_hw/Makefile
Normal file
31
borg_hw/Makefile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
TARGET = libborg_hw.a
|
||||
TOPDIR = ..
|
||||
|
||||
include $(TOPDIR)/defaults.mk
|
||||
|
||||
|
||||
ifeq ($(BORG_HW),HW_BORG_16)
|
||||
SRC = borg_hw_borg16.c
|
||||
endif
|
||||
|
||||
ifeq ($(BORG_HW),HW_BORG_ANDRE)
|
||||
SRC = borg_hw_andreborg.c
|
||||
endif
|
||||
|
||||
ifeq ($(BORG_HW),HW_BORG_LS)
|
||||
SRC = borg_hw_borg_ls.c
|
||||
endif
|
||||
|
||||
ifeq ($(BORG_HW),HW_BORG_LS)
|
||||
SRC = borg_hw_borg_ls.c
|
||||
endif
|
||||
|
||||
ifeq ($(BORG_HW),HW_BORG_MINI)
|
||||
SRC = borg_hw_borg_mini.c
|
||||
endif
|
||||
|
||||
ifeq ($(SRC),'')
|
||||
$(error no valid hardware driver selected )
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
15
borg_hw/borg_hw.h
Normal file
15
borg_hw/borg_hw.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef BORG_HW_H
|
||||
#define BORG_HW_H
|
||||
|
||||
//Linebytes gibt die Zahl der Bytes pro Zeile in der
|
||||
//Pixmap an, also Spaltenzahl/8 aufgerundet
|
||||
#define LINEBYTES (((NUM_COLS-1)/8)+1)
|
||||
|
||||
|
||||
extern unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
||||
|
||||
void watchdog_enable();
|
||||
void borg_hw_init();
|
||||
void timer0_off();
|
||||
|
||||
#endif
|
||||
168
borg_hw/borg_hw_andreborg.c
Normal file
168
borg_hw/borg_hw_andreborg.c
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
|
||||
#include "../config.h"
|
||||
#include "../makros.h"
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#include "borg_hw.h"
|
||||
|
||||
/*
|
||||
// Diese #defines werden nun durch menuconfig gesetzt
|
||||
|
||||
// 16 Spalten insgesamt direkt gesteuert, dafür 2 Ports
|
||||
#define COLPORT1 PORTA
|
||||
#define COLDDR1 DDRA
|
||||
|
||||
#define COLPORT2 PORTC
|
||||
#define COLDDR2 DDRC
|
||||
|
||||
// Der andere Port übernimmt die Steuerung der Schieberegister
|
||||
#define ROWPORT PORTD
|
||||
#define ROWDDR DDRD
|
||||
// Clock und reset gehen gemeinsam an beide Schieberegister
|
||||
// der reset pin ist negiert
|
||||
#define PIN_MCLR PD4
|
||||
#define PIN_CLK PD5
|
||||
//das dier sind die individuellen Dateneingänge für die Schieberegister
|
||||
#define PIN_DATA1 PD6
|
||||
#define PIN_DATA2 PD7
|
||||
*/
|
||||
|
||||
#define COLDDR1 DDR(COLPORT1)
|
||||
#define COLDDR2 DDR(COLPORT2)
|
||||
#define ROWDDR DDR(ROWPORT)
|
||||
|
||||
//Der Puffer, in dem das aktuelle Bild gespeichert wird
|
||||
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
||||
|
||||
|
||||
//Eine Zeile anzeigen
|
||||
inline void rowshow(unsigned char row, unsigned char plane){
|
||||
//Die Zustände von der vorherigen Zeile löschen
|
||||
COLPORT1 = 0;
|
||||
COLPORT2 = 0;
|
||||
|
||||
//kurze Warteschleife, damit die Treiber auch wirklich ausschalten
|
||||
unsigned char i;
|
||||
for(i=0;i<20;i++){
|
||||
asm volatile("nop");
|
||||
}
|
||||
|
||||
|
||||
if (row == 0){
|
||||
//Zeile 0: Das erste Schieberegister initialisieren
|
||||
ROWPORT&= ~(1<<PIN_MCLR);
|
||||
ROWPORT|= (1<<PIN_MCLR);
|
||||
ROWPORT|= (1<<PIN_DATA1);
|
||||
ROWPORT|= (1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_DATA1);
|
||||
|
||||
//Je nachdem, welche der Ebenen wir Zeichnen, die Zeile verschieden lange Anzeigen
|
||||
switch (plane){
|
||||
case 0:
|
||||
OCR0 = 5;
|
||||
break;
|
||||
case 1:
|
||||
OCR0 = 8;
|
||||
break;
|
||||
case 2:
|
||||
OCR0 = 20;
|
||||
}
|
||||
}else if(row == 8){
|
||||
//Zeile 8: Das Zweite Schieberegister initialisieren
|
||||
ROWPORT&= ~(1<<PIN_MCLR);
|
||||
ROWPORT|= (1<<PIN_MCLR);
|
||||
ROWPORT|= (1<<PIN_DATA2);
|
||||
ROWPORT|= (1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_DATA2);
|
||||
}else{
|
||||
//In jeder anderen Zeile einfach nur einen weiter schieben
|
||||
ROWPORT|= (1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_CLK);
|
||||
}
|
||||
|
||||
//ncoh eine Warteschleife, damit die Zeilentreiber bereit sind
|
||||
for(i=0;i<20;i++){
|
||||
asm volatile("nop");
|
||||
}
|
||||
|
||||
//die Daten für die aktuelle Zeile auf die Spaltentreiber ausgeben
|
||||
COLPORT1 = pixmap[plane][row][0];
|
||||
COLPORT2 = pixmap[plane][row][1];
|
||||
}
|
||||
|
||||
|
||||
//Dieser Interrupt wird je nach Ebene mit 50kHz 31,25kHz oder 12,5kHz ausgeführt
|
||||
SIGNAL(SIG_OUTPUT_COMPARE0)
|
||||
{
|
||||
static unsigned char plane = 0;
|
||||
static unsigned char row = 0;
|
||||
|
||||
//Watchdog zurücksetzen
|
||||
wdt_reset();
|
||||
|
||||
//Die aktuelle Zeile in der aktuellen Ebene ausgeben
|
||||
rowshow(row, plane);
|
||||
|
||||
//Zeile und Ebene inkrementieren
|
||||
if(++row == NUM_ROWS){
|
||||
row = 0;
|
||||
if(++plane==NUMPLANE) plane=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void timer0_off(){
|
||||
cli();
|
||||
|
||||
COLPORT1 = 0;
|
||||
COLPORT2 = 0;
|
||||
ROWPORT = 0;
|
||||
|
||||
TCCR0 = 0x00;
|
||||
sei();
|
||||
}
|
||||
|
||||
|
||||
// Den Timer, der denn Interrupt auslöst, initialisieren
|
||||
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
|
||||
|
||||
*/
|
||||
TCCR0 = 0x0B; // CTC Mode, clk/64
|
||||
TCNT0 = 0; // reset timer
|
||||
OCR0 = 20; // Compare with this value
|
||||
TIMSK = 0x02; // Compare match Interrupt on
|
||||
}
|
||||
|
||||
void borg_hw_init(){
|
||||
//Spalten Ports auf Ausgang
|
||||
COLDDR1 = 0xFF;
|
||||
COLDDR2 = 0xFF;
|
||||
|
||||
//Pins am Zeilenport auf Ausgang
|
||||
ROWDDR = (1<<PIN_MCLR) | (1<<PIN_CLK) | (1<< PIN_DATA1) | (1<<PIN_DATA2);
|
||||
|
||||
//Alle Spalten erstmal aus
|
||||
COLPORT1 = 0;
|
||||
COLPORT2 = 0;
|
||||
|
||||
//Schieberegister für Zeilen zurücksetzen
|
||||
ROWPORT = 0;
|
||||
|
||||
timer0_on();
|
||||
|
||||
//Watchdog Timer aktivieren
|
||||
wdt_reset();
|
||||
wdt_enable(0x00); // 17ms Watchdog
|
||||
}
|
||||
207
borg_hw/borg_hw_borg16.c
Normal file
207
borg_hw/borg_hw_borg16.c
Normal file
|
|
@ -0,0 +1,207 @@
|
|||
|
||||
#include "../config.h"
|
||||
#include "../makros.h"
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#include "borg_hw.h"
|
||||
|
||||
/*
|
||||
// Diese #defines werden nun durch menuconfig gesetzt
|
||||
|
||||
// 16 Spalten insgesamt direkt gesteuert, dafür 2 Ports
|
||||
#define COLPORT1 PORTC
|
||||
#define COLDDR1 DDRC
|
||||
|
||||
#define COLPORT2 PORTA
|
||||
#define COLDDR2 DDRA
|
||||
|
||||
// Der andere Port übernimmt die Steuerung der Schieberegister
|
||||
#define ROWPORT PORTD
|
||||
#define ROWDDR DDRD
|
||||
// Clock und reset gehen gemeinsam an beide Schieberegister
|
||||
// der reset pin ist negiert
|
||||
#define PIN_MCLR PD4
|
||||
#define PIN_CLK PD6
|
||||
//das dier sind die individuellen Dateneingänge für die Schieberegister
|
||||
#define PIN_DATA PD7
|
||||
*/
|
||||
|
||||
#define COLDDR1 DDR(COLPORT1)
|
||||
#define COLDDR2 DDR(COLPORT2)
|
||||
#define ROWDDR DDR(ROWPORT)
|
||||
|
||||
//Der Puffer, in dem das aktuelle Bild gespeichert wird
|
||||
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
||||
|
||||
|
||||
//zur nächsten Zeile weiterschalten
|
||||
inline void nextrow(uint8_t row){
|
||||
//Die Zustände von der vorherigen Zeile löschen
|
||||
COLPORT1 = 0;
|
||||
COLPORT2 = 0;
|
||||
|
||||
//kurze Warteschleife, damit die Treiber auch wirklich ausschalten
|
||||
|
||||
unsigned char i;
|
||||
for(i=0;i<10;i++){
|
||||
asm volatile("nop");
|
||||
}
|
||||
|
||||
if (row == 0){
|
||||
//Zeile 0: Das erste Schieberegister initialisieren
|
||||
#ifndef INVERSE_ROWS
|
||||
ROWPORT&= ~(1<<PIN_MCLR);
|
||||
ROWPORT|= (1<<PIN_MCLR);
|
||||
ROWPORT|= (1<<PIN_DATA);
|
||||
ROWPORT|= (1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_DATA);
|
||||
#else
|
||||
ROWPORT&= ~(1<<PIN_DATA);
|
||||
ROWPORT|= (1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_CLK);
|
||||
ROWPORT|= (1<<PIN_DATA);
|
||||
|
||||
#endif
|
||||
}else{
|
||||
//In jeder anderen Zeile einfach nur einen weiter schieben
|
||||
ROWPORT|= (1<<PIN_CLK);
|
||||
ROWPORT&= ~(1<<PIN_CLK);
|
||||
}
|
||||
|
||||
//noch eine Warteschleife, damit die Zeilentreiber bereit sind
|
||||
for(i=0;i<20;i++){
|
||||
asm volatile("nop");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Eine Zeile anzeigen
|
||||
inline void rowshow(unsigned char row, unsigned char plane){
|
||||
//Je nachdem, welche der Ebenen wir Zeichnen, die Zeile verschieden lange Anzeigen
|
||||
switch (plane){
|
||||
case 0:
|
||||
OCR0 = 3;
|
||||
break;
|
||||
case 1:
|
||||
OCR0 = 4;
|
||||
break;
|
||||
case 2:
|
||||
OCR0 = 22;
|
||||
}
|
||||
|
||||
uint8_t tmp, tmp1;
|
||||
//die Daten für die aktuelle Zeile auf die Spaltentreiber ausgeben
|
||||
|
||||
#ifndef INTERLACED_ROWS
|
||||
tmp = pixmap[plane][row][0];
|
||||
tmp1 = pixmap[plane][row][1];
|
||||
#else
|
||||
row = (row>>1) + ((row & 0x01)?8:0 );
|
||||
tmp = pixmap[plane][row][0];
|
||||
tmp1 = pixmap[plane][row][1];
|
||||
#endif
|
||||
#ifdef REVERSED_HARDWARE
|
||||
tmp = (tmp >> 4) | (tmp << 4);
|
||||
tmp = ((tmp & 0xcc) >> 2) | ((tmp & 0x33)<< 2); //0xcc = 11001100, 0x33 = 00110011
|
||||
tmp = ((tmp & 0xaa) >> 1) | ((tmp & 0x55)<< 1); //0xaa = 10101010, 0x55 = 1010101
|
||||
COLPORT2 = tmp;
|
||||
tmp = tmp1;
|
||||
tmp = (tmp >> 4) | (tmp << 4);
|
||||
tmp = ((tmp & 0xcc) >> 2) | ((tmp & 0x33) << 2); //0xcc = 11001100, 0x33 = 00110011
|
||||
tmp = ((tmp & 0xaa) >> 1) | ((tmp & 0x55) << 1); //0xaa = 10101010, 0x55 = 1010101
|
||||
COLPORT1 = tmp;
|
||||
#else
|
||||
#ifdef INTERLACED_COLS
|
||||
static uint8_t interlace_table[16] = {
|
||||
0x00, 0x01, 0x04, 0x05, 0x10, 0x11, 0x14, 0x15, 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55
|
||||
};
|
||||
COLPORT1 = interlace_table[tmp&0x0f] | (interlace_table[tmp1&0x0f]<<1);
|
||||
tmp>>=4; tmp1>>=4;
|
||||
COLPORT2 = interlace_table[tmp] | (interlace_table[tmp1]<<1);
|
||||
#else
|
||||
COLPORT1 = tmp;
|
||||
COLPORT2 = tmp1;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Dieser Interrupt wird je nach Ebene mit 50kHz 31,25kHz oder 12,5kHz ausgeführt
|
||||
SIGNAL(SIG_OUTPUT_COMPARE0)
|
||||
{
|
||||
static unsigned char plane = 0;
|
||||
static unsigned char row = 0;
|
||||
|
||||
//Watchdog zurücksetzen
|
||||
wdt_reset();
|
||||
|
||||
//Zeile und Ebene inkrementieren
|
||||
if(++plane==NUMPLANE){
|
||||
plane=0;
|
||||
if(++row == NUM_ROWS){
|
||||
row = 0;
|
||||
}
|
||||
nextrow(row);
|
||||
}
|
||||
|
||||
//Die aktuelle Zeile in der aktuellen Ebene ausgeben
|
||||
rowshow(row, plane);
|
||||
}
|
||||
|
||||
|
||||
void timer0_off(){
|
||||
cli();
|
||||
|
||||
COLPORT1 = 0;
|
||||
COLPORT2 = 0;
|
||||
ROWPORT = 0;
|
||||
|
||||
TCCR0 = 0x00;
|
||||
sei();
|
||||
}
|
||||
|
||||
|
||||
// Den Timer, der denn Interrupt auslöst, initialisieren
|
||||
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
|
||||
|
||||
*/
|
||||
TCCR0 = 0x0C; // CTC Mode, clk/64
|
||||
TCNT0 = 0; // reset timer
|
||||
OCR0 = 20; // Compare with this value
|
||||
TIMSK = 0x02; // Compare match Interrupt on
|
||||
}
|
||||
|
||||
void borg_hw_init(){
|
||||
//Spalten Ports auf Ausgang
|
||||
COLDDR1 = 0xFF;
|
||||
COLDDR2 = 0xFF;
|
||||
|
||||
//Pins am Zeilenport auf Ausgang
|
||||
ROWDDR = (1<<PIN_MCLR) | (1<<PIN_CLK) | (1<< PIN_DATA);
|
||||
|
||||
//Alle Spalten erstmal aus
|
||||
COLPORT1 = 0;
|
||||
COLPORT2 = 0;
|
||||
|
||||
//Schieberegister für Zeilen zurücksetzen
|
||||
ROWPORT = 0;
|
||||
|
||||
timer0_on();
|
||||
|
||||
//Watchdog Timer aktivieren
|
||||
wdt_reset();
|
||||
wdt_enable(0x00); // 17ms Watchdog
|
||||
}
|
||||
127
borg_hw/borg_hw_borg_ls.c
Normal file
127
borg_hw/borg_hw_borg_ls.c
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
|
||||
#include "../config.h"
|
||||
#include "../makros.h"
|
||||
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
|
||||
#include "borg_hw.h"
|
||||
|
||||
/*
|
||||
// Diese #defines werden nun durch menuconfig gesetzt
|
||||
|
||||
#define ROWPORT PORTB
|
||||
#define ROWDDR DDRB
|
||||
|
||||
#define COLPORT PORTD
|
||||
#define COLDDR DDRD
|
||||
|
||||
#define PIN_DATA PC4
|
||||
#define PIN_CLK PC6 //active low
|
||||
#define PIN_LINE_EN PC5 //active low
|
||||
|
||||
*/
|
||||
|
||||
#define COLDDR DDR(COLPORT)
|
||||
#define ROWDDR DDR(ROWPORT)
|
||||
|
||||
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
||||
|
||||
|
||||
inline void rowshow(unsigned char row, unsigned char plane){
|
||||
COLPORT |= (1<<PIN_LINE_EN);//blank display
|
||||
|
||||
ROWPORT = (ROWPORT & 0xF8) | row;
|
||||
|
||||
|
||||
unsigned char b, d, x;
|
||||
for(b=0;b<LINEBYTES;b++){
|
||||
d = pixmap[plane][row][b];
|
||||
for(x=0;x<8;x++){
|
||||
if(d & 0x01){
|
||||
COLPORT |= (1<<PIN_DATA);
|
||||
}else{
|
||||
COLPORT &= ~(1<<PIN_DATA);
|
||||
}
|
||||
d>>=1;
|
||||
COLPORT &= ~(1<<PIN_CLK);
|
||||
COLPORT |= (1<<PIN_CLK);
|
||||
}
|
||||
}
|
||||
|
||||
COLPORT &= ~(1<<PIN_LINE_EN);//unblank display
|
||||
}
|
||||
|
||||
SIGNAL(SIG_OUTPUT_COMPARE0)
|
||||
{
|
||||
static unsigned char plane = 0;
|
||||
static unsigned char row = 0;
|
||||
|
||||
if (row == 0){
|
||||
switch (plane){
|
||||
case 0:
|
||||
OCR0 = 7;
|
||||
break;
|
||||
case 1:
|
||||
OCR0 = 20;
|
||||
break;
|
||||
case 2:
|
||||
OCR0 = 40;
|
||||
}
|
||||
}
|
||||
|
||||
rowshow(row, plane);
|
||||
|
||||
if(++row == NUM_ROWS){
|
||||
row = 0;
|
||||
if(++plane==NUMPLANE) plane=0;
|
||||
}
|
||||
wdt_reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
TCCR0 = 0x08 |0x04; // CTC Mode, clk/256
|
||||
TCNT0 = 0; // reset timer
|
||||
OCR0 = 0x30; // Compare with this value
|
||||
TIMSK = 0x02; // Compare match Interrupt on
|
||||
}
|
||||
|
||||
void timer0_off(){
|
||||
cli();
|
||||
|
||||
COLPORT |= (1<<PIN_LINE_EN);//blank display
|
||||
|
||||
TCCR0 = 0x00;
|
||||
sei();
|
||||
}
|
||||
|
||||
void watchdog_enable()
|
||||
{
|
||||
wdt_reset();
|
||||
wdt_enable(0x00); // 17ms
|
||||
|
||||
}
|
||||
|
||||
void borg_hw_init(){
|
||||
COLPORT |= (1<<PIN_CLK) | (1<<PIN_LINE_EN);
|
||||
COLDDR |= (1<<PIN_CLK) | (1<<PIN_LINE_EN) | (1<<PIN_DATA);
|
||||
|
||||
ROWDDR |= 0x07;
|
||||
|
||||
watchdog_enable();
|
||||
timer0_on();
|
||||
}
|
||||
|
||||
165
borg_hw/borg_hw_borg_mini.c
Normal file
165
borg_hw/borg_hw_borg_mini.c
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
|
||||
#include "../config.h"
|
||||
|
||||
#include <avr/signal.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#include "borg_hw.h"
|
||||
|
||||
/*
|
||||
// Diese #defines werden nun durch menuconfig gesetzt
|
||||
|
||||
//An diesen Pins ist das Schieberegister
|
||||
//für die Spalten angeschlossen.
|
||||
#define COLPORT PORTC
|
||||
#define COLDDR DDRC
|
||||
#define BIT_DAT 4 //Daten-Eingang
|
||||
#define BIT_CLK 5 //Takt-Eingang
|
||||
|
||||
//An diesem Port sind die Zeilentreiber angeschlossen.
|
||||
//Ein Null-Pegel schaltet den jeweiligen Transistor an.
|
||||
#define ROWPORT1 PORTD
|
||||
#define ROWDDR1 DDRD
|
||||
|
||||
#define ROWPORT2 PORTC
|
||||
#define ROWDDR2 DDRC
|
||||
*/
|
||||
|
||||
#define COLDDR DDR(COLPORT)
|
||||
#define ROWDDR1 DDR(ROWPORT1)
|
||||
#define ROWDDR2 DDR(ROWPORT2)
|
||||
|
||||
unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES];
|
||||
|
||||
inline void rowshow(unsigned char row, unsigned char plane){
|
||||
static uint8_t rowmask = 0xFF;
|
||||
uint8_t x, tmp;
|
||||
|
||||
//alle Zeilentreiber aus
|
||||
ROWPORT1 |= 0xF3;
|
||||
ROWPORT2 |= 0x0C;
|
||||
|
||||
for(x=0;x<10;x++){
|
||||
asm volatile ("nop");
|
||||
}
|
||||
|
||||
if (row == 0){
|
||||
rowmask = 0x7F; //0111 1111
|
||||
}else{
|
||||
rowmask >>= 1;
|
||||
rowmask |= 0x80;
|
||||
}
|
||||
|
||||
switch (plane){
|
||||
case 0:
|
||||
TCNT0 = 0x100-12;
|
||||
break;
|
||||
case 1:
|
||||
TCNT0 = 0x100-20;
|
||||
break;
|
||||
case 2:
|
||||
TCNT0 = 0x100-50;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Die fünf bits für das 2. Display in das
|
||||
//Schieberegister takten
|
||||
tmp = pixmap[plane][row][0];
|
||||
for(x=0;x<3;x++){
|
||||
if(tmp & 0x20){
|
||||
COLPORT &= ~(1<<BIT_DAT);
|
||||
}else{
|
||||
COLPORT |= (1<<BIT_DAT);
|
||||
}
|
||||
tmp>>=1;
|
||||
|
||||
COLPORT |= (1<<BIT_CLK);
|
||||
COLPORT &= ~(1<<BIT_CLK);
|
||||
}
|
||||
|
||||
tmp = pixmap[plane][row][1];
|
||||
for(x=0;x<2;x++){
|
||||
if(tmp & 0x01){
|
||||
COLPORT &= ~(1<<BIT_DAT);
|
||||
}else{
|
||||
COLPORT |= (1<<BIT_DAT);
|
||||
}
|
||||
tmp>>=1;
|
||||
|
||||
COLPORT |= (1<<BIT_CLK);
|
||||
COLPORT &= ~(1<<BIT_CLK);
|
||||
}
|
||||
|
||||
|
||||
//Die restlichen 5 bit auch ins Schieberegister
|
||||
tmp = pixmap[plane][row][0];
|
||||
for(x=0;x<5;x++){
|
||||
if(tmp & 0x01){
|
||||
COLPORT &= ~(1<<BIT_DAT);
|
||||
}else{
|
||||
COLPORT |= (1<<BIT_DAT);
|
||||
}
|
||||
tmp>>=1;
|
||||
|
||||
COLPORT |= (1<<BIT_CLK);
|
||||
COLPORT &= ~(1<<BIT_CLK);
|
||||
}
|
||||
//nächste Zeile anschalten
|
||||
ROWPORT1 &= rowmask | 0x0C;
|
||||
ROWPORT2 &= rowmask | 0xF3;
|
||||
}
|
||||
|
||||
extern uint8_t schmuh;
|
||||
|
||||
ISR(SIG_OVERFLOW0)
|
||||
{
|
||||
static unsigned char plane = 0;
|
||||
static unsigned char row = 0;
|
||||
|
||||
rowshow(row, plane);
|
||||
|
||||
if(++row == NUM_ROWS){
|
||||
row = 0;
|
||||
if(++plane==NUMPLANE) plane=0;
|
||||
}
|
||||
|
||||
schmuh = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
*/
|
||||
TCCR0 = 0x03; // clk/64
|
||||
TCNT0 = 0xFF-20;// reset timer
|
||||
TIMSK |= (1<<TOIE0);
|
||||
}
|
||||
|
||||
|
||||
void borg_hw_init(){
|
||||
// Alle Zeilentransistoren aus.
|
||||
ROWPORT1 |= 0xF3;
|
||||
// Port für Zeilentransistoren auf Ausgang
|
||||
ROWDDR1 |= 0xF3;
|
||||
|
||||
ROWPORT2 |=0x0C;
|
||||
ROWDDR2 |=0x0C;
|
||||
|
||||
|
||||
//Signale für Schieberegister auf Ausgang
|
||||
COLDDR |= (1<<BIT_CLK) | (1<<BIT_DAT);
|
||||
COLPORT &= ~(1<<BIT_CLK);
|
||||
|
||||
timer0_on();
|
||||
}
|
||||
50
borg_hw/config.in
Normal file
50
borg_hw/config.in
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
###################### Borg Hardware Menu #####################################
|
||||
mainmenu_option next_comment
|
||||
comment "Borg Hardware"
|
||||
|
||||
int "Number of rows " NUM_ROWS 16
|
||||
int "Number of columns" NUM_COLS 16
|
||||
int "Number of brightnes-levels" NUMPLANE 3
|
||||
|
||||
|
||||
|
||||
choice 'Hardware Driver' \
|
||||
"Borg-16 HW_BORG_16 \
|
||||
Andre-borg HW_BORG_ANDRE \
|
||||
Laufschrift-borg HW_BORG_LS \
|
||||
Borg-mini HW_BORG_MINI" \
|
||||
'Borg-16' BORG_HW
|
||||
|
||||
|
||||
if [ "$BORG_HW" == "HW_BORG_16" ] ; then
|
||||
source borg_hw/config_borg16.in
|
||||
fi
|
||||
|
||||
if [ "$BORG_HW" == "HW_BORG_ANDRE" ] ; then
|
||||
source borg_hw/config_andreborg.in
|
||||
fi
|
||||
|
||||
if [ "$BORG_HW" == "HW_BORG_LS" ] ; then
|
||||
source borg_hw/config_borg_ls.in
|
||||
fi
|
||||
|
||||
if [ "$BORG_HW" == "HW_BORG_MINI" ] ; then
|
||||
source borg_hw/config_borg_mini.in
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# case $x in
|
||||
# y) flag="*" ;;
|
||||
# m) flag="M" ;;
|
||||
# *) flag=" " ;;
|
||||
# esac
|
||||
|
||||
|
||||
|
||||
|
||||
endmenu
|
||||
|
||||
|
||||
###############################################################################
|
||||
71
borg_hw/config_andreborg.in
Normal file
71
borg_hw/config_andreborg.in
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
mainmenu_option next_comment
|
||||
comment "Andreborg port setup"
|
||||
|
||||
choice 'Column Port 1 (right)' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTA' COLPORT1
|
||||
|
||||
choice 'Column Port 2 (left)' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTC' COLPORT2
|
||||
|
||||
choice 'port for row shiftregisters' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTD' ROWPORT
|
||||
|
||||
comment "pin numbers on shiftregister port"
|
||||
|
||||
choice '/MCLR Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin4' PIN_MCLR
|
||||
|
||||
choice 'CLK Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin5' PIN_CLK
|
||||
|
||||
choice 'DATA1 Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin6' PIN_DATA1
|
||||
|
||||
choice 'DATA2 Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin7' PIN_DATA2
|
||||
|
||||
endmenu
|
||||
77
borg_hw/config_borg16.in
Normal file
77
borg_hw/config_borg16.in
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
mainmenu_option next_comment
|
||||
comment "Borg16 port setup"
|
||||
|
||||
#define COLPORT1 PORTC
|
||||
#define COLDDR1 DDRC
|
||||
|
||||
#define COLPORT2 PORTA
|
||||
#define COLDDR2 DDRA
|
||||
|
||||
#// Der andere Port übernimmt die Steuerung der Schieberegister
|
||||
#define ROWPORT PORTD
|
||||
#define ROWDDR DDRD
|
||||
#// Clock und reset gehen gemeinsam an beide Schieberegister
|
||||
#// der reset pin ist negiert
|
||||
#define PIN_RST PD4
|
||||
#define PIN_CLK PD6
|
||||
#//das dier sind die individuellen Dateneingänge für die Schieberegister
|
||||
#define PIN_SHFT1 PD7
|
||||
|
||||
|
||||
choice 'Column Port 1 (right)' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTC' COLPORT1
|
||||
|
||||
choice 'Column Port 2 (left)' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTA' COLPORT2
|
||||
|
||||
choice 'port for row shiftregisters' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTD' ROWPORT
|
||||
|
||||
comment "pin numbers on shiftregister port"
|
||||
|
||||
choice '/MCLR Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin4' PIN_MCLR
|
||||
|
||||
choice 'CLK Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin6' PIN_CLK
|
||||
|
||||
choice 'DATA Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin7' PIN_DATA
|
||||
|
||||
endmenu
|
||||
55
borg_hw/config_borg_ls.in
Normal file
55
borg_hw/config_borg_ls.in
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
mainmenu_option next_comment
|
||||
comment "Laufschrift-Borg port setup"
|
||||
|
||||
|
||||
choice 'port for row select' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTB' ROWPORT
|
||||
|
||||
|
||||
choice 'Column shiftregister Port' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTD' COLPORT
|
||||
|
||||
comment "pin numbers on shiftregister port"
|
||||
|
||||
choice 'CLK Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin6' PIN_CLK
|
||||
|
||||
choice 'DATA Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin4' PIN_DATA
|
||||
|
||||
choice 'LINE_EN Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin5' PIN_LINE_EN
|
||||
|
||||
endmenu
|
||||
50
borg_hw/config_borg_mini.in
Normal file
50
borg_hw/config_borg_mini.in
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
mainmenu_option next_comment
|
||||
comment "Borg-mini port setup"
|
||||
|
||||
|
||||
choice 'Row Port 1' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTD' ROWPORT1
|
||||
|
||||
choice 'Row Port 2' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTC' ROWPORT2
|
||||
|
||||
choice 'Column shiftregister Port' \
|
||||
"PORTA PORTA \
|
||||
PORTB PORTB \
|
||||
PORTC PORTC \
|
||||
PORTD PORTD" \
|
||||
'PORTC' COLPORT
|
||||
|
||||
comment "pin numbers on shiftregister port"
|
||||
|
||||
choice 'CLK Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin5' PIN_CLK
|
||||
|
||||
choice 'DATA Pin' \
|
||||
"Pin0 0 \
|
||||
Pin1 1 \
|
||||
Pin2 2 \
|
||||
Pin3 3 \
|
||||
Pin4 4 \
|
||||
Pin5 5 \
|
||||
Pin6 6 \
|
||||
Pin7 7" \
|
||||
'Pin4' PIN_DATA
|
||||
|
||||
endmenu
|
||||
Loading…
Add table
Add a link
Reference in a new issue