Browse Source

Added LEDs to Audio Device

Thomas Buck 13 years ago
parent
commit
056921917f
5 changed files with 212 additions and 32 deletions
  1. 21
    0
      AudioFirmware/eq.c
  2. 2
    0
      AudioFirmware/eq.h
  3. 7
    0
      AudioFirmware/main.c
  4. 182
    32
      Hardware/LED Cube.sch
  5. BIN
      Hardware/Schematic.png

+ 21
- 0
AudioFirmware/eq.c View File

@@ -46,6 +46,25 @@ void equalizerInit(void) {
46 46
 
47 47
 }
48 48
 
49
+void eqLed(uint8_t *d) {
50
+	uint8_t pins[7] = { PD2, PD3, PD4, PD5, PD6, PD7, PB0 };
51
+	uint8_t i;
52
+
53
+	for (i = 0; i < 7; i++) {
54
+		if (d[i] >= 127) {
55
+			if (i < 6)
56
+				PORTD |= (1 << pins[i]);
57
+			else
58
+				PORTB |= (1 << pins[i]);
59
+		} else {
60
+			if (i < 6)
61
+				PORTD &= ~(1 << pins[i]);
62
+			else
63
+				PORTB &= ~(1 << pins[i]);
64
+		}
65
+	}
66
+}
67
+
49 68
 uint8_t *equalizerGet(void) {
50 69
 	uint8_t *result = (uint8_t *)malloc(7); // Has to work... If not, were screwed anyway :)
51 70
 	uint8_t i;
@@ -62,5 +81,7 @@ uint8_t *equalizerGet(void) {
62 81
 		result[i] = adcGetByte(); // This line hangs
63 82
 		_delay_us(STROBEDELAY);
64 83
 	}
84
+
85
+	eqLed(result);
65 86
 	return result;
66 87
 }

+ 2
- 0
AudioFirmware/eq.h View File

@@ -26,3 +26,5 @@ void equalizerInit(void);
26 26
 // 7 elements in byte array
27 27
 // lowest to highest frequency
28 28
 uint8_t *equalizerGet(void);
29
+
30
+void eqLed(uint8_t *d);

+ 7
- 0
AudioFirmware/main.c View File

@@ -33,11 +33,18 @@
33 33
 #endif
34 34
 
35 35
 void blinkStatus(void) {
36
+	uint8_t i, mem[7] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
37
+
36 38
 	PORTB |= (1 << PB2);
37 39
 	PORTB &= ~(1 << PB1);
40
+	eqLed(mem);
38 41
 	_delay_ms(250);
39 42
 	PORTB &= ~(1 << PB2);
40 43
 	PORTB |= (1 << PB1);
44
+	for (i = 0; i < 7; i++) {
45
+		mem[i] = 0x00;
46
+	}
47
+	eqLed(mem);
41 48
 	_delay_ms(250);
42 49
 }
43 50
 

+ 182
- 32
Hardware/LED Cube.sch View File

@@ -10802,6 +10802,21 @@ Distributor Buerklin, 11G810</description>
10802 10802
 <part name="R30" library="resistor" deviceset="R-EU_" device="0204/7" value="100k"/>
10803 10803
 <part name="LED66" library="led" deviceset="LED" device="5MM"/>
10804 10804
 <part name="R31" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10805
+<part name="LED67" library="led" deviceset="LED" device="5MM"/>
10806
+<part name="LED68" library="led" deviceset="LED" device="5MM"/>
10807
+<part name="LED69" library="led" deviceset="LED" device="5MM"/>
10808
+<part name="LED70" library="led" deviceset="LED" device="5MM"/>
10809
+<part name="LED71" library="led" deviceset="LED" device="5MM"/>
10810
+<part name="LED72" library="led" deviceset="LED" device="5MM"/>
10811
+<part name="LED73" library="led" deviceset="LED" device="5MM"/>
10812
+<part name="R32" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10813
+<part name="R33" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10814
+<part name="R34" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10815
+<part name="R35" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10816
+<part name="R36" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10817
+<part name="R37" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10818
+<part name="R38" library="resistor" deviceset="R-EU_" device="0204/7" value="1k"/>
10819
+<part name="P+15" library="supply1" deviceset="VCC" device=""/>
10805 10820
 <part name="GND38" library="supply1" deviceset="GND" device=""/>
10806 10821
 </parts>
10807 10822
 <sheets>
@@ -10928,9 +10943,9 @@ Distributor Buerklin, 11G810</description>
10928 10943
 <instance part="JP6" gate="G$1" x="25.4" y="-132.08"/>
