Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cleanup

  • Loading branch information...
commit 1be9ba4334240bd05aa6ce5cb7bef8e7a50f9257 1 parent 2da0fa9
@sebseb7 authored
View
4 firmware/Makefile
@@ -33,7 +33,7 @@ OPT = s
##########################################################################################################
# List C source files here. (C dependencies are automatically generated.)
-SRC = main.c libs/font.c apps/cccdd.c apps/battery.c apps/scroll2.c apps/plasma_seb.c apps/helix.c apps/random.c apps/scroll.c apps/ball.c apps/snake.c apps/strobe.c apps/replicate.c
+SRC = main.c libs/font.c apps/cccdd.c apps/battery.c apps/scroll.c apps/plasma.c apps/helix.c apps/ball.c apps/snake.c apps/strobe.c apps/replicate.c
#SRC = main.c libs/font.c apps/cccdd.c
##########################################################################################################
@@ -147,7 +147,7 @@ AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep
AVRDUDE_FLAGS = -p $(MCU) -F -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -v -v
#AVRDUDE_UFLAGS = -p atmega88 -F -P /dev/ttyUSB0 -c avr109 -b 38400 -v -v
#AVRDUDE_UFLAGS = -p $(MCU) -P /dev/cu.usbserial-A2002QDi -c avr109 -b 230400 -v -v
-AVRDUDE_UFLAGS = -p $(MCU) -F -P /dev/cu.usbserial-A2002QDi -c avr109 -b 38400 -v -v
+AVRDUDE_UFLAGS = -p $(MCU) -F -P /dev/cu.usbserial-A4016EMT -c avr109 -b 38400 -v -v
#AVRDUDE_UFLAGS = -p $(MCU) -F -P /dev/ttyUSB0 -c avr109 -b 38400 -v -v
#AVRDUDE_FLAGS = -p $(MCU) -c $(AVRDUDE_PROGRAMMER)
View
8 firmware/apps/ball.c
@@ -2,21 +2,21 @@
#include <main.h>
-void init_ball(void) ATTRIBUTES;
+static void init_ball(void) ATTRIBUTES;
static uint8_t tick_ball(void);
// an extension to the bouncing box
#define BOFF -1
-int8_t x = 2, y = 2;
-int8_t dx = 1, dy = 1;
+static int8_t x = 2, y = 2;
+static int8_t dx = 1, dy = 1;
void init_ball(void) {
registerAnimation(tick_ball, 5, 140);
}
-uint8_t tick_ball() {
+static uint8_t tick_ball() {
// bounce
if(x == BOFF || x == LED_WIDTH - BOFF - 1) {
View
4 firmware/apps/battery.c
@@ -16,7 +16,7 @@ static const uint8_t text_len2 = 6;
static uint16_t pos2 = 0;
-static uint8_t tick2(void) {
+static uint8_t tick(void) {
uint8_t x, y;
if(pos2==0)
@@ -68,7 +68,7 @@ static uint8_t tick2(void) {
void init_scroll2(void) {
- registerAnimation(tick2, 16, (text_len2-1) * 4);
+ registerAnimation(tick, 16, (text_len2-1) * 4);
}
View
54 firmware/apps/plasma.c
@@ -1,6 +1,6 @@
+#include <stdlib.h>
#include <main.h>
-void init_plasma(void) ATTRIBUTES;
static int16_t sini(uint8_t x) {
static int16_t table[] = {
@@ -14,49 +14,45 @@ static int16_t sini(uint8_t x) {
}
static int16_t cosi(uint8_t x) { return sini(x + 32); }
-static uint8_t sqrti(uint8_t x) {
- static const uint8_t table[32] = {
- 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 5, 5, 5, 5, 5, 5, 5 };
- return table[x];
-}
-
-uint8_t tick(void);
-
-int v1 = 0;
-int v2 = 0;
-uint8_t tick() {
+static uint8_t tick() {
+ static int _a = 0;
+ static int b = 0;
+ static uint8_t init = 0;
- v1 += 3;
- v2 += 5;
+ if(init == 0) {
+ _a = rand();
+ b = rand();
+ init = 1;
+ }
- int rx = (cosi(v1 >> 2) >> 5) + 2;
- int ry = (sini(v2 >> 2) >> 5) + 2;
+ int a = _a >> 1;
- int x, y;
+ uint8_t x, y;
for(y = 0; y < LED_HEIGHT; y++) {
for(x = 0; x < LED_WIDTH; x++) {
- int dx = x - rx;
- int dy = y - ry;
- int d = sqrti(dx * dx + dy * dy);
+// uint16_t c = 5*sini(x*2+sini(a)) + 8*cosi(y*3+a+120) + 3*sini(b/2);
+ //uint16_t d = 2*sini(x*2-b);// + 3*cosi(y*3-cosi(a));// + 3*sini(a/4);//+ c;
+ uint16_t d = 2*cosi(x*4-cosi(a/2))+ 3*cosi(y*3-cosi(a));// + 3*sini(a/4);//+ c;
- int q = ( (sini(x * 8 + (v1)) +
- sini(y * 8 + (v2)) +
- sini(d << 5)) >> 2) + 128;
+// uint8_t col = (((cosi(d>>4)>>5))+(d>>6))&15;
+ uint8_t col = ((d>>5))&15;
+
+ if(col > 7) col = 15 - col;
- int a = (q * 0xffff / 0x10000) >> 6;
- setLedXY(x, y, a);
+ setLedXY(x, y, col);
}
}
+ _a--;
+ b = a;
return 0;
}
-
-void init_plasma(void) {
- registerAnimation(tick, 2,40);
+static void init(void) ATTRIBUTES;
+void init(void) {
+ registerAnimation(tick, 6, 150);
}
View
59 firmware/apps/plasma_seb.c
@@ -1,59 +0,0 @@
-#include <stdlib.h>
-#include <main.h>
-
-
-static int16_t sini(uint8_t x) {
- static int16_t table[] = {
- 0, 6, 13, 19, 25, 31, 37, 43, 49, 55, 60, 66, 71, 76, 81, 86, 91, 95, 99,
- 103, 106, 110, 113, 116, 118, 121, 122, 124, 126, 127, 127, 128, 128 };
- x = x & 127;
- uint8_t i = x & 31;
- int16_t ret = (x & 32) ? table[32 - i] : table[i];
- if(x & 64) ret = -ret;
- return ret;
-}
-static int16_t cosi(uint8_t x) { return sini(x + 32); }
-
-
-static uint8_t tick() {
- static int _a = 0;
- static int b = 0;
- static uint8_t init = 0;
-
- if(init == 0) {
- _a = rand();
- b = rand();
- init = 1;
- }
-
- int a = _a >> 1;
-
- uint8_t x, y;
- for(y = 0; y < LED_HEIGHT; y++) {
- for(x = 0; x < LED_WIDTH; x++) {
-
-// uint16_t c = 5*sini(x*2+sini(a)) + 8*cosi(y*3+a+120) + 3*sini(b/2);
- //uint16_t d = 2*sini(x*2-b);// + 3*cosi(y*3-cosi(a));// + 3*sini(a/4);//+ c;
- uint16_t d = 2*cosi(x*4-cosi(a/2))+ 3*cosi(y*3-cosi(a));// + 3*sini(a/4);//+ c;
-
-// uint8_t col = (((cosi(d>>4)>>5))+(d>>6))&15;
- uint8_t col = ((d>>5))&15;
-
- if(col > 7) col = 15 - col;
-
- setLedXY(x, y, col);
- }
- }
- _a--;
- b = a;
- return 0;
-
-}
-
-static void init(void) ATTRIBUTES;
-void init(void) {
- registerAnimation(tick, 6, 150);
-}
-
-
-
View
27 firmware/apps/scroll.c
@@ -7,29 +7,28 @@
#include "../libs/font.h"
-void init_scroll(void) ATTRIBUTES;
+void init_scroll2(void) ATTRIBUTES;
#ifdef __AVR__
-char text[] PROGMEM =" LEONA ";
-const uint8_t text_len = 7;
+char text2[] PROGMEM =" the Transistor ";
#else
-char text[] =" CLOUDY MIT AUSSICHT AUF DATENSPUREN ";
-const uint8_t text_len = 37;
+char text2[] =" the Transistor ";
#endif
+const uint8_t text_len2 = 16;
-uint16_t pos = 0;
+uint16_t pos2 = 0;
-static uint8_t tick(void) {
+static uint8_t tick2(void) {
uint8_t x, y;
for(x = 0; x < LED_WIDTH; x++) {
- uint16_t p = pos + x;
+ uint16_t p = pos2 + x;
#ifdef __AVR__
- char c = pgm_read_byte(&text[p / 4]);
+ char c = pgm_read_byte(&text2[p / 4]);
#else
- char c = text[p / 4];
+ char c = text2[p / 4];
#endif
uint8_t bits = 0;
#ifdef __AVR__
@@ -43,15 +42,15 @@ static uint8_t tick(void) {
bits >>= 1;
}
}
- pos++;
- if(pos + LED_WIDTH == text_len * 4) pos = 0;
+ pos2++;
+ if(pos2 + LED_WIDTH == text_len2 * 4) pos2 = 0;
return 0;
}
-void init_scroll(void) {
- registerAnimation(tick, 16, (text_len-1) * 4);
+void init_scroll2(void) {
+ registerAnimation(tick2, 16, (text_len2-1) * 4);
}
View
56 firmware/apps/scroll2.c
@@ -1,56 +0,0 @@
-#include <main.h>
-
-#ifdef __AVR__
-#include <avr/pgmspace.h>
-#endif
-
-#include "../libs/font.h"
-
-
-void init_scroll2(void) ATTRIBUTES;
-
-
-#ifdef __AVR__
-char text2[] PROGMEM =" Pentalight ";
-#else
-char text2[] =" Pentalight ";
-#endif
-
-const uint8_t text_len2 = 12;
-
-uint16_t pos2 = 0;
-
-static uint8_t tick2(void) {
- uint8_t x, y;
-
- for(x = 0; x < LED_WIDTH; x++) {
- uint16_t p = pos2 + x;
-#ifdef __AVR__
- char c = pgm_read_byte(&text2[p / 4]);
-#else
- char c = text2[p / 4];
-#endif
- uint8_t bits = 0;
-#ifdef __AVR__
- if((p & 3) < 3) bits = pgm_read_byte(&font[c - 32][p & 3]);
-#else
- if((p & 3) < 3) bits = font[c - 32][p & 3];
-#endif
-
- for(y = 0; y < LED_HEIGHT; y++) {
- setLedXY(x, y, 7 * (bits & 1));
- bits >>= 1;
- }
- }
- pos2++;
- if(pos2 + LED_WIDTH == text_len2 * 4) pos2 = 0;
-
- return 0;
-}
-
-
-void init_scroll2(void) {
- registerAnimation(tick2, 16, (text_len2-1) * 4);
-}
-
-
View
25 firmware/apps/test.c
@@ -1,25 +0,0 @@
-#include <main.h>
-
-static uint8_t tick() {
-
- static int8_t m = 0;
- static int8_t d = 1;
-
- int8_t x;
- // clear
- for(x = 0; x < LED_WIDTH * LED_HEIGHT; x++) setLedXY(x & 3, x >> 2, 0); // < looks nice, but does not work when LED_WIDTH/HEIGHT changes
-
- m += d;
- if(m < 1 || m == LED_HEIGHT - 1) d = -d;
-
- // draw row
- for(x = 0; x < LED_WIDTH; x++) setLedXY(x, m, 7);
-
- return 0;
-}
-
-static void init(void) ATTRIBUTES;
-void init(void) {
- registerAnimation(tick, 16, 40);
-}
-
Please sign in to comment.
Something went wrong with that request. Please try again.