Browse Source

Implemented own font in CubeFirmware.

Also removed CubeControl CLI, thus no longer having 100% CPU Usage.
Thomas Buck 7 years ago
parent
commit
b3b5b35dc7
7 changed files with 1365 additions and 1577 deletions
  1. 0
    22
      AudioFirmware/eq.c
  2. 36
    43
      AudioFirmware/main.hex
  3. 3
    2
      CubeControl/Frame.java
  4. 8
    1
      CubeFirmware/cube.c
  5. 99
    100
      CubeFirmware/font.c
  6. 1212
    1308
      CubeFirmware/main.hex
  7. 7
    101
      CubeFirmware/visualizer.c

+ 0
- 22
AudioFirmware/eq.c View File

@@ -44,8 +44,6 @@ uint8_t result[7] = {128, 128, 128, 128, 128, 128, 128};
44 44
 void equalizerInit(void);
45 45
 uint8_t *equalizerGet(void);
46 46
 void calcMultiplicator(uint8_t *d);
47
-void heightenTreble(uint8_t *d);
48
-void filterNoise(uint8_t *data);
49 47
 uint8_t getOffset(void);
50 48
 
51 49
 void equalizerInit(void) {
@@ -70,14 +68,7 @@ uint8_t *equalizerGet(void) {
70 68
 	}
71 69
 
72 70
 	RESETON;
73
-	asm volatile ("nop"); // Ensure minimal reset pulse width
74
-	asm volatile ("nop"); // 2 NOPs at 16MHz are enough...
75
-
76
-	filterNoise(result); // Filter lower values
77
-	heightenTreble(result); // Heighten higher frequencies, cause they seem damped
78 71
 	calcMultiplicator(result); // Multiply with Poti Position
79
-	filterNoise(result); // Filter lower values
80
-
81 72
 	return result;
82 73
 }
83 74
 
@@ -99,19 +90,6 @@ void calcMultiplicator(uint8_t *d) {
99 90
 	}
100 91
 }
101 92
 
