replaced mounting holes with big vias

This commit is contained in:
bigalex 2012-08-27 09:17:56 +02:00
parent a8e7110282
commit eebe3c27cf
2 changed files with 83 additions and 159 deletions

View File

@ -5,8 +5,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "main.h" #include "main.h"
#include "synth.h"
#include "usart.h"
uint16_t sw_v = 0; uint16_t sw_v = 0;
@ -15,110 +14,64 @@ uint16_t darkval = 0;
uint16_t last_darkval = 0; uint16_t last_darkval = 0;
static void init_sampletimer(void)
{
/*
* Timer 0
*/
/* set timer0 to CTC & prescaler 64 → 125kHz increment */
TCCR0A = (1 << WGM01);
TCCR0B = (1 << CS00) | (1 << CS01);
OCR0A = 6; /* TOP */
TCNT0 = 0;
/*enable interrupt*/
TIMSK0 |= (1<<OCIE0A);
}
static inline void init_pwm(void)
{
/* set PB2 as output (buzzer pwm port):*/
DDRB |= (1 << PORTB2);
/* analog value preselection :*/
OCR1B = 0x007F;
/* Top value. Timer overflows here. Thus we have a resulting 8bit pwm */
ICR1 = 0x00FF;
/* only b-chan , fastpwm (mode 14), no prescale */
TCCR1A = (1 << COM1B1) | (1 << WGM11);
TCCR1B = (1 << WGM13 ) | (1 << WGM12) | (1 << CS10);
return;
}
static void init_leds(void)
{
/* enable LED channels as output */
DDRC |= (1 << PORTC0) | (1 << PORTC2) |
(1 << PORTC3) | (1 << PORTC1) ;
/* initially one led is on */
PORTC = 0b00000101;
/*
* Timer 2
*/
/* set timer2 to CTC & prescaler 64 → ???125kHz increment */
TCCR2A = (1 << WGM21);
TCCR2B = (1 << CS20)|(1 << CS21);
OCR2A = 255; /* TOP */
TCNT2 = 0;
/*enable interrupt*/
TIMSK2 |= (1<<OCIE2A);
return;
}
inline void setleds(uint8_t state)
{
/* set leds according to */
PORTC |= (state | 0b00001111);
PORTC &= ~(state | 0b11110000);
return;
}
static void init_motor(void)
{
/* vibration motor on B1, initially off: */
DDRB |= (1 << PORTB1);
PORTB &= ~( 1<<PORTB1);
return;
}
void __attribute__((noreturn)) void __attribute__((noreturn))
main(void) main(void)
{ {
/* hardware initialisation: */
//init_leds();
USART0_Init();
// init_motor();
init_pwm();
init_sampletimer();
/* syntesizer initialisation */
synth_init();
/* here the show begins:*/ /* here the show begins:*/
sei();
DDRC = 0b00000011; DDRC = 0b00100011;
PORTC = 0b00000001; PORTC = 0b00000001;
PORTC = 0b00000000; PORTC = 0b00000000;
DDRD = 0x00;
PORTD = 0b00000011; //enable pullups
DDRB = 0xFF;
PORTB=0xFF;
/* set timer2 to CTC & prescaler 64 → ???125kHz increment */
TCCR2A = (1 << WGM21);
TCCR2B = (1 << CS20)|(1 << CS21);
OCR2A = 0x3F; /* TOP */
TCNT2 = 0;
/*enable interrupt*/
TIMSK2 |= (1<<OCIE2A);
sei();
for(;;) /* ever */ { for(;;) /* ever */ {
//do something //do something
synth_poll(); //synth_poll();
if (10 == 1){ /* if (10 == 1){
uint16_t out = darkval; uint16_t out = darkval;
USART0_put_uint16(out); USART0_put_uint16(out);
USART0_crlf(); USART0_crlf();
//last_darkval=darkval; //last_darkval=darkval;
}; };*/
DDRC |= (1 << PORTC0) | (1 << PORTC2) |
(1 << PORTC3) | (1 << PORTC1) ;
/* initially one led is on */
if ((PIND & 0b00000001)==0){
PORTC |= 0b00000001;
PORTB |= 0b00000010;
} else {
PORTC &= 0b11111110;
//PORTB &= 0b11111101;
};
if ((PIND & 0b00000010)==0){
PORTC |= 0b00000100;
} else {
PORTC &= 0b11111011;
};
//USART0_put_uint16(0xA09F); //USART0_put_uint16(0xA09F);
//USART0_crlf(); //USART0_crlf();
} }
@ -130,40 +83,8 @@ main(void)
ISR(TIMER2_COMPA_vect) ISR(TIMER2_COMPA_vect)
{ {
darkval++; //invert c5 and b2
switch(sw_v){ PORTB ^=0b00000100;
PORTC ^= 0b00100000;
case 0 : // Set PC0 to 1 and PC1 to 0 - charge LED
DDRC = 0b00000011;
PORTC = 0b00000010;
darkness = 0;
sw_v++;
break;
case 10 : // set PC0 to 0 and PC1 as input
DDRC = 0b00000001;
PORTC = 0b00000000;
sw_v++;
break;
case 5000 : sw_v = 0;
//darkval = darkness;
//darkval = 1234;
break;
default : //measure if PC1 falls to LOW
if ((darkness==0) && ((PINC && 0b00000010)==0)){
darkness = sw_v;
};
sw_v++;
}; //end switch
//PORTC ^= 0b00001111; //toggle C0, C1, C2,C3
//PORTC = 0;
} }

View File

@ -8,7 +8,7 @@
</settings> </settings>
<grid distance="1.27" unitdist="mm" unit="mm" style="lines" multiple="2" display="yes" altdistance="0.635" altunitdist="mm" altunit="mm"/> <grid distance="1.27" unitdist="mm" unit="mm" style="lines" multiple="2" display="yes" altdistance="0.635" altunitdist="mm" altunit="mm"/>
<layers> <layers>
<layer number="1" name="Top" color="4" fill="1" visible="yes" active="yes"/> <layer number="1" name="Top" color="4" fill="1" visible="no" active="yes"/>
<layer number="2" name="Route2" color="1" fill="3" visible="no" active="no"/> <layer number="2" name="Route2" color="1" fill="3" visible="no" active="no"/>
<layer number="3" name="Route3" color="4" fill="3" visible="no" active="no"/> <layer number="3" name="Route3" color="4" fill="3" visible="no" active="no"/>
<layer number="4" name="Route4" color="1" fill="4" visible="no" active="no"/> <layer number="4" name="Route4" color="1" fill="4" visible="no" active="no"/>
@ -26,17 +26,17 @@
<layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/> <layer number="16" name="Bottom" color="1" fill="1" visible="yes" active="yes"/>
<layer number="17" name="Pads" color="2" fill="1" visible="yes" active="yes"/> <layer number="17" name="Pads" color="2" fill="1" visible="yes" active="yes"/>
<layer number="18" name="Vias" color="2" fill="1" visible="yes" active="yes"/> <layer number="18" name="Vias" color="2" fill="1" visible="yes" active="yes"/>
<layer number="19" name="Unrouted" color="6" fill="1" visible="no" active="yes"/> <layer number="19" name="Unrouted" color="6" fill="1" visible="yes" active="yes"/>
<layer number="20" name="Dimension" color="15" fill="1" visible="yes" active="yes"/> <layer number="20" name="Dimension" color="15" fill="1" visible="yes" active="yes"/>
<layer number="21" name="tPlace" color="7" fill="1" visible="yes" active="yes"/> <layer number="21" name="tPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="22" name="bPlace" color="7" fill="1" visible="no" active="yes"/> <layer number="22" name="bPlace" color="7" fill="1" visible="yes" active="yes"/>
<layer number="23" name="tOrigins" color="15" fill="1" visible="no" active="yes"/> <layer number="23" name="tOrigins" color="15" fill="1" visible="no" active="yes"/>
<layer number="24" name="bOrigins" color="15" fill="1" visible="no" active="yes"/> <layer number="24" name="bOrigins" color="15" fill="1" visible="no" active="yes"/>
<layer number="25" name="tNames" color="7" fill="1" visible="yes" active="yes"/> <layer number="25" name="tNames" color="7" fill="1" visible="yes" active="yes"/>
<layer number="26" name="bNames" color="7" fill="1" visible="no" active="yes"/> <layer number="26" name="bNames" color="7" fill="1" visible="no" active="yes"/>
<layer number="27" name="tValues" color="7" fill="1" visible="no" active="yes"/> <layer number="27" name="tValues" color="7" fill="1" visible="no" active="yes"/>
<layer number="28" name="bValues" color="7" fill="1" visible="no" active="yes"/> <layer number="28" name="bValues" color="7" fill="1" visible="no" active="yes"/>
<layer number="29" name="tStop" color="7" fill="3" visible="no" active="yes"/> <layer number="29" name="tStop" color="7" fill="3" visible="yes" active="yes"/>
<layer number="30" name="bStop" color="7" fill="6" visible="yes" active="yes"/> <layer number="30" name="bStop" color="7" fill="6" visible="yes" active="yes"/>
<layer number="31" name="tCream" color="7" fill="4" visible="no" active="yes"/> <layer number="31" name="tCream" color="7" fill="4" visible="no" active="yes"/>
<layer number="32" name="bCream" color="7" fill="5" visible="no" active="yes"/> <layer number="32" name="bCream" color="7" fill="5" visible="no" active="yes"/>
@ -121,16 +121,6 @@
<vertex x="76.835" y="22.225"/> <vertex x="76.835" y="22.225"/>
<vertex x="69.215" y="29.845"/> <vertex x="69.215" y="29.845"/>
</polygon> </polygon>
<hole x="38.735" y="3.175" drill="1"/>
<hole x="45.72" y="29.845" drill="1"/>
<hole x="50.8" y="29.845" drill="1"/>
<hole x="45.72" y="3.175" drill="1"/>
<hole x="50.8" y="3.175" drill="1"/>
<hole x="66.675" y="3.175" drill="1"/>
<hole x="66.675" y="29.845" drill="1"/>
<hole x="81.915" y="29.845" drill="1"/>
<hole x="81.915" y="3.175" drill="1"/>
<hole x="38.735" y="29.845" drill="1"/>
<rectangle x1="71.12" y1="27.305" x2="74.295" y2="30.48" layer="21" rot="R45"/> <rectangle x1="71.12" y1="27.305" x2="74.295" y2="30.48" layer="21" rot="R45"/>
<text x="70.485" y="29.845" size="1.27" layer="25" font="vector" ratio="10">1</text> <text x="70.485" y="29.845" size="1.27" layer="25" font="vector" ratio="10">1</text>
<text x="81.915" y="5.715" size="1.27" layer="25" font="vector" ratio="10" rot="R135">GND</text> <text x="81.915" y="5.715" size="1.27" layer="25" font="vector" ratio="10" rot="R135">GND</text>
@ -805,11 +795,11 @@ design rules under a new name.</description>
<attribute name="VALUE" x="18.7706" y="5.715" size="1.27" layer="27" ratio="10" rot="R180"/> <attribute name="VALUE" x="18.7706" y="5.715" size="1.27" layer="27" ratio="10" rot="R180"/>
</element> </element>
<element name="LED1" library="SparkFun" package="LED5MM" value="" x="5.715" y="3.81" smashed="yes" rot="R90"> <element name="LED1" library="SparkFun" package="LED5MM" value="" x="5.715" y="3.81" smashed="yes" rot="R90">
<attribute name="NAME" x="9.525" y="8.3566" size="1.27" layer="25" font="vector" ratio="10" rot="R180"/> <attribute name="NAME" x="8.89" y="1.1684" size="1.27" layer="25" font="vector" ratio="10"/>
<attribute name="VALUE" x="7.5184" y="7.0104" size="1.27" layer="27" ratio="10" rot="R90"/> <attribute name="VALUE" x="7.5184" y="7.0104" size="1.27" layer="27" ratio="10" rot="R90"/>
</element> </element>
<element name="LED2" library="SparkFun" package="LED5MM" value="" x="5.715" y="29.21" smashed="yes" rot="R90"> <element name="LED2" library="SparkFun" package="LED5MM" value="" x="5.715" y="29.21" smashed="yes" rot="R90">
<attribute name="NAME" x="9.525" y="25.5016" size="1.27" layer="25" font="vector" ratio="10" rot="R180"/> <attribute name="NAME" x="13.335" y="31.8516" size="1.27" layer="25" font="vector" ratio="10" rot="R180"/>
<attribute name="VALUE" x="7.5184" y="32.4104" size="1.27" layer="27" ratio="10" rot="R90"/> <attribute name="VALUE" x="7.5184" y="32.4104" size="1.27" layer="27" ratio="10" rot="R90"/>
</element> </element>
<element name="JP1" library="pinhead" package="1X03" value="" x="75.19" y="5.877" smashed="yes" rot="R45"> <element name="JP1" library="pinhead" package="1X03" value="" x="75.19" y="5.877" smashed="yes" rot="R45">
@ -985,9 +975,7 @@ design rules under a new name.</description>
<via x="73.66" y="15.24" extent="1-16" drill="0.6"/> <via x="73.66" y="15.24" extent="1-16" drill="0.6"/>
<via x="73.66" y="17.78" extent="1-16" drill="0.6"/> <via x="73.66" y="17.78" extent="1-16" drill="0.6"/>
<via x="73.66" y="20.32" extent="1-16" drill="0.6"/> <via x="73.66" y="20.32" extent="1-16" drill="0.6"/>
<via x="9.525" y="3.81" extent="1-16" drill="0.6"/>
<via x="22.86" y="1.905" extent="1-16" drill="0.6"/> <via x="22.86" y="1.905" extent="1-16" drill="0.6"/>
<via x="10.795" y="3.175" extent="1-16" drill="0.6"/>
<via x="3.175" y="7.62" extent="1-16" drill="0.6" alwaysstop="yes"/> <via x="3.175" y="7.62" extent="1-16" drill="0.6" alwaysstop="yes"/>
<via x="3.175" y="8.89" extent="1-16" drill="0.6" alwaysstop="yes"/> <via x="3.175" y="8.89" extent="1-16" drill="0.6" alwaysstop="yes"/>
<via x="3.81" y="10.16" extent="1-16" drill="0.6" alwaysstop="yes"/> <via x="3.81" y="10.16" extent="1-16" drill="0.6" alwaysstop="yes"/>
@ -1019,8 +1007,21 @@ design rules under a new name.</description>
<via x="48.26" y="3.175" extent="1-16" drill="0.6"/> <via x="48.26" y="3.175" extent="1-16" drill="0.6"/>
<via x="76.835" y="31.115" extent="1-16" drill="0.6"/> <via x="76.835" y="31.115" extent="1-16" drill="0.6"/>
<via x="36.195" y="1.905" extent="1-16" drill="0.6"/> <via x="36.195" y="1.905" extent="1-16" drill="0.6"/>
<via x="5.715" y="10.16" extent="1-16" drill="0.8" alwaysstop="yes"/> <wire x1="8.5" y1="21.59" x2="8.5" y2="11.43" width="1.9304" layer="16"/>
<via x="5.715" y="22.86" extent="1-16" drill="0.8" alwaysstop="yes"/> <via x="5.715" y="8.89" extent="1-16" drill="1.4"/>
<via x="5.715" y="24.13" extent="1-16" drill="1.4"/>
<via x="38.735" y="3.175" extent="1-16" drill="1.4"/>
<via x="45.72" y="3.175" extent="1-16" drill="1.4"/>
<via x="50.8" y="3.175" extent="1-16" drill="1.4"/>
<via x="66.675" y="3.175" extent="1-16" drill="1.4"/>
<via x="81.28" y="3.175" extent="1-16" drill="1.4"/>
<via x="81.28" y="29.845" extent="1-16" drill="1.4"/>
<via x="66.675" y="29.845" extent="1-16" drill="1.4"/>
<via x="45.72" y="29.845" extent="1-16" drill="1.4"/>
<via x="50.8" y="29.845" extent="1-16" drill="1.4"/>
<via x="38.735" y="29.845" extent="1-16" drill="1.4"/>
<via x="15.875" y="20.955" extent="1-16" drill="1.4"/>
<via x="15.875" y="12.065" extent="1-16" drill="1.4"/>
</signal> </signal>
<signal name="N$17"> <signal name="N$17">
<contactref element="IC1" pad="21"/> <contactref element="IC1" pad="21"/>
@ -1249,41 +1250,43 @@ design rules under a new name.</description>
<via x="55.88" y="10.16" extent="1-16" drill="0.6"/> <via x="55.88" y="10.16" extent="1-16" drill="0.6"/>
</signal> </signal>
<signal name="N$1"> <signal name="N$1">
<via x="2.54" y="19.05" extent="1-16" drill="0.8" diameter="1.6764"/> <via x="2.54" y="19.05" extent="1-16" drill="0.8" diameter="1.6764" alwaysstop="yes"/>
</signal> </signal>
<signal name="N$2"> <signal name="N$2">
<via x="6.35" y="19.05" extent="1-16" drill="0.8" diameter="1.6764"/> <via x="6.35" y="19.05" extent="1-16" drill="0.8" diameter="1.6764" alwaysstop="yes"/>
</signal> </signal>
<signal name="N$4"> <signal name="N$4">
<via x="6.35" y="13.97" extent="1-16" drill="0.8" diameter="1.6764"/> <via x="6.35" y="13.97" extent="1-16" drill="0.8" diameter="1.6764" alwaysstop="yes"/>
</signal> </signal>
<signal name="N$6"> <signal name="N$6">
<via x="2.54" y="13.97" extent="1-16" drill="0.8" diameter="1.6764"/> <via x="2.54" y="13.97" extent="1-16" drill="0.8" diameter="1.6764" alwaysstop="yes"/>
</signal> </signal>
</signals> </signals>
<errors> <errors>
<approved hash="4,1,0e816175a161ce95"/>
<approved hash="4,1,e3bea33b6a2e2300"/>
<approved hash="4,1,96b5f92a393e56a1"/> <approved hash="4,1,96b5f92a393e56a1"/>
<approved hash="4,1,5e2ece186f27ab73"/> <approved hash="4,1,5e2ece186f27ab73"/>
<approved hash="4,1,7a310f055363fa48"/> <approved hash="4,1,7a310f055363fa48"/>
<approved hash="4,1,0e816175a161ce95"/>
<approved hash="4,1,e3bea33b6a2e2300"/>
<approved hash="19,1,745b54f6428adb83"/> <approved hash="19,1,745b54f6428adb83"/>
<approved hash="19,1,722f5724f9b263e3"/> <approved hash="19,1,722f5724f9b263e3"/>
<approved hash="19,1,3188434058a66639"/> <approved hash="19,1,3188434058a66639"/>
<approved hash="4,1,e90bf95a32e50bb1"/>
<approved hash="4,1,28590a4d2a30805a"/> <approved hash="4,1,28590a4d2a30805a"/>
<approved hash="4,1,e90bf95a32e50bb1"/>
<approved hash="4,1,6dc05f52994389a4"/> <approved hash="4,1,6dc05f52994389a4"/>
<approved hash="4,16,efdebeaa7ea12fd5"/>
<approved hash="4,16,e3bea33b6a2e2300"/>
<approved hash="4,16,cc2a96f1cecc6c6e"/>
<approved hash="4,16,a8c02ea2df0fa4fb"/>
<approved hash="4,16,74c1c480a4f4492b"/>
<approved hash="4,16,77ea26f5e6feb7e1"/> <approved hash="4,16,77ea26f5e6feb7e1"/>
<approved hash="4,16,8c5876c7b6d54c4a"/>
<approved hash="4,16,5e2ece186f27ab73"/> <approved hash="4,16,5e2ece186f27ab73"/>
<approved hash="4,16,e90bf95a32e50bb1"/> <approved hash="4,16,efdebeaa7ea12fd5"/>
<approved hash="4,16,146cee982e8ad47e"/>
<approved hash="4,16,e3bea33b6a2e2300"/>
<approved hash="4,16,a8c02ea2df0fa4fb"/>
<approved hash="4,16,cc2a96f1cecc6c6e"/>
<approved hash="4,16,74c1c480a4f4492b"/>
<approved hash="4,16,28590a4d2a30805a"/> <approved hash="4,16,28590a4d2a30805a"/>
<approved hash="4,16,f481dbbd374b7f72"/> <approved hash="4,16,e90bf95a32e50bb1"/>
<approved hash="4,16,4d7d0449a45e317d"/> <approved hash="4,16,4d7d0449a45e317d"/>
<approved hash="4,16,f481dbbd374b7f72"/>
<approved hash="4,16,1aea4524c7309866"/> <approved hash="4,16,1aea4524c7309866"/>
</errors> </errors>
</board> </board>