10929 10944
 <instance part="GND35" gate="1" x="48.26" y="-139.7" rot="R90"/>
10930 10945
 <instance part="P+13" gate="VCC" x="48.26" y="-124.46" rot="R270"/>
10931
-<instance part="LED65" gate="G$1" x="15.24" y="-116.84" rot="R90"/>
10932
-<instance part="R21" gate="G$1" x="27.94" y="-116.84" rot="R180"/>
10933
-<instance part="GND36" gate="1" x="38.1" y="-116.84" rot="R90"/>
10946
+<instance part="LED65" gate="G$1" x="-15.24" y="-127" rot="R90"/>
10947
+<instance part="R21" gate="G$1" x="-2.54" y="-127" rot="R180"/>
10948
+<instance part="GND36" gate="1" x="7.62" y="-127" rot="R90"/>
10934 10949
 <instance part="R22" gate="G$1" x="-7.62" y="-76.2" rot="R180"/>
10935 10950
 <instance part="GND37" gate="1" x="-2.54" y="-83.82" rot="R90"/>
10936 10951
 <instance part="P+14" gate="VCC" x="-2.54" y="-68.58" rot="R270"/>
@@ -10942,9 +10957,24 @@ Distributor Buerklin, 11G810</description>
10942 10957
 <instance part="R28" gate="G$1" x="88.9" y="-33.02"/>
10943 10958
 <instance part="R29" gate="G$1" x="88.9" y="-43.18"/>
10944 10959
 <instance part="R30" gate="G$1" x="88.9" y="-53.34"/>
10945
-<instance part="LED66" gate="G$1" x="-17.78" y="-124.46" rot="R90"/>
10960
+<instance part="LED66" gate="G$1" x="-15.24" y="-124.46" rot="R270"/>
10946 10961
 <instance part="R31" gate="G$1" x="-5.08" y="-124.46" rot="R180"/>
10947
-<instance part="GND38" gate="1" x="5.08" y="-124.46" rot="R90"/>
10962
+<instance part="LED67" gate="G$1" x="-12.7" y="-119.38" rot="R90"/>
10963
+<instance part="LED68" gate="G$1" x="-15.24" y="-116.84" rot="R90"/>
10964
+<instance part="LED69" gate="G$1" x="-12.7" y="-114.3" rot="R90"/>
10965
+<instance part="LED70" gate="G$1" x="-15.24" y="-111.76" rot="R90"/>
10966
+<instance part="LED71" gate="G$1" x="-12.7" y="-109.22" rot="R90"/>
10967
+<instance part="LED72" gate="G$1" x="-15.24" y="-106.68" rot="R90"/>
10968
+<instance part="LED73" gate="G$1" x="-12.7" y="-104.14" rot="R90"/>
10969
+<instance part="R32" gate="G$1" x="-2.54" y="-119.38" rot="R180"/>
10970
+<instance part="R33" gate="G$1" x="-5.08" y="-116.84" rot="R180"/>
10971
+<instance part="R34" gate="G$1" x="-2.54" y="-114.3" rot="R180"/>
10972
+<instance part="R35" gate="G$1" x="-5.08" y="-111.76" rot="R180"/>
10973
+<instance part="R36" gate="G$1" x="-2.54" y="-109.22" rot="R180"/>
10974
+<instance part="R37" gate="G$1" x="-5.08" y="-106.68" rot="R180"/>
10975
+<instance part="R38" gate="G$1" x="-2.54" y="-104.14" rot="R180"/>
10976
+<instance part="P+15" gate="VCC" x="5.08" y="-124.46" rot="R270"/>
10977
+<instance part="GND38" gate="1" x="10.16" y="-106.68" rot="R90"/>
10948 10978
 </instances>
10949 10979
 <busses>
10950 10980
 </busses>
@@ -11297,20 +11327,44 @@ Distributor Buerklin, 11G810</description>
11297 11327
 <pinref part="JP6" gate="G$1" pin="GND@2"/>
11298 11328
 </segment>
11299 11329
 <segment>
11300
-<wire x1="35.56" y1="-116.84" x2="33.02" y2="-116.84" width="0.1524" layer="91"/>
11301
-<pinref part="GND36" gate="1" pin="GND"/>
11302
-<pinref part="R21" gate="G$1" pin="1"/>
11303
-</segment>
11304
-<segment>
11305 11330
 <wire x1="-5.08" y1="-83.82" x2="-7.62" y2="-83.82" width="0.1524" layer="91"/>