102
-void heightenTreble(uint8_t *d) {
103
-	d[6] = d[5] * 10 / 15; // Get practically nothing on this channel. So fake something...
104
-}
105
-
106
-void filterNoise(uint8_t *data) {
107
-	uint8_t i;
108
-	for (i = 0; i < 7; i++) {
109
-		if (data[i] < 30) {
110
-			data[i] = data[i] * 10 / 15; // / 1.5
111
-		}
112
-	}
113
-}
114
-
115 93
 uint8_t getOffset(void) {
116 94
 	adcStartConversion(0x01);
117 95
 	return adcGetByte();

+ 36
- 43
AudioFirmware/main.hex View File

@@ -1,54 +1,47 @@
1 1
 :1000000012C02CC02BC02AC029C028C027C026C0BF
2 2
 :1000100025C024C023C022C021C020C01FC01EC0D4
3
-:100020001DC0F3C01BC011241FBECFE5D4E0DEBF4E
4
-:10003000CDBF10E0A0E6B0E0E0E4F3E002C0059040
3
+:100020001DC0C7C01BC011241FBECFE5D4E0DEBF7A
4
+:10003000CDBF10E0A0E6B0E0E2ECF2E002C0059037
5 5
 :100040000D92AE36B107D9F710E0AEE6B0E001C0D0
6
-:100050001D92A037B107E1F702D070C1D1CFCF9385
6
+:100050001D92A037B107E1F702D031C1D1CFCF93C4
7 7
 :1000600014BE88E10FB6F89481BD11BC0FBE86E0C6
8
-:1000700087BB8CE084BB11BA82E41BD12ED03DD06B
8
+:1000700087BB8CE084BB11BA82E4EFD02ED03DD098
9 9
 :1000800078942DE088E190E00FB6F894A89581BDB2
10
-:100090000FBE21BD80E690E015D1C4E021D18823B8
11
-:1000A00029F088B38C2788BB80D00CD1A895F6CFD7
10
+:100090000FBE21BD80E690E0E9D0C4E0F5D0882312
11
+:1000A00029F088B38C2788BB5FD0E0D0A895F6CF25
12 12
 :1000B00097B1907F97B997B18F70892B87B9369A8E
13 13
 :1000C000089581E0369980E00895FBDF8823E9F305
14 14
 :1000D000369824B135B1C901089517B83E9A86B152
15 15
 :1000E000856086B9379A80E0E3DFEFDF0895EDDFC2
16 16
 :1000F00096958795969587950895AB9AAA980895B1
17
-:10010000FC0195818AE0989FC00111246FE070E0A6
18
-:1001100002D166830895CF93E82FF92F40E0CAE01B
19
-:100120002FE030E080818E3130F48C9FC0011124AB
20
-:10013000B901F1D060834F5F3196473099F7CF9185
21
-:10014000089581E0B5DFD3DF08950F931F93CF9318
22
-:10015000DF93D82FC92FF5DF90E08C599F4F6AE0CD
23
-:1001600070E0C5D09B01CE01E92FF82F10E0CAE066
24
-:10017000D0E00FEF408150E0249FC001259F900DFB
25
-:10018000349F900D1124BE01B2D06F3F710519F05C
26
-:1001900010F0008301C060831F5F3196173051F764
27
-:1001A000DF91CF911F910F910895CF93DF93AB987B
28
-:1001B0008FE191E00197F1F700C00000C0E6D0E0C8
29
-:1001C000AA9A95E69A95F1F70000AA9880EC8A958C
30
-:1001D000F1F780E06DDF8BDF899390E0C736D907B8
31
-:1001E00079F7AB9A00000000CE01079794DFCE01AB
32
-:1001F000079786DFCE010797A8DFCE0107978BDF31
33
-:10020000CE010797DF91CF9108951F920F920FB6FD
34
-:100210000F9211248F939F93EF93FF9381B190E0FE
35
-:10022000887F883B9105C1F0893B91053CF4883A71
36
-:10023000910559F0803B910581F507C0803C9105FF
37
-:1002400031F1883C910549F522C081E080936F002F
38
-:100250008091670083B915C080916F00863040F0AF
39
-:1002600010926F0080916D0083B986B78F7B11C0AB
40
-:10027000E82FF0E0E959FF4F908193B98F5F8093A9
41
-:100280006F0086B7806486BF10926E0006C086B786
42
-:10029000806486BF81E080936E0086B7806886BFE9
43
-:1002A000FF91EF919F918F910F900FBE0F901F9034
44
-:1002B0001895882311F481E001C08E7F82B985E40E
45
-:1002C00086BF0895282F392FD901E7E6F0E08D91F8
46
-:1002D000819380E0EE36F807D1F710926E00089512
47
-:1002E00081E090916E00992309F480E00895AA1BA3
48
-:1002F000BB1B51E107C0AA1FBB1FA617B70710F011
49
-:10030000A61BB70B881F991F5A95A9F78095909542
50
-:10031000BC01CD01089597FB092E07260AD077FD71
51
-:1003200004D0E5DF06D000201AF4709561957F4F68
52
-:100330000895F6F7909581959F4F0895F894FFCF13
53
-:0E034000808080808080804242424242424261
17
+:1001000081E0D6DFF4DF08950F931F93CF93DF9341
18
+:10011000D82FC92FF5DF90E08C599F4F6AE070E02F
19
+:10012000BAD09B01CE01E92FF82F10E0CAE0D0E051
20
+:100130000FEF408150E0249FC001259F900D349F18
21
+:10014000900D1124BE01A7D06F3F710519F010F07A
22
+:10015000008301C060831F5F3196173051F7DF9134
23
+:10016000CF911F910F910895CF93DF93AB988FE1BB
24
+:1001700091E00197F1F700C00000C0E6D0E0AA9A34
25
+:1001800095E69A95F1F70000AA9880EC8A95F1F728
26
+:1001900080E08EDFACDF899390E0C736D90779F72E
27
+:1001A000AB9ACE010797B0DFCE010797DF91CF91D1
28
+:1001B00008951F920F920FB60F9211248F939F9361
29
+:1001C000EF93FF9381B190E0887F883B9105C1F068
30
+:1001D000893B91053CF4883A910559F0803B9105A3
31
+:1001E00081F507C0803C910531F1883C910549F5C6
32
+:1001F00022C081E080936F008091670083B915C0B1
33
+:1002000080916F00863040F010926F0080916D00F9
34
+:1002100083B986B78F7B11C0E82FF0E0E959FF4F13
35
+:10022000908193B98F5F80936F0086B7806486BF9B
36
+:1002300010926E0006C086B7806486BF81E080930E
37
+:100240006E0086B7806886BFFF91EF919F918F9176
38
+:100250000F900FBE0F901F901895882311F481E026
39
+:1002600001C08E7F82B985E486BF0895282F392F7B
40
+:10027000D901E7E6F0E08D91819380E0EE36F80752
41
+:10028000D1F710926E00089581E090916E0099234D
42
+:1002900009F480E00895AA1BBB1B51E107C0AA1F07
43
+:1002A000BB1FA617B70710F0A61BB70B881F991F17
44
+:1002B0005A95A9F780959095BC01CD010895F894C1
45
+:0202C000FFCF6E
46
+:0E02C2008080808080808042424242424242E0
54 47
 :00000001FF

+ 3
- 2
CubeControl/Frame.java View File

@@ -859,7 +859,8 @@ public class Frame extends JFrame implements ListSelectionListener, ChangeListen
859 859
 		System.out.println("## Enter a Command ('h' for help) ##");
860 860
 		System.out.print("$> ");
861 861
 	
862
-		do {
862
+		// Uncomment this to enable a cli debug interface
863
+		/* do {
863 864
 			if (sc.hasNextLine()) {
864 865
 				String s = sc.nextLine();
865 866
 		
@@ -972,7 +973,7 @@ public class Frame extends JFrame implements ListSelectionListener, ChangeListen
972 973
 				lastCommand = new String(s);
973 974
 				System.out.print("$> ");
974 975
 			}
975
-		} while (true);
976
+		} while (true); */
976 977
 	}
977 978
 	
978 979
 	private static short[] toShortArray(String s) {

+ 8
- 1
CubeFirmware/cube.c View File

@@ -58,6 +58,7 @@ volatile uint32_t timesTriggered = 0;
58 58
 volatile uint8_t warningDisplayed = 0;
59 59
 
60 60
 // A fix for our mirrored 64pin cable.
61
+// Look around line 150 to change this
61 62
 uint8_t lookUp[256] PROGMEM = { 	0,  64,  128,  192,  16,  80,  144,  208,  32,  96,  160,
62 63
 									224,  48,  112,  176,  240,  4,  68,  132,  196,  20,
63 64
 									84,  148,  212,  36,  100,  164,  228,  52,  116,  180,
@@ -144,7 +145,13 @@ void setImage(uint8_t *img) {
144 145
 		toggleFlag = 0;
145 146
 		for (i = 0; i < 8; i++) {
146 147
 			for (j = 0; j < 8; j++) {
147
-				imgBuffer[j][7 - i] = ~(pgm_read_byte(&(lookUp[img[j + (i * 8)]])));
148
+				// First line uses the lookUp Table to account for our wrong connection
149
+				// imgBuffer[j][7 - i] = ~(pgm_read_byte(&(lookUp[img[j + (i * 8)]])));
150
+
151
+				// This line is simply displaying the data, for correct connections
152
+				imgBuffer[j][i] = ~(img[j + (i * 8)]);
153
+
154
+				// Uncomment the desired line, comment the other...
148 155
 			}
149 156
 		}
150 157
 	}

+ 99
- 100
CubeFirmware/font.c View File

@@ -28,11 +28,7 @@ uint8_t fontBuff[8];
28 28
 uint8_t *getFont(char c) {
29 29
 	uint8_t i;
30 30
 	if (!((c >= 0x20) && (c <= 0x7E))) {
31
-		if ((c == '\r') || (c == '\n')) {
32
-			c = '!';
33
-		} else {
34
-			c = '?';
35
-		}
31
+		c = '?';
36 32
 	}
37 33
 	for (i = 0; i < 8; i++) {
38 34
 		fontBuff[i] = pgm_read_byte(&(font[(uint8_t)(c - 0x20)][i]));
@@ -47,100 +43,103 @@ uint8_t *getFont(char c) {
47 43
 // Because of size restraints, i cut everything but
48 44
 // the printable ascii range, 0x20 to 0x7E
49 45
 // Not really pretty on the cube, but enough for now.
46
+// I already replaced everything but lowercase letters
50 47
 uint8_t font[95][8] PROGMEM = {
51
-	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},	// 0x20
52
-	{0x0C,0x1E,0x1E,0x0C,0x0C,0x00,0x0C,0x00},	// 0x21
53
-	{0x36,0x36,0x36,0x00,0x00,0x00,0x00,0x00},	// 0x22
54
-	{0x36,0x36,0x7F,0x36,0x7F,0x36,0x36,0x00},	// 0x23
55
-	{0x0C,0x3E,0x03,0x1E,0x30,0x1F,0x0C,0x00},	// 0x24
56
-	{0x00,0x63,0x33,0x18,0x0C,0x66,0x63,0x00},	// 0x25
57
-	{0x1C,0x36,0x1C,0x6E,0x3B,0x33,0x6E,0x00},	// 0x26
58
-	{0x06,0x06,0x03,0x00,0x00,0x00,0x00,0x00},	// 0x27
59
-	{0x18,0x0C,0x06,0x06,0x06,0x0C,0x18,0x00},	// 0x28
60
-	{0x06,0x0C,0x18,0x18,0x18,0x0C,0x06,0x00},	// 0x29
61
-	{0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00},	// 0x2A
62
-	{0x00,0x0C,0x0C,0x3F,0x0C,0x0C,0x00,0x00},	// 0x2B
63
-	{0x00,0x00,0x00,0x00,0x00,0x0E,0x0C,0x06},	// 0x2C
64
-	{0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00},	// 0x2D
65
-	{0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,0x00},	// 0x2E
66
-	{0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00},	// 0x2F
67
-	{0x1E,0x33,0x3B,0x3F,0x37,0x33,0x1E,0x00},	// 0x30
68
-	{0x0C,0x0F,0x0C,0x0C,0x0C,0x0C,0x3F,0x00},	// 0x31
69
-	{0x1E,0x33,0x30,0x1C,0x06,0x33,0x3F,0x00},	// 0x32
70
-	{0x1E,0x33,0x30,0x1C,0x30,0x33,0x1E,0x00},	// 0x33
71
-	{0x38,0x3C,0x36,0x33,0x7F,0x30,0x30,0x00},	// 0x34
72
-	{0x3F,0x03,0x1F,0x30,0x30,0x33,0x1E,0x00},	// 0x35
73
-	{0x1C,0x06,0x03,0x1F,0x33,0x33,0x1E,0x00},	// 0x36
74
-	{0x3F,0x33,0x30,0x18,0x0C,0x06,0x06,0x00},	// 0x37
75
-	{0x1E,0x33,0x33,0x1E,0x33,0x33,0x1E,0x00},	// 0x38
76
-	{0x1E,0x33,0x33,0x3E,0x30,0x18,0x0E,0x00},	// 0x39
77
-	{0x00,0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00},	// 0x3A
78
-	{0x00,0x00,0x0C,0x0C,0x00,0x0E,0x0C,0x06},	// 0x3B
79
-	{0x18,0x0C,0x06,0x03,0x06,0x0C,0x18,0x00},	// 0x3C
80
-	{0x00,0x00,0x3F,0x00,0x3F,0x00,0x00,0x00},	// 0x3D
81
-	{0x06,0x0C,0x18,0x30,0x18,0x0C,0x06,0x00},	// 0x3E
82
-	{0x1E,0x33,0x30,0x18,0x0C,0x00,0x0C,0x00},	// 0x3F
83
-	{0x3E,0x63,0x7B,0x7B,0x7B,0x03,0x1E,0x00},	// 0x40
84
-	{0x0C,0x1E,0x33,0x33,0x3F,0x33,0x33,0x00},	// 0x41
85
-	{0x3F,0x66,0x66,0x3E,0x66,0x66,0x3F,0x00},	// 0x42
86
-	{0x3C,0x66,0x03,0x03,0x03,0x66,0x3C,0x00},	// 0x43
87
-	{0x3F,0x36,0x66,0x66,0x66,0x36,0x3F,0x00},	// 0x44
88
-	{0x7F,0x46,0x16,0x1E,0x16,0x46,0x7F,0x00},	// 0x45
89
-	{0x7F,0x46,0x16,0x1E,0x16,0x06,0x0F,0x00},	// 0x46
90
-	{0x3C,0x66,0x03,0x03,0x73,0x66,0x7C,0x00},	// 0x47
91
-	{0x33,0x33,0x33,0x3F,0x33,0x33,0x33,0x00},	// 0x48
92
-	{0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00},	// 0x49
93
-	{0x78,0x30,0x30,0x30,0x33,0x33,0x1E,0x00},	// 0x4A
94
-	{0x67,0x66,0x36,0x1E,0x36,0x66,0x67,0x00},	// 0x4B
95
-	{0x0F,0x06,0x06,0x06,0x46,0x66,0x7F,0x00},	// 0x4C
96
-	{0x63,0x77,0x7F,0x6B,0x63,0x63,0x63,0x00},	// 0x4D
97
-	{0x63,0x67,0x6F,0x7B,0x73,0x63,0x63,0x00},	// 0x4E
98
-	{0x1C,0x36,0x63,0x63,0x63,0x36,0x1C,0x00},	// 0x4F
99
-	{0x3F,0x66,0x66,0x3E,0x06,0x06,0x0F,0x00},	// 0x50
100
-	{0x1E,0x33,0x33,0x33,0x3B,0x1E,0x38,0x00},	// 0x51
101
-	{0x3F,0x66,0x66,0x3E,0x1E,0x36,0x67,0x00},	// 0x52
102
-	{0x1E,0x33,0x07,0x1C,0x38,0x33,0x1E,0x00},	// 0x53
103
-	{0x3F,0x2D,0x0C,0x0C,0x0C,0x0C,0x1E,0x00},	// 0x54
104
-	{0x33,0x33,0x33,0x33,0x33,0x33,0x3F,0x00},	// 0x55
105
-	{0x33,0x33,0x33,0x33,0x33,0x1E,0x0C,0x00},	// 0x56
106
-	{0x63,0x63,0x63,0x6B,0x7F,0x77,0x63,0x00},	// 0x57
107
-	{0x63,0x63,0x36,0x1C,0x36,0x63,0x63,0x00},	// 0x58
108
-	{0x33,0x33,0x33,0x1E,0x0C,0x0C,0x1E,0x00},	// 0x59
109
-	{0x7F,0x33,0x19,0x0C,0x46,0x63,0x7F,0x00},	// 0x5A
110
-	{0x1E,0x06,0x06,0x06,0x06,0x06,0x1E,0x00},	// 0x5B
111
-	{0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00},	// 0x5C
112
-	{0x1E,0x18,0x18,0x18,0x18,0x18,0x1E,0x00},	// 0x5D
113
-	{0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00},	// 0x5E
114
-	{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF},	// 0x5F
115
-	{0x0C,0x0C,0x18,0x00,0x00,0x00,0x00,0x00},	// 0x60
116
-	{0x00,0x00,0x1E,0x30,0x3E,0x33,0x6E,0x00},	// 0x61
117
-	{0x07,0x06,0x3E,0x66,0x66,0x66,0x3D,0x00},	// 0x62
118
-	{0x00,0x00,0x1E,0x33,0x03,0x33,0x1E,0x00},	// 0x63
119
-	{0x38,0x30,0x30,0x3E,0x33,0x33,0x6E,0x00},	// 0x64
120
-	{0x00,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00},	// 0x65
121
-	{0x1C,0x36,0x06,0x0F,0x06,0x06,0x0F,0x00},	// 0x66
122
-	{0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x1F},	// 0x67
123
-	{0x07,0x06,0x36,0x6E,0x66,0x66,0x67,0x00},	// 0x68
124
-	{0x0C,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00},	// 0x69
125
-	{0x18,0x00,0x1E,0x18,0x18,0x18,0x1B,0x0E},	// 0x6A
126
-	{0x07,0x06,0x66,0x36,0x1E,0x36,0x67,0x00},	// 0x6B
127
-	{0x0E,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00},	// 0x6C
128
-	{0x00,0x00,0x37,0x7F,0x6B,0x63,0x63,0x00},	// 0x6D
129
-	{0x00,0x00,0x1F,0x33,0x33,0x33,0x33,0x00},	// 0x6E
130
-	{0x00,0x00,0x1E,0x33,0x33,0x33,0x1E,0x00},	// 0x6F
131
-	{0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F},	// 0x70
132
-	{0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78},	// 0x71
133
-	{0x00,0x00,0x1B,0x36,0x36,0x06,0x0F,0x00},	// 0x72
134
-	{0x00,0x00,0x3E,0x03,0x1E,0x30,0x1F,0x00},	// 0x73
135
-	{0x08,0x0C,0x3E,0x0C,0x0C,0x2C,0x18,0x00},	// 0x74
136
-	{0x00,0x00,0x33,0x33,0x33,0x33,0x6E,0x00},	// 0x75
137
-	{0x00,0x00,0x33,0x33,0x33,0x1E,0x0C,0x00},	// 0x76
138
-	{0x00,0x00,0x63,0x63,0x6B,0x7F,0x36,0x00},	// 0x77
139
-	{0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00},	// 0x78
140
-	{0x00,0x00,0x33,0x33,0x33,0x3E,0x30,0x1F},	// 0x79
141
-	{0x00,0x00,0x3F,0x19,0x0C,0x26,0x3F,0x00},	// 0x7A
142
-	{0x38,0x0C,0x0C,0x07,0x0C,0x0C,0x38,0x00},	// 0x7B
143
-	{0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x00},	// 0x7C
144
-	{0x07,0x0C,0x0C,0x38,0x0C,0x0C,0x07,0x00},	// 0x7D
145
-	{0x6E,0x3B,0x00,0x00,0x00,0x00,0x00,0x00},	// 0x7E
48
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x20 SPACE
49
+	{0x7e, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18}, // !
50
+	{0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00}, // "
51
+	{0x66, 0xff, 0xff, 0x66, 0x66, 0xff, 0xff, 0x66}, // #
52
+	{0x18, 0xff, 0x19, 0x19, 0xfe, 0x98, 0xff, 0x18}, // $
53
+	{0x87, 0x45, 0x27, 0x10, 0x08, 0xe4, 0xa2, 0xe1}, // %
54
+	{0x1e, 0x33, 0x33, 0xde, 0xee, 0x3b, 0x73, 0xdc}, // &
55
+	{0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, // '
56
+	{0x18, 0x0c, 0x06, 0x03, 0x03, 0x06, 0x0c, 0x18}, // (
57
+	{0x18, 0x38, 0x60, 0xc0, 0xc0, 0x60, 0x38, 0x18}, // )
58
+	{0x99, 0x5a, 0x3c, 0xff, 0xff, 0x3c, 0x5a, 0x99}, // *
59
+	{0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18}, // +
60
+	{0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x0c}, // ,
61
+	{0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00}, // -
62
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00}, // .
63
+	{0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0x03}, // /
64
+	{0x7e, 0xff, 0xe3, 0xd3, 0xcb, 0xc7, 0xff, 0x7e}, // 0
65
+	{0x38, 0x3c, 0x36, 0x33, 0x31, 0x30, 0x30, 0x30}, // 1
66
+	{0x7c, 0x7e, 0x62, 0x30, 0x18, 0x0c, 0x7e, 0x7e}, // 2
67
+	{0x7e, 0xff, 0xc0, 0x78, 0x78, 0xc0, 0xff, 0x7e}, // 3
68
+	{0xc3, 0xc3, 0xc3, 0xff, 0xff, 0xc0, 0xc0, 0xc0}, // 4
69
+	{0xff, 0xff, 0x03, 0x3f, 0x7e, 0xc0, 0x7f, 0x3f}, // 5
70
+	{0xfe, 0xff, 0x03, 0x7f, 0xff, 0xc3, 0xff, 0x7e}, // 6
71
+	{0x7e, 0xff, 0xe0, 0x70, 0xfe, 0x1c, 0x0e, 0x07}, // 7
72
+	{0x3c, 0x7e, 0xc3, 0x7e, 0x7e, 0xc3, 0x7e, 0x3c}, // 8
73
+	{0x7e, 0xff, 0xc3, 0xff, 0xbe, 0x80, 0xff, 0x7e}, // 9
74
+	{0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00}, // :
75
+	{0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x0c}, // ;
76
+	{0xe0, 0x38, 0x0e, 0x03, 0x03, 0x0e, 0x38, 0xe0}, // <
77
+	{0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00}, // =
78
+	{0x07, 0x1c, 0x70, 0xc0, 0xc0, 0x70, 0x1c, 0x07}, // >
79
+	{0x3c, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x18}, // ?
80
+	{0x7e, 0xff, 0xc3, 0x3b, 0x3b, 0x03, 0xff, 0x7e}, // @
81
+	{0x7e, 0xff, 0xc3, 0xc3, 0xff, 0xff, 0xc3, 0xc3}, // A
82
+	{0x7f, 0x83, 0x83, 0x83, 0x7f, 0x83, 0x83, 0x7f}, // B
83
+	{0x7e, 0xff, 0x03, 0x03, 0x03, 0x03, 0xff, 0x7e}, // C
84
+	{0x1e, 0x3f, 0x63, 0xc3, 0xc3, 0x63, 0x3f, 0x1e}, // D
85
+	{0xfe, 0xff, 0x03, 0x3f, 0x3f, 0x03, 0xff, 0xfe}, // E
86
+	{0xfe, 0xff, 0x03, 0x3f, 0x3f, 0x03, 0x03, 0x03}, // F
87
+	{0xfe, 0xff, 0x03, 0x63, 0xf3, 0xc3, 0xff, 0x7e}, // G
88
+	{0xc3, 0xc3, 0xc3, 0xff, 0xff, 0xc3, 0xc3, 0xc3}, // H
89
+	{0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c}, // I
90
+	{0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc6, 0x66, 0x3c}, // J
91
+	{0xc3, 0x63, 0x33, 0x1f, 0x1f, 0x33, 0x63, 0xc3}, // K
92
+	{0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff}, // L
93
+	{0x66, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xc3, 0xc3}, // M
94
+	{0xc7, 0xcf, 0xcf, 0xdb, 0xdb, 0xf3, 0xf3, 0xe3}, // N
95
+	{0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e}, // O
96
+	{0x3e, 0x7f, 0xc3, 0xc3, 0x7f, 0x3f, 0x03, 0x03}, // P
97
+	{0x3c, 0x7e, 0xc3, 0xc3, 0xd3, 0xe3, 0x7e, 0xbc}, // Q
98
+	{0x3e, 0x7f, 0xc3, 0x7f, 0x3f, 0x1f, 0x3b, 0x73}, // R
99
+	{0xfe, 0xff, 0x03, 0x7f, 0xfe, 0x80, 0xff, 0x7f}, // S
100
+	{0xff, 0xff, 0x99, 0x18, 0x18, 0x18, 0x18, 0x3c}, // T
101
+	{0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e}, // U
102
+	{0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18}, // V
103
+	{0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xdb, 0xff, 0x7e}, // W
104
+	{0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3}, // X
105
+	{0x81, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18}, // Y
106
+	{0xfe, 0xff, 0x70, 0x38, 0x1c, 0x0e, 0xff, 0x7f}, // Z
107
+	{0xff, 0xff, 0x03, 0x03, 0x03, 0x03, 0xff, 0xff}, // [
108
+	{0x03, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xc0}, // \
109
+	{0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xff, 0xff}, // ]
110
+	{0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00}, // ^
111
+	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff}, // _
112
+	{0x0e, 0x1c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00}, // `
113
+
114
+	{0x00,0x00,0x1E,0x30,0x3E,0x33,0x6E,0x00},	// 0x61 a
115
+	{0x07,0x06,0x3E,0x66,0x66,0x66,0x3D,0x00},	// 0x62 b
116
+	{0x00,0x00,0x1E,0x33,0x03,0x33,0x1E,0x00},	// 0x63 c
117
+	{0x38,0x30,0x30,0x3E,0x33,0x33,0x6E,0x00},	// 0x64 d
118
+	{0x00,0x00,0x1E,0x33,0x3F,0x03,0x1E,0x00},	// 0x65 e
119
+	{0x1C,0x36,0x06,0x0F,0x06,0x06,0x0F,0x00},	// 0x66 f
120
+	{0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x1F},	// 0x67 g
121
+	{0x07,0x06,0x36,0x6E,0x66,0x66,0x67,0x00},	// 0x68 h
122
+	{0x0C,0x00,0x0E,0x0C,0x0C,0x0C,0x1E,0x00},	// 0x69 i
123
+	{0x18,0x00,0x1E,0x18,0x18,0x18,0x1B,0x0E},	// 0x6A j
124
+	{0x07,0x06,0x66,0x36,0x1E,0x36,0x67,0x00},	// 0x6B k
125
+	{0x0E,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00},	// 0x6C l
126
+	{0x00,0x00,0x37,0x7F,0x6B,0x63,0x63,0x00},	// 0x6D m
127
+	{0x00,0x00,0x1F,0x33,0x33,0x33,0x33,0x00},	// 0x6E n
128
+	{0x00,0x00,0x1E,0x33,0x33,0x33,0x1E,0x00},	// 0x6F o
129
+	{0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F},	// 0x70 p
130
+	{0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78},	// 0x71 q
131
+	{0x00,0x00,0x1B,0x36,0x36,0x06,0x0F,0x00},	// 0x72 r
132
+	{0x00,0x00,0x3E,0x03,0x1E,0x30,0x1F,0x00},	// 0x73 s
133
+	{0x08,0x0C,0x3E,0x0C,0x0C,0x2C,0x18,0x00},	// 0x74 t
134
+	{0x00,0x00,0x33,0x33,0x33,0x33,0x6E,0x00},	// 0x75 u
135
+	{0x00,0x00,0x33,0x33,0x33,0x1E,0x0C,0x00},	// 0x76 v
136
+	{0x00,0x00,0x63,0x63,0x6B,0x7F,0x36,0x00},	// 0x77 w
137
+	{0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00},	// 0x78 x
138
+	{0x00,0x00,0x33,0x33,0x33,0x3E,0x30,0x1F},	// 0x79 y
139
+	{0x00,0x00,0x3F,0x19,0x0C,0x26,0x3F,0x00},	// 0x7A z
140
+
141
+	{0xf8, 0xfc, 0x0c, 0x07, 0x07, 0x0c, 0xfc, 0xf8}, // {
142
+	{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, // |
143
+	{0x1f, 0x3f, 0x30, 0xe0, 0xe0, 0x30, 0x3f, 0x1f}, // }
144
+	{0x00, 0x04, 0x0e, 0x0b, 0x99, 0xd0, 0x70, 0x20}, // ~
146 145
 };

+ 1212
- 1308
CubeFirmware/main.hex
File diff suppressed because it is too large
View File


+ 7
- 101
CubeFirmware/visualizer.c View File

@@ -30,24 +30,22 @@
30 30
 					// 256 / 8 = 32 => Divide by 31 (FACTOR) to get num of leds to light
31 31
 					// 255 / FACTOR = 8,...
32 32
 					// 127 / FACTOR = 4,...
33
- #define THRESHOLD (FACTOR * 10 / 17)
33
+ #define THRESHOLD 30
34 34
 
35 35
 uint8_t maxVal(uint8_t data, uint8_t log);
36
-void setRow(uint8_t x, uint8_t z, uint8_t height, uint8_t *buf);
37 36
 uint8_t average(uint8_t *data);
38 37
 uint8_t maximum(uint8_t *data);
39 38
 void filterData(uint8_t *data, uint8_t log);
40 39
 void simpleVisualization(uint8_t *data);
41 40
 void simpleSwitch(uint8_t *data);
42 41
 void fullDepthVisualization(uint8_t *data);
43
-void horribleWave(uint8_t *audioData);
44 42
 void simpleLog(uint8_t *data);
45 43
 void fullDepthLog(uint8_t *data);
46 44
 void linLog(uint8_t *data);
47 45
 
48
-#define LINEARVISUALS 4
46
+#define LINEARVISUALS 3
49 47
 void (*linear[LINEARVISUALS])(uint8_t *data) = { &simpleVisualization, &fullDepthVisualization,
50
-											&simpleSwitch, &horribleWave };
48
+											&simpleSwitch };
51 49
 
52 50
 #define LOGARITHMICVISUALS 3
53 51
 void (*logarithmic[LOGARITHMICVISUALS])(uint8_t *data) = { &linLog, &simpleLog, &fullDepthLog };
@@ -107,17 +105,12 @@ uint8_t average(uint8_t *data) {
107 105
 
108 106
 void filterData(uint8_t *data, uint8_t log) {
109 107
 	uint8_t i;
110
-	uint8_t max;
108
+	uint8_t max = THRESHOLD;
111 109
 
112
-	if (log) {
113
-		if (average(data) < THRESHOLD) {
114
-			max = THRESHOLD;
115
-		} else {
116
-			max = THRESHOLD / 2;
117
-		}
118
-	} else {
119
-		max = THRESHOLD;
110
+	if (log && (average(data) >= max)) {
111
+		max = THRESHOLD / 2;
120 112
 	}
113
+
121 114
 	if (average(data) < max) {
122 115
 		for (i = 0; i < 7; i++) {
123 116
 			data[i] = 0;
@@ -221,90 +214,3 @@ void fullDepthVisualization(uint8_t *data) {
221 214
 	setImage(buff);
222 215
 	buffFree(buff);
223 216
 }
224
-
225
-void setRow(uint8_t x, uint8_t z, uint8_t height, uint8_t *buf) {
226
-	uint8_t i;
227
-	for (i = 0; i < height; i++) {
228
-		buffSetPixel(buf, x, i, z);
229
-	}
230
-}
231
-
232
-void horribleWave(uint8_t *audioData) {
233
-	uint8_t *imageData = buffNew();
234
-
235
-	// Could not figure out a way to represent this easily in a loop
236
-	// without using a shitload of 'if's...
237
-	setRow(0, 0, (audioData[0] / FACTOR), imageData);
238
-	setRow(0, 1, (audioData[0] / FACTOR), imageData);
239
-	setRow(1, 0, (audioData[0] / FACTOR), imageData);
240
-
241
-	setRow(0, 2, (audioData[1] / FACTOR), imageData);
242
-	setRow(0, 3, (audioData[1] / FACTOR), imageData);
243
-	setRow(1, 1, (audioData[1] / FACTOR), imageData);
244
-	setRow(1, 2, (audioData[1] / FACTOR), imageData);
245
-	setRow(2, 0, (audioData[1] / FACTOR), imageData);
246
-	setRow(2, 1, (audioData[1] / FACTOR), imageData);
247
-
248
-	setRow(0, 4, (audioData[2] / FACTOR), imageData);
249
-	setRow(0, 5, (audioData[2] / FACTOR), imageData);
250
-	setRow(1, 3, (audioData[2] / FACTOR), imageData);
251
-	setRow(1, 4, (audioData[2] / FACTOR), imageData);
252
-	setRow(2, 2, (audioData[2] / FACTOR), imageData);
253
-	setRow(2, 3, (audioData[2] / FACTOR), imageData);
254
-	setRow(3, 0, (audioData[2] / FACTOR), imageData);
255
-	setRow(3, 1, (audioData[2] / FACTOR), imageData);
256
-	setRow(3, 2, (audioData[2] / FACTOR), imageData);
257
-	setRow(4, 0, (audioData[2] / FACTOR), imageData);
258
-	setRow(4, 1, (audioData[2] / FACTOR), imageData);
259
-
260
-	setRow(0, 6, (audioData[3] / FACTOR), imageData);
261
-	setRow(0, 7, (audioData[3] / FACTOR), imageData);
262
-	setRow(1, 5, (audioData[3] / FACTOR), imageData);
263
-	setRow(1, 6, (audioData[3] / FACTOR), imageData);
264
-	setRow(2, 4, (audioData[3] / FACTOR), imageData);
265
-	setRow(2, 5, (audioData[3] / FACTOR), imageData);
266
-	setRow(3, 3, (audioData[3] / FACTOR), imageData);
267
-	setRow(3, 4, (audioData[3] / FACTOR), imageData);
268
-	setRow(4, 2, (audioData[3] / FACTOR), imageData);
269
-	setRow(4, 3, (audioData[3] / FACTOR), imageData);
270
-	setRow(5, 0, (audioData[3] / FACTOR), imageData);
271
-	setRow(5, 1, (audioData[3] / FACTOR), imageData);
272
-	setRow(5, 2, (audioData[3] / FACTOR), imageData);
273
-	setRow(6, 0, (audioData[3] / FACTOR), imageData);
274
-	setRow(6, 1, (audioData[3] / FACTOR), imageData);
275
-
276
-	setRow(1, 7, (audioData[4] / FACTOR), imageData);
277
-	setRow(2, 6, (audioData[4] / FACTOR), imageData);
278
-	setRow(2, 7, (audioData[4] / FACTOR), imageData);
279
-	setRow(3, 5, (audioData[4] / FACTOR), imageData);
280
-	setRow(3, 6, (audioData[4] / FACTOR), imageData);
281
-	setRow(4, 4, (audioData[4] / FACTOR), imageData);
282
-	setRow(4, 5, (audioData[4] / FACTOR), imageData);
283
-	setRow(5, 3, (audioData[4] / FACTOR), imageData);
284
-	setRow(5, 4, (audioData[4] / FACTOR), imageData);
285
-	setRow(6, 2, (audioData[4] / FACTOR), imageData);
286
-	setRow(6, 3, (audioData[4] / FACTOR), imageData);
287
-	setRow(7, 0, (audioData[4] / FACTOR), imageData);
288
-	setRow(7, 1, (audioData[4] / FACTOR), imageData);
289
-
290
-	setRow(3, 7, (audioData[5] / FACTOR), imageData);
291
-	setRow(4, 6, (audioData[5] / FACTOR), imageData);
292
-	setRow(4, 7, (audioData[5] / FACTOR), imageData);
293
-	setRow(5, 5, (audioData[5] / FACTOR), imageData);
294
-	setRow(5, 6, (audioData[5] / FACTOR), imageData);
295
-	setRow(6, 4, (audioData[5] / FACTOR), imageData);
296
-	setRow(6, 5, (audioData[5] / FACTOR), imageData);
297
-	setRow(7, 2, (audioData[5] / FACTOR), imageData);
298
-	setRow(7, 3, (audioData[5] / FACTOR), imageData);
299
-	setRow(7, 4, (audioData[5] / FACTOR), imageData);
300
-
301
-	setRow(5, 7, (audioData[6] / FACTOR), imageData);
302
-	setRow(6, 6, (audioData[6] / FACTOR), imageData);
303
-	setRow(6, 7, (audioData[6] / FACTOR), imageData);
304
-	setRow(7, 5, (audioData[6] / FACTOR), imageData);
305
-	setRow(7, 6, (audioData[6] / FACTOR), imageData);
306
-	setRow(7, 7, (audioData[6] / FACTOR), imageData);
307
-
308
-	setImage(imageData);
309
-	buffFree(imageData);
310
-}

Loading…
Cancel
Save