From 86d4afe23e7b6752b1e07ac740f3c7a7636c4162 Mon Sep 17 00:00:00 2001 From: Martin Herweg Date: Wed, 18 Feb 2009 22:26:46 +0000 Subject: [PATCH] my first commit --- Makefile | 4 +- animations/programm.c | 168 ++++++++++++++++++++++++++++++++++++-- borg_hw/Makefile | 4 +- borg_hw/borg_hw_borg_mh.c | 150 ++++++++++++++++++++++++++++++++++ borg_hw/config.in | 8 +- borg_hw/config_borg_mh.in | 45 ++++++++++ display_loop.c | 26 ++++-- main.c | 2 +- pixel.c | 77 +++++++++++++++++ pixel.h | 11 +++ scrolltext/config.in | 4 +- scrolltext/scrolltext3.c | 2 +- 12 files changed, 479 insertions(+), 22 deletions(-) create mode 100644 borg_hw/borg_hw_borg_mh.c create mode 100644 borg_hw/config_borg_mh.in diff --git a/Makefile b/Makefile index 07e5898..0bd7609 100644 --- a/Makefile +++ b/Makefile @@ -165,8 +165,10 @@ sflash: $(TARGET).hex 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 -.PHONY: clean mrproper sflash +.PHONY: clean mrproper sflash uflash ############################################################################## # configure ethersex # diff --git a/animations/programm.c b/animations/programm.c index 877e54d..f38a6f2 100644 --- a/animations/programm.c +++ b/animations/programm.c @@ -9,6 +9,7 @@ #ifdef ANIMATION_TESTS void test1(){ unsigned char x,y; + for (y=0;y +#include +#include + +#include "borg_hw.h" + + +#define ROWPORT PORTC +#define ROWDDR DDRC + +#define COLPORT PORTA +#define COLDDR DDRA + +#define MYPORT PORTC +#define MYPORT2 PORTA + +#define SHOW 0 +#define DATA 1 + +#define PIN_ENABLE 0 +#define PIN_DATA 1 + +unsigned char pixmap[NUMPLANE][NUM_ROWS][LINEBYTES]; + + +inline void rowshow(unsigned char row, unsigned char plane){ + + unsigned char p, n,m, outb, clkmsk; + + clkmsk = 0x80>>row; + + // if (row==4) + { + MYPORT &= ~(1 << PIN_ENABLE) ; + //MYPORT |= (1 << PIN_ENABLE) ; //hide + // MYPORT |= (1 << PIN_ENABLE) ; //hide + for (n=7;n<8;n--) + { + outb = pixmap[plane][row][n]; + p=0x80; + for (m=0;m<8;m++) + { + if (outb & p) + // MYPORT |= (1 << PIN_DATA); + MYPORT &= ~(1 << PIN_DATA) ; + else + // MYPORT &= ~(1 << PIN_DATA) ; //off + MYPORT |= (1 << PIN_DATA); + + MYPORT2 &= ~clkmsk ; + MYPORT2 |= clkmsk ; + + p>>=1; + + } + } + } + MYPORT |= (1 << PIN_ENABLE) ; // + //MYPORT &= ~(1 << PIN_ENABLE) ; + // for(n=0;n<250;n++) asm ("nop"); + + +} + +SIGNAL(SIG_OUTPUT_COMPARE0) +{ + static unsigned char plane = 0; + unsigned char row = 0; + + switch (plane){ + case 0: + OCR0 = 30; + break; + case 1: + OCR0 = 60; + break; + case 2: + OCR0 = 80; + break; + // case 3: + // OCR0 = 24; + // break; + // case 4: + // OCR0 = 48; + // break; + } + + for(row=0;row dy ) + { + fraction = dy - (dx >> 1); + while ( p1.x != p2.x ) + { + if ( fraction >= 0 ) + { + p1.y += stepy; + fraction -= dx; + } + p1.x += stepx; + fraction += dy; + setpixel(p1 , value ); + } + } + else + { + fraction = dx - (dy >> 1); + while ( p1.y != p2.y ) + { + if ( fraction >= 0 ) + { + p1.x += stepx; + fraction -= dy; + } + p1.y += stepy; + fraction += dx; + setpixel(p1 , value ); + + } + } +} + + +void filled_rectangle(pixel p1, unsigned char w, unsigned char h ,unsigned char value){ + +unsigned char y; + +for (y=p1.y;y<=(p1.y+h);y++){ + line((pixel){p1.x,y}, (pixel){(p1.x+w),y} ,value); + + } + +} + + //shifts pixmap left. It is really shifted right, but because col0 is left in the Display it's left. void shift_pixmap_l(){ unsigned char plane, row, byte; diff --git a/pixel.h b/pixel.h index a149d43..1f69a36 100644 --- a/pixel.h +++ b/pixel.h @@ -26,6 +26,17 @@ void clear_screen(unsigned char value); void setpixel(pixel p, unsigned char value); #define clearpixel(p) setpixel(p, 0); +// straight or non straight line from one point to the other +// value=brightness +void line(pixel p1, pixel p2 ,unsigned char value); + +// filled_rectangle p1=upper right corner, w=width, h=height , +// value=brightness +void filled_rectangle(pixel p1, unsigned char w, unsigned char h ,unsigned char value); + + + + unsigned char get_pixel(pixel p); unsigned char get_next_pixel(pixel p, direction dir); diff --git a/scrolltext/config.in b/scrolltext/config.in index 70e1225..912d771 100644 --- a/scrolltext/config.in +++ b/scrolltext/config.in @@ -2,9 +2,9 @@ dep_bool_menu "Scrolltext Support" SCROLLTEXT_SUPPORT y choice 'Scrolltext Font' \ - 'Arial_8 font_arial8 \ + "Arial_8 font_arial8 \ Small_6 font_small6 \ - Uni_53 font_uni53' \ + Uni_53 font_uni53" \ 'Arial_8' SCROLLTEXT_FONT int "Scrolltest buffer size" SCROLLTEXT_BUFFER_SIZE 128 diff --git a/scrolltext/scrolltext3.c b/scrolltext/scrolltext3.c index c7e9608..062cbd9 100644 --- a/scrolltext/scrolltext3.c +++ b/scrolltext/scrolltext3.c @@ -14,7 +14,7 @@ #include "font_small6.h" #include "font_uni53.h" -#define MAX_FONTS 1 +#define MAX_FONTS 3 font fonts[MAX_FONTS]; #define MAX_SPECIALCOLORS 3