11306 11331
 <wire x1="-7.62" y1="-83.82" x2="-7.62" y2="-81.28" width="0.1524" layer="91"/>
11307 11332
 <pinref part="GND37" gate="1" pin="GND"/>
11308 11333
 <pinref part="R22" gate="G$1" pin="A"/>
11309 11334
 </segment>
11310 11335
 <segment>
11311
-<pinref part="R31" gate="G$1" pin="1"/>
11336
+<pinref part="R38" gate="G$1" pin="1"/>
11337
+<wire x1="2.54" y1="-104.14" x2="5.08" y2="-104.14" width="0.1524" layer="91"/>
11338
+<wire x1="5.08" y1="-104.14" x2="5.08" y2="-106.68" width="0.1524" layer="91"/>
11312 11339
 <pinref part="GND38" gate="1" pin="GND"/>
11313
-<wire x1="0" y1="-124.46" x2="2.54" y2="-124.46" width="0.1524" layer="91"/>
11340
+<wire x1="5.08" y1="-106.68" x2="7.62" y2="-106.68" width="0.1524" layer="91"/>
11341
+<pinref part="R37" gate="G$1" pin="1"/>
11342
+<wire x1="0" y1="-106.68" x2="5.08" y2="-106.68" width="0.1524" layer="91"/>
11343
+<junction x="5.08" y="-106.68"/>
11344
+<pinref part="R32" gate="G$1" pin="1"/>
11345
+<wire x1="2.54" y1="-119.38" x2="5.08" y2="-119.38" width="0.1524" layer="91"/>
11346
+<wire x1="5.08" y1="-119.38" x2="5.08" y2="-116.84" width="0.1524" layer="91"/>
11347
+<pinref part="R36" gate="G$1" pin="1"/>
11348
+<wire x1="5.08" y1="-116.84" x2="5.08" y2="-114.3" width="0.1524" layer="91"/>
11349
+<wire x1="5.08" y1="-114.3" x2="5.08" y2="-111.76" width="0.1524" layer="91"/>
11350
+<wire x1="5.08" y1="-111.76" x2="5.08" y2="-109.22" width="0.1524" layer="91"/>
11351
+<wire x1="5.08" y1="-109.22" x2="5.08" y2="-106.68" width="0.1524" layer="91"/>
11352
+<wire x1="2.54" y1="-109.22" x2="5.08" y2="-109.22" width="0.1524" layer="91"/>
11353
+<junction x="5.08" y="-109.22"/>
11354
+<pinref part="R35" gate="G$1" pin="1"/>
11355
+<wire x1="0" y1="-111.76" x2="5.08" y2="-111.76" width="0.1524" layer="91"/>
11356
+<junction x="5.08" y="-111.76"/>
11357
+<pinref part="R34" gate="G$1" pin="1"/>
11358
+<wire x1="2.54" y1="-114.3" x2="5.08" y2="-114.3" width="0.1524" layer="91"/>
11359
+<junction x="5.08" y="-114.3"/>
11360
+<pinref part="R33" gate="G$1" pin="1"/>
11361
+<wire x1="0" y1="-116.84" x2="5.08" y2="-116.84" width="0.1524" layer="91"/>
11362
+<junction x="5.08" y="-116.84"/>
11363
+</segment>
11364
+<segment>
11365
+<pinref part="R21" gate="G$1" pin="1"/>
11366
+<pinref part="GND36" gate="1" pin="GND"/>
11367
+<wire x1="2.54" y1="-127" x2="5.08" y2="-127" width="0.1524" layer="91"/>
11314 11368
 </segment>
11315 11369
 </net>
11316 11370
 <net name="VCC" class="0">
@@ -11439,6 +11493,11 @@ Distributor Buerklin, 11G810</description>
11439 11493
 <pinref part="P+14" gate="VCC" pin="VCC"/>
11440 11494
 <pinref part="R22" gate="G$1" pin="E"/>
11441 11495
 </segment>
11496
+<segment>
11497
+<pinref part="R31" gate="G$1" pin="1"/>
11498
+<wire x1="0" y1="-124.46" x2="2.54" y2="-124.46" width="0.1524" layer="91"/>
11499
+<pinref part="P+15" gate="VCC" pin="VCC"/>
11500
+</segment>
11442 11501
 </net>
11443 11502
 <net name="N$3" class="0">
11444 11503
 <segment>
@@ -12405,13 +12464,6 @@ Distributor Buerklin, 11G810</description>
12405 12464
 <pinref part="IC13" gate="G$1" pin="AREF"/>
12406 12465
 </segment>
