|
|
@ -7,11 +7,13 @@ |
|
|
|
|
|
|
|
#define HEIGHT 12 |
|
|
|
#define LINE_DISTANCE 4 |
|
|
|
#define SIN_LENGTH 16 |
|
|
|
#define SIN_LENGTH 18 |
|
|
|
#define SIN_MAX 6 |
|
|
|
|
|
|
|
// uint8_t sin[SIN_LENGTH] = {0, 1, 2, 2, 3, 3, 4, 4, 4, 3, 3, 3, 2, 2, 1, 0};
|
|
|
|
|
|
|
|
uint8_t sintab[SIN_LENGTH] = { |
|
|
|
0, |
|
|
|
1, |
|
|
|
2, |
|
|
|
3, |
|
|
@ -28,44 +30,29 @@ uint8_t sintab[SIN_LENGTH] = { |
|
|
|
4, |
|
|
|
3, |
|
|
|
2, |
|
|
|
1, |
|
|
|
}; |
|
|
|
|
|
|
|
/*
|
|
|
|
uint8_t sintab[SIN_LENGTH] = { |
|
|
|
1, |
|
|
|
1, |
|
|
|
2, |
|
|
|
2, |
|
|
|
3, |
|
|
|
3, |
|
|
|
4, |
|
|
|
4, |
|
|
|
5, |
|
|
|
5, |
|
|
|
5, |
|
|
|
5, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
6, |
|
|
|
5, |
|
|
|
5, |
|
|
|
5, |
|
|
|
5, |
|
|
|
4, |
|
|
|
4, |
|
|
|
3, |
|
|
|
3, |
|
|
|
2, |
|
|
|
2, |
|
|
|
1, |
|
|
|
}; |
|
|
|
*/ |
|
|
|
|
|
|
|
/**
|
|
|
|
* Shifts the Pixmap one px right |
|
|
|
*/ |
|
|
|
static void move(){ |
|
|
|
unsigned char plane, row, byte; |
|
|
|
|
|
|
|
for(plane=0; plane<NUMPLANE; plane++){ |
|
|
|
for(row=NUM_ROWS; row--;){ |
|
|
|
for(byte=0; byte < LINEBYTES; byte++){ |
|
|
|
pixmap[plane][row][byte] = pixmap[plane][row][byte] >> 1; |
|
|
|
if(byte < LINEBYTES-1){ |
|
|
|
pixmap[plane][row][byte] = |
|
|
|
pixmap[plane][row][byte] | |
|
|
|
(pixmap[plane][row][byte+1] & 0x01) << 7; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void dna(){ |
|
|
|
uint8_t mid = NUM_COLS / 2; |
|
|
@ -89,24 +76,24 @@ void dna(){ |
|
|
|
top = mid - sintab[sinpos]; |
|
|
|
bottom = mid + sintab[sinpos]; |
|
|
|
|
|
|
|
setpixel((pixel){15,top}, top_color); |
|
|
|
setpixel((pixel){15,bottom}, bottom_color); |
|
|
|
setpixel((pixel){NUM_COLS-1,top}, top_color); |
|
|
|
setpixel((pixel){NUM_COLS-1,bottom}, bottom_color); |
|
|
|
|
|
|
|
if(draw_line == 0){ |
|
|
|
for(uint8_t linex = top+1; linex < bottom; linex++){ |
|
|
|
setpixel((pixel){15, linex}, 1); |
|
|
|
setpixel((pixel){NUM_COLS-1, linex}, 1); |
|
|
|
} |
|
|
|
setpixel((pixel){15, mid}, 1); |
|
|
|
setpixel((pixel){NUM_COLS-1, mid}, 1); |
|
|
|
} |
|
|
|
|
|
|
|
if(draw_line == 0){ |
|
|
|
if(top <= 0){ |
|
|
|
if(sinpos == 0){ |
|
|
|
if(mid-SIN_MAX <= 0){ |
|
|
|
direction = 1; |
|
|
|
} |
|
|
|
if(bottom >= NUM_ROWS-1){ |
|
|
|
if(mid+SIN_MAX >= NUM_ROWS-1){ |
|
|
|
direction = -1; |
|
|
|
} |
|
|
|
mid = mid + (random8() > 240) * direction; |
|
|
|
mid = mid + (random8() > 200) * direction; |
|
|
|
} |
|
|
|
|
|
|
|
draw_line = (draw_line+1) % LINE_DISTANCE; |
|
|
@ -125,22 +112,3 @@ void dna(){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
|
* Shifts the Pixmap one px right |
|
|
|
*/ |
|
|
|
void move(){ |
|
|
|
unsigned char plane, row, byte; |
|
|
|
|
|
|
|
for(plane=0; plane<NUMPLANE; plane++){ |
|
|
|
for(row=NUM_ROWS; row--;){ |
|
|
|
for(byte=0; byte < LINEBYTES; byte++){ |
|
|
|
pixmap[plane][row][byte] = pixmap[plane][row][byte] >> 1; |
|
|
|
if(byte < LINEBYTES-1){ |
|
|
|
pixmap[plane][row][byte] = |
|
|
|
pixmap[plane][row][byte] | |
|
|
|
(pixmap[plane][row][byte+1] & 0b00000001) << 7; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|