12407 12466
 </net>
12408
-<net name="N$76" class="0">
12409
-<segment>
12410
-<wire x1="22.86" y1="-116.84" x2="20.32" y2="-116.84" width="0.1524" layer="91"/>
12411
-<pinref part="R21" gate="G$1" pin="2"/>
12412
-<pinref part="LED65" gate="G$1" pin="C"/>
12413
-</segment>
12414
-</net>
12415 12467
 <net name="N$77" class="0">
12416 12468
 <segment>
12417 12469
 <wire x1="-25.4" y1="-78.74" x2="-15.24" y2="-78.74" width="0.1524" layer="91"/>
@@ -12421,15 +12473,6 @@ Distributor Buerklin, 11G810</description>
12421 12473
 <pinref part="R22" gate="G$1" pin="S"/>
12422 12474
 </segment>
12423 12475
 </net>
12424
-<net name="N$75" class="0">
12425
-<segment>
12426
-<wire x1="-25.4" y1="-127" x2="7.62" y2="-127" width="0.1524" layer="91"/>
12427
-<wire x1="7.62" y1="-127" x2="7.62" y2="-116.84" width="0.1524" layer="91"/>
12428
-<wire x1="7.62" y1="-116.84" x2="12.7" y2="-116.84" width="0.1524" layer="91"/>
12429
-<pinref part="IC13" gate="G$1" pin="PB2(SS/OC1B)"/>
12430
-<pinref part="LED65" gate="G$1" pin="A"/>
12431
-</segment>
12432
-</net>
12433 12476
 <net name="N$79" class="0">
12434 12477
 <segment>
12435 12478
 <wire x1="-25.4" y1="-132.08" x2="12.7" y2="-132.08" width="0.1524" layer="91"/>
@@ -12457,18 +12500,125 @@ Distributor Buerklin, 11G810</description>
12457 12500
 <pinref part="IC13" gate="G$1" pin="PB5(SCK)"/>
12458 12501
 </segment>
12459 12502
 </net>
12503
+<net name="N$84" class="0">
12504
+<segment>
12505
+<pinref part="LED67" gate="G$1" pin="C"/>
12506
+<pinref part="R32" gate="G$1" pin="2"/>
12507
+</segment>
12508
+</net>
12509
+<net name="N$85" class="0">
12510
+<segment>
12511
+<pinref part="LED68" gate="G$1" pin="C"/>
12512
+<pinref part="R33" gate="G$1" pin="2"/>
12513
+</segment>
12514
+</net>
12515
+<net name="N$86" class="0">
12516
+<segment>
12517
+<pinref part="LED69" gate="G$1" pin="C"/>
12518
+<pinref part="R34" gate="G$1" pin="2"/>
12519
+</segment>
12520
+</net>
12521
+<net name="N$87" class="0">
12522
+<segment>
12523
+<pinref part="LED70" gate="G$1" pin="C"/>
12524
+<pinref part="R35" gate="G$1" pin="2"/>
12525
+</segment>
12526
+</net>
12527
+<net name="N$88" class="0">
12528
+<segment>
12529
+<pinref part="LED71" gate="G$1" pin="C"/>
12530
+<pinref part="R36" gate="G$1" pin="2"/>
12531
+</segment>
12532
+</net>
12533
+<net name="N$89" class="0">
12534
+<segment>
12535
+<pinref part="LED72" gate="G$1" pin="C"/>
12536
+<pinref part="R37" gate="G$1" pin="2"/>
12537
+</segment>
12538
+</net>
12539
+<net name="N$90" class="0">
12540
+<segment>
12541
+<pinref part="LED73" gate="G$1" pin="C"/>
12542
+<pinref part="R38" gate="G$1" pin="2"/>
12543
+</segment>
12544
+</net>
12545
+<net name="N$91" class="0">
12546
+<segment>
12547
+<pinref part="IC13" gate="G$1" pin="PB0(ICP)"/>
12548
+<wire x1="-25.4" y1="-121.92" x2="-20.32" y2="-121.92" width="0.1524" layer="91"/>
12549
+<wire x1="-20.32" y1="-121.92" x2="-20.32" y2="-119.38" width="0.1524" layer="91"/>
12550
+<pinref part="LED67" gate="G$1" pin="A"/>
12551
+<wire x1="-20.32" y1="-119.38" x2="-15.24" y2="-119.38" width="0.1524" layer="91"/>
12552
+</segment>
12553
+</net>
12554
+<net name="N$92" class="0">
12555
+<segment>
12556
+<pinref part="LED68" gate="G$1" pin="A"/>
12557
+<pinref part="IC13" gate="G$1" pin="PD7(AIN1)"/>
12558
+<wire x1="-17.78" y1="-116.84" x2="-25.4" y2="-116.84" width="0.1524" layer="91"/>
12559
+</segment>
12560
+</net>
12561
+<net name="N$93" class="0">
12562
+<segment>
12563
+<pinref part="IC13" gate="G$1" pin="PD6(AIN0)"/>
12564
+<pinref part="LED69" gate="G$1" pin="A"/>
12565
+<wire x1="-25.4" y1="-114.3" x2="-15.24" y2="-114.3" width="0.1524" layer="91"/>
12566
+</segment>
12567
+</net>
12568
+<net name="N$94" class="0">
12569
+<segment>
12570
+<pinref part="LED70" gate="G$1" pin="A"/>
12571
+<pinref part="IC13" gate="G$1" pin="PD5(T1)"/>
12572
+<wire x1="-17.78" y1="-111.76" x2="-25.4" y2="-111.76" width="0.1524" layer="91"/>
12573
+</segment>
12574
+</net>
12575
+<net name="N$95" class="0">
12576
+<segment>
12577
+<pinref part="IC13" gate="G$1" pin="PD4(XCK/T0)"/>
12578
+<pinref part="LED71" gate="G$1" pin="A"/>
12579
+<wire x1="-25.4" y1="-109.22" x2="-15.24" y2="-109.22" width="0.1524" layer="91"/>
12580
+</segment>
12581
+</net>
12582
+<net name="N$96" class="0">
12583
+<segment>
12584
+<pinref part="LED72" gate="G$1" pin="A"/>
12585
+<pinref part="IC13" gate="G$1" pin="PD3(INT1)"/>
12586
+<wire x1="-17.78" y1="-106.68" x2="-25.4" y2="-106.68" width="0.1524" layer="91"/>
12587
+</segment>
12588
+</net>
12589
+<net name="N$97" class="0">
12590
+<segment>
12591
+<pinref part="IC13" gate="G$1" pin="PD2(INT0)"/>
12592
+<pinref part="LED73" gate="G$1" pin="A"/>
12593
+<wire x1="-25.4" y1="-104.14" x2="-15.24" y2="-104.14" width="0.1524" layer="91"/>
12594
+</segment>
12595
+</net>
12460 12596
 <net name="N$82" class="0">
12461 12597
 <segment>
12462
-<pinref part="IC13" gate="G$1" pin="PB1(OC1A)"/>
12598
+<pinref part="R31" gate="G$1" pin="2"/>
12463 12599
 <pinref part="LED66" gate="G$1" pin="A"/>
12464
-<wire x1="-25.4" y1="-124.46" x2="-20.32" y2="-124.46" width="0.1524" layer="91"/>
12600
+<wire x1="-10.16" y1="-124.46" x2="-12.7" y2="-124.46" width="0.1524" layer="91"/>
12465 12601
 </segment>
12466 12602
 </net>
12467 12603
 <net name="N$83" class="0">
12468 12604
 <segment>
12469 12605
 <pinref part="LED66" gate="G$1" pin="C"/>
12470
-<pinref part="R31" gate="G$1" pin="2"/>
12471
-<wire x1="-12.7" y1="-124.46" x2="-10.16" y2="-124.46" width="0.1524" layer="91"/>
12606
+<pinref part="IC13" gate="G$1" pin="PB1(OC1A)"/>
12607
+<wire x1="-20.32" y1="-124.46" x2="-25.4" y2="-124.46" width="0.1524" layer="91"/>
12608
+</segment>
12609
+</net>
12610
+<net name="N$75" class="0">
12611
+<segment>
12612
+<pinref part="IC13" gate="G$1" pin="PB2(SS/OC1B)"/>
12613
+<pinref part="LED65" gate="G$1" pin="A"/>
12614
+<wire x1="-25.4" y1="-127" x2="-17.78" y2="-127" width="0.1524" layer="91"/>
12615
+</segment>
12616
+</net>
12617
+<net name="N$76" class="0">
12618
+<segment>
12619
+<pinref part="LED65" gate="G$1" pin="C"/>
12620
+<pinref part="R21" gate="G$1" pin="2"/>
12621
+<wire x1="-10.16" y1="-127" x2="-7.62" y2="-127" width="0.1524" layer="91"/>
12472 12622
 </segment>
12473 12623
 </net>
12474 12624
 </nets>

BIN
Hardware/Schematic.png View File


Loading…
Cancel
Save