Added Joystick Shield files

This commit is contained in:
Charles Mangin 2013-10-24 11:35:45 -04:00
parent e018531870
commit 3cf7e2cf3c
22 changed files with 32906 additions and 102 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -184,6 +184,7 @@ char modifierKeys[4];
unsigned long dTime = 0;
char CAPSState; // Initialize this to a reasonable value.
boolean FKEYS = false; // used to set numbers to F-Key equivalent. currently tied to caps lock
void setup(){
@ -222,6 +223,9 @@ void loop()
resetCapsLock = false;
}
FKEYS = CAPSState;
/*char CAPSState = digitalRead(CAPSPin);
if (CAPSState == LOW) {
Keyboard.set_key6(KEY_CAPS_LOCK);
@ -300,10 +304,33 @@ void loop()
Keyboard.set_key4(0);
Keyboard.set_key5(0);
//Keyboard.set_key6(0);
/* based on suggestion from Craig Brooks <s.craig.brooks@gmail.com>
uses CAPS LOCK to turn number keys into F-Key equivalent.
*/
// Update keyboard keys to active values.
if( KPD.key[0].kchar && ( KPD.key[0].kstate==PRESSED || KPD.key[0].kstate==HOLD ))
Keyboard.set_key1( KPD.key[0].kchar );
if( KPD.key[0].kchar && ( KPD.key[0].kstate==PRESSED || KPD.key[0].kstate==HOLD )) {
//Serial.println(FKEYS);
if (FKEYS) {
if((KPD.key[0].kchar >= 0x1E) && (KPD.key[0].kchar <= 0x27)){
KPD.key[0].kchar += 0x1C;
// Serial.println( KPD.key[0].kchar, HEX );
}
}
Keyboard.set_key1( KPD.key[0].kchar );
}
if( KPD.key[1].kchar && ( KPD.key[1].kstate==PRESSED || KPD.key[1].kstate==HOLD ))
Keyboard.set_key2( KPD.key[1].kchar );

View File

@ -162,7 +162,7 @@ void setup(){
// DEBUG
Serial.begin(115200);
// Serial.begin(115200);
}
@ -288,14 +288,14 @@ FKEYS = CAPSState;
// Update keyboard keys to active values.
if( KPD.key[0].kchar && ( KPD.key[0].kstate==PRESSED || KPD.key[0].kstate==HOLD )) {
Serial.println(FKEYS);
//Serial.println(FKEYS);
if (FKEYS) {
if((KPD.key[0].kchar >= 0x1E) && (KPD.key[0].kchar <= 0x27)){
KPD.key[0].kchar += 0x1C;
Serial.println( KPD.key[0].kchar, HEX );
// Serial.println( KPD.key[0].kchar, HEX );
}

View File

@ -0,0 +1,19 @@
5 DP = .10: REM Deadzone Percentage
10 XLEFT = 0:YUP = 0:XRIGHT = 279:YBOT = 159: REM Screen Bounds
15 REM Set target box coordinates
20 HALF = XRIGHT / 2:D1 = INT (HALF - (HALF * DP)):D2 = INT (HALF + (HALF * DP))
25 HALF = YBOT / 2:D3 = INT (HALF - (HALF * DP)):D4 = INT (HALF + (HALF * DP))
30 HGR : HCOLOR= 3
35 REM Draw edge box
40 X1 = XLEFT:Y1 = YUP:X2 = XRIGHT:Y2 = YBOT: GOSUB 2000:X1 = X1 + 1:X2 = X2 - 1:Y1 = Y1 + 1:Y2 = Y2 - 1: GOSUB 2000
50 P0 = PDL (0):P1 = PDL (1): GOSUB 3000
55 PRINT P0,P1
60 GOTO 50
2000 HPLOT X1,Y1 TO X1,Y2: HPLOT X1,Y2 TO X2,Y2: HPLOT X2,Y2 TO X2,Y1: HPLOT X2,Y1 TO X1,Y1
2002 RETURN
3000 X = INT (P0 * 274 / 255 + 2):Y = INT (P1 * 154 / 255 + 2)
3010 X1 = X:X2 = X + 1:Y1 = Y:Y2 = Y1 + 1: GOSUB 2000
3020 GOSUB 4000: HCOLOR= 0: GOSUB 2000: HCOLOR= 3
3050 RETURN
4000 HPLOT D1,D3 TO D1,D4: HPLOT D1,D4 TO D2,D4: HPLOT D2,D4 TO D2,D3: HPLOT D2,D3 TO D1,D3
4010 RETURN : REM End Draw Target Box

View File

@ -0,0 +1,26 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10R,2.372210X1.355550*%
%ADD11C,0.008000*%
%ADD10C,0.008*%
%LNCONTOUR*%
G90*
G70*
G54D10*
G54D11*
X4Y1352D02*
X2368Y1352D01*
X2368Y4D01*
X4Y4D01*
X4Y1352D01*
D02*
G04 End of contour*
M02*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
M48
INCH
T10C0.040000
T11C0.130000
T12C0.035000
%
T10
X022409Y004863
X022409Y005953
X022409Y007040
X022409Y008130
X021291Y004315
X021291Y005406
X021291Y006497
X021291Y007587
X021291Y008678
T11
X021850Y001575
X021850Y011418
T12
X014791Y012906
X011791Y012906
X010791Y011906
X007791Y011906
X014291Y001906
X017291Y001906
X010791Y001906
X007791Y001906
X011791Y009906
X011791Y003906
X010791Y009906
X010791Y003906
X009791Y009906
X009791Y003906
X008791Y009906
X008791Y003906
X007791Y009906
X007791Y003906
X006791Y009906
X006791Y003906
X005791Y009906
X005791Y003906
X004791Y009906
X004791Y003906
X003791Y009906
X003791Y003906
X002791Y009906
X002791Y003906
X001791Y009906
X001791Y003906
X000791Y009906
X000791Y003906
X018791Y003906
X015791Y003906
X018791Y004906
X015791Y004906
X018791Y005906
X015791Y005906
X018791Y006906
X015791Y006906
X018791Y007906
X015791Y007906
X018791Y008906
X015791Y008906
X018791Y009906
X015791Y009906
X018791Y010906
X015791Y010906
T00
M30

View File

@ -0,0 +1,321 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.084000*%
%ADD11C,0.210000*%
%ADD12C,0.085000*%
%ADD13R,0.085000X0.085000*%
%ADD14R,0.001000X0.001000*%
%LNMASK0*%
G90*
G70*
G54D10*
X2129Y868D03*
X2129Y759D03*
X2129Y650D03*
X2129Y541D03*
X2129Y432D03*
X2241Y813D03*
X2241Y704D03*
X2241Y595D03*
X2241Y486D03*
G54D11*
X2185Y1142D03*
X2185Y158D03*
G54D12*
X1579Y1091D03*
X1879Y1091D03*
X1579Y991D03*
X1879Y991D03*
X1579Y891D03*
X1879Y891D03*
X1579Y791D03*
X1879Y791D03*
X1579Y691D03*
X1879Y691D03*
X1579Y591D03*
X1879Y591D03*
X1579Y491D03*
X1879Y491D03*
X1579Y391D03*
X1879Y391D03*
X79Y391D03*
X79Y991D03*
X179Y391D03*
X179Y991D03*
X279Y391D03*
X279Y991D03*
X379Y391D03*
X379Y991D03*
X479Y391D03*
X479Y991D03*
X579Y391D03*
X579Y991D03*
X679Y391D03*
X679Y991D03*
X779Y391D03*
X779Y991D03*
X879Y391D03*
X879Y991D03*
X979Y391D03*
X979Y991D03*
X1079Y391D03*
X1079Y991D03*
X1179Y391D03*
X1179Y991D03*
X779Y191D03*
X1079Y191D03*
X1729Y191D03*
X1429Y191D03*
X779Y1191D03*
X1079Y1191D03*
X1179Y1291D03*
X1479Y1291D03*
G54D13*
X1579Y1091D03*
X79Y391D03*
X779Y191D03*
X1729Y191D03*
X779Y1191D03*
X1179Y1291D03*
G54D14*
X2161Y911D02*
X2249Y911D01*
X2087Y910D02*
X2249Y910D01*
X2087Y909D02*
X2249Y909D01*
X2087Y908D02*
X2249Y908D01*
X2087Y907D02*
X2249Y907D01*
X2087Y906D02*
X2249Y906D01*
X2087Y905D02*
X2249Y905D01*
X2087Y904D02*
X2249Y904D01*
X2087Y903D02*
X2249Y903D01*
X2087Y902D02*
X2249Y902D01*
X2087Y901D02*
X2249Y901D01*
X2087Y900D02*
X2170Y900D01*
X2087Y899D02*
X2170Y899D01*
X2087Y898D02*
X2170Y898D01*
X2087Y897D02*
X2170Y897D01*
X2087Y896D02*
X2170Y896D01*
X2087Y895D02*
X2170Y895D01*
X2087Y894D02*
X2170Y894D01*
X2087Y893D02*
X2170Y893D01*
X2087Y892D02*
X2170Y892D01*
X2087Y891D02*
X2170Y891D01*
X2087Y890D02*
X2170Y890D01*
X2087Y889D02*
X2170Y889D01*
X2087Y888D02*
X2170Y888D01*
X2087Y887D02*
X2170Y887D01*
X2087Y886D02*
X2170Y886D01*
X2087Y885D02*
X2170Y885D01*
X2087Y884D02*
X2170Y884D01*
X2087Y883D02*
X2122Y883D01*
X2135Y883D02*
X2170Y883D01*
X2087Y882D02*
X2120Y882D01*
X2137Y882D02*
X2170Y882D01*
X2087Y881D02*
X2118Y881D01*
X2138Y881D02*
X2170Y881D01*
X2087Y880D02*
X2117Y880D01*
X2140Y880D02*
X2170Y880D01*
X2087Y879D02*
X2116Y879D01*
X2141Y879D02*
X2170Y879D01*
X2087Y878D02*
X2116Y878D01*
X2141Y878D02*
X2170Y878D01*
X2087Y877D02*
X2115Y877D01*
X2142Y877D02*
X2170Y877D01*
X2087Y876D02*
X2114Y876D01*
X2142Y876D02*
X2170Y876D01*
X2087Y875D02*
X2114Y875D01*
X2143Y875D02*
X2170Y875D01*
X2087Y874D02*
X2114Y874D01*
X2143Y874D02*
X2170Y874D01*
X2087Y873D02*
X2113Y873D01*
X2143Y873D02*
X2170Y873D01*
X2087Y872D02*
X2113Y872D01*
X2144Y872D02*
X2170Y872D01*
X2087Y871D02*
X2113Y871D01*
X2144Y871D02*
X2170Y871D01*
X2087Y870D02*
X2113Y870D01*
X2144Y870D02*
X2170Y870D01*
X2087Y869D02*
X2113Y869D01*
X2144Y869D02*
X2170Y869D01*
X2087Y868D02*
X2113Y868D01*
X2144Y868D02*
X2170Y868D01*
X2087Y867D02*
X2113Y867D01*
X2144Y867D02*
X2170Y867D01*
X2087Y866D02*
X2113Y866D01*
X2144Y866D02*
X2170Y866D01*
X2087Y865D02*
X2113Y865D01*
X2144Y865D02*
X2170Y865D01*
X2087Y864D02*
X2114Y864D01*
X2143Y864D02*
X2170Y864D01*
X2087Y863D02*
X2114Y863D01*
X2143Y863D02*
X2170Y863D01*
X2087Y862D02*
X2114Y862D01*
X2142Y862D02*
X2170Y862D01*
X2087Y861D02*
X2115Y861D01*
X2142Y861D02*
X2170Y861D01*
X2087Y860D02*
X2116Y860D01*
X2141Y860D02*
X2170Y860D01*
X2087Y859D02*
X2116Y859D01*
X2141Y859D02*
X2170Y859D01*
X2087Y858D02*
X2117Y858D01*
X2140Y858D02*
X2170Y858D01*
X2087Y857D02*
X2118Y857D01*
X2139Y857D02*
X2170Y857D01*
X2087Y856D02*
X2120Y856D01*
X2137Y856D02*
X2170Y856D01*
X2087Y855D02*
X2122Y855D01*
X2135Y855D02*
X2170Y855D01*
X2087Y854D02*
X2127Y854D01*
X2130Y854D02*
X2170Y854D01*
X2087Y853D02*
X2170Y853D01*
X2087Y852D02*
X2170Y852D01*
X2087Y851D02*
X2170Y851D01*
X2087Y850D02*
X2170Y850D01*
X2087Y849D02*
X2170Y849D01*
X2087Y848D02*
X2170Y848D01*
X2087Y847D02*
X2170Y847D01*
X2087Y846D02*
X2170Y846D01*
X2087Y845D02*
X2170Y845D01*
X2087Y844D02*
X2170Y844D01*
X2087Y843D02*
X2170Y843D01*
X2087Y842D02*
X2170Y842D01*
X2087Y841D02*
X2170Y841D01*
X2087Y840D02*
X2170Y840D01*
X2087Y839D02*
X2170Y839D01*
X2087Y838D02*
X2170Y838D01*
X2087Y837D02*
X2170Y837D01*
X2087Y836D02*
X2170Y836D01*
X2087Y835D02*
X2170Y835D01*
X2087Y834D02*
X2170Y834D01*
X2087Y833D02*
X2170Y833D01*
X2087Y832D02*
X2170Y832D01*
X2087Y831D02*
X2170Y831D01*
X2087Y830D02*
X2170Y830D01*
X2087Y829D02*
X2170Y829D01*
X2087Y828D02*
X2170Y828D01*
X2087Y827D02*
X2169Y827D01*
D02*
G04 End of Mask0*
M02*

View File

@ -0,0 +1,334 @@
G04 MADE WITH FRITZING*
G04 WWW.FRITZING.ORG*
G04 DOUBLE SIDED*
G04 HOLES PLATED*
G04 CONTOUR ON CENTER OF CONTOUR VECTOR*
%ASAXBY*%
%FSLAX23Y23*%
%MOIN*%
%OFA0B0*%
%SFA1.0B1.0*%
%ADD10C,0.084000*%
%ADD11C,0.210000*%
%ADD12C,0.085000*%
%ADD13R,0.085000X0.085000*%
%ADD14R,0.001000X0.001000*%
%LNMASK1*%
G90*
G70*
G54D10*
X2129Y868D03*
X2129Y759D03*
X2129Y650D03*
X2129Y541D03*
X2129Y432D03*
X2241Y813D03*
X2241Y704D03*
X2241Y595D03*
X2241Y486D03*
G54D11*
X2185Y1142D03*
X2185Y158D03*
G54D10*
X2129Y868D03*
X2129Y759D03*
X2129Y650D03*
X2129Y541D03*
X2129Y432D03*
X2241Y813D03*
X2241Y704D03*
X2241Y595D03*
X2241Y486D03*
G54D11*
X2185Y1142D03*
X2185Y158D03*
G54D12*
X1579Y1091D03*
X1879Y1091D03*
X1579Y991D03*
X1879Y991D03*
X1579Y891D03*
X1879Y891D03*
X1579Y791D03*
X1879Y791D03*
X1579Y691D03*
X1879Y691D03*
X1579Y591D03*
X1879Y591D03*
X1579Y491D03*
X1879Y491D03*
X1579Y391D03*
X1879Y391D03*
X79Y391D03*
X79Y991D03*
X179Y391D03*
X179Y991D03*
X279Y391D03*
X279Y991D03*
X379Y391D03*
X379Y991D03*
X479Y391D03*
X479Y991D03*
X579Y391D03*
X579Y991D03*
X679Y391D03*
X679Y991D03*
X779Y391D03*
X779Y991D03*
X879Y391D03*
X879Y991D03*
X979Y391D03*
X979Y991D03*
X1079Y391D03*
X1079Y991D03*
X1179Y391D03*
X1179Y991D03*
X779Y191D03*
X1079Y191D03*
X1729Y191D03*
X1429Y191D03*
X779Y1191D03*
X1079Y1191D03*
X1179Y1291D03*
X1479Y1291D03*
G54D13*
X1579Y1091D03*
X79Y391D03*
X779Y191D03*
X1729Y191D03*
X779Y1191D03*
X1179Y1291D03*
G54D14*
X2161Y911D02*
X2249Y911D01*
X2087Y910D02*
X2249Y910D01*
X2087Y909D02*
X2249Y909D01*
X2087Y908D02*
X2249Y908D01*
X2087Y907D02*
X2249Y907D01*
X2087Y906D02*
X2249Y906D01*
X2087Y905D02*
X2249Y905D01*
X2087Y904D02*
X2249Y904D01*
X2087Y903D02*
X2249Y903D01*
X2087Y902D02*
X2249Y902D01*
X2087Y901D02*
X2249Y901D01*
X2087Y900D02*
X2170Y900D01*
X2087Y899D02*
X2170Y899D01*
X2087Y898D02*
X2170Y898D01*
X2087Y897D02*
X2170Y897D01*
X2087Y896D02*
X2170Y896D01*
X2087Y895D02*
X2170Y895D01*
X2087Y894D02*
X2170Y894D01*
X2087Y893D02*
X2170Y893D01*
X2087Y892D02*
X2170Y892D01*
X2087Y891D02*
X2170Y891D01*
X2087Y890D02*
X2170Y890D01*
X2087Y889D02*
X2170Y889D01*
X2087Y888D02*
X2170Y888D01*
X2087Y887D02*
X2170Y887D01*
X2087Y886D02*
X2170Y886D01*
X2087Y885D02*
X2170Y885D01*
X2087Y884D02*
X2170Y884D01*
X2087Y883D02*
X2122Y883D01*
X2135Y883D02*
X2170Y883D01*
X2087Y882D02*
X2120Y882D01*
X2137Y882D02*
X2170Y882D01*
X2087Y881D02*
X2118Y881D01*
X2138Y881D02*
X2170Y881D01*
X2087Y880D02*
X2117Y880D01*
X2140Y880D02*
X2170Y880D01*
X2087Y879D02*
X2116Y879D01*
X2141Y879D02*
X2170Y879D01*
X2087Y878D02*
X2116Y878D01*
X2141Y878D02*
X2170Y878D01*
X2087Y877D02*
X2115Y877D01*
X2142Y877D02*
X2170Y877D01*
X2087Y876D02*
X2114Y876D01*
X2142Y876D02*
X2170Y876D01*
X2087Y875D02*
X2114Y875D01*
X2143Y875D02*
X2170Y875D01*
X2087Y874D02*
X2114Y874D01*
X2143Y874D02*
X2170Y874D01*
X2087Y873D02*
X2113Y873D01*
X2143Y873D02*
X2170Y873D01*
X2087Y872D02*
X2113Y872D01*
X2144Y872D02*
X2170Y872D01*
X2087Y871D02*
X2113Y871D01*
X2144Y871D02*
X2170Y871D01*
X2087Y870D02*
X2113Y870D01*
X2144Y870D02*
X2170Y870D01*
X2087Y869D02*
X2113Y869D01*
X2144Y869D02*
X2170Y869D01*
X2087Y868D02*
X2113Y868D01*
X2144Y868D02*
X2170Y868D01*
X2087Y867D02*
X2113Y867D01*
X2144Y867D02*
X2170Y867D01*
X2087Y866D02*
X2113Y866D01*
X2144Y866D02*
X2170Y866D01*
X2087Y865D02*
X2113Y865D01*
X2144Y865D02*
X2170Y865D01*
X2087Y864D02*
X2114Y864D01*
X2143Y864D02*
X2170Y864D01*
X2087Y863D02*
X2114Y863D01*
X2143Y863D02*
X2170Y863D01*
X2087Y862D02*
X2114Y862D01*
X2142Y862D02*
X2170Y862D01*
X2087Y861D02*
X2115Y861D01*
X2142Y861D02*
X2170Y861D01*
X2087Y860D02*
X2116Y860D01*
X2141Y860D02*
X2170Y860D01*
X2087Y859D02*
X2116Y859D01*
X2141Y859D02*
X2170Y859D01*
X2087Y858D02*
X2117Y858D01*
X2140Y858D02*
X2170Y858D01*
X2087Y857D02*
X2118Y857D01*
X2139Y857D02*
X2170Y857D01*
X2087Y856D02*
X2120Y856D01*
X2137Y856D02*
X2170Y856D01*
X2087Y855D02*
X2122Y855D01*
X2135Y855D02*
X2170Y855D01*
X2087Y854D02*
X2127Y854D01*
X2130Y854D02*
X2170Y854D01*
X2087Y853D02*
X2170Y853D01*
X2087Y852D02*
X2170Y852D01*
X2087Y851D02*
X2170Y851D01*
X2087Y850D02*
X2170Y850D01*
X2087Y849D02*
X2170Y849D01*
X2087Y848D02*
X2170Y848D01*
X2087Y847D02*
X2170Y847D01*
X2087Y846D02*
X2170Y846D01*
X2087Y845D02*
X2170Y845D01*
X2087Y844D02*
X2170Y844D01*
X2087Y843D02*
X2170Y843D01*
X2087Y842D02*
X2170Y842D01*
X2087Y841D02*
X2170Y841D01*
X2087Y840D02*
X2170Y840D01*
X2087Y839D02*
X2170Y839D01*
X2087Y838D02*
X2170Y838D01*
X2087Y837D02*
X2170Y837D01*
X2087Y836D02*
X2170Y836D01*
X2087Y835D02*
X2170Y835D01*
X2087Y834D02*
X2170Y834D01*
X2087Y833D02*
X2170Y833D01*
X2087Y832D02*
X2170Y832D01*
X2087Y831D02*
X2170Y831D01*
X2087Y830D02*
X2170Y830D01*
X2087Y829D02*
X2170Y829D01*
X2087Y828D02*
X2170Y828D01*
X2087Y827D02*
X2169Y827D01*
D02*
G04 End of Mask1*
M02*

View File

@ -0,0 +1,46 @@
*Pick And Place List
*Company=
*Author=
*eMail=
*
*Project=Joystick Shield PCB
*Date=09:57:57
*CreatedBy=Fritzing 0.8.3b.07.27.048f
*
*
*Coordinates in mm, always center of component
*Origin 0/0=Lower left corner of PCB
*Rotation in degree (0-360, math. pos.)
*
*No;Value;Package;X;Y;Rotation;Side;Name
1;;DIP (Dual Inline) [THT];15.9802;-17.5424;-90;Bottom;Teensy
2;;;48.6917;-21.3247;0;Bottom;Copper Fill5
3;;;26.797;-20.4103;0;Bottom;Copper Fill1
4;;;39.922;-30.7597;0;Bottom;TXT1
5;;;30.1244;-6.4911;0;Bottom;Copper Fill6
6;;;56.9496;-9.16967;0;Bottom;TXT1
7;;;30.1244;-11.8759;0;Bottom;Copper Fill16
8;;;16.4846;-25.5919;0;Bottom;Copper Fill3
9;220;THT;40.1102;-4.84236;180;Bottom;33KΩ
10;;;17.2974;-25.1855;0;Bottom;Copper Fill13
11;;DIP (Dual Inline) [THT];43.9202;-18.8124;0;Bottom;Game Port
12;;;47.2185;-17.5655;0;Bottom;Copper Fill11
13;;;11.0531;-32.2142;0;Bottom;TXT1
14;;;54.1273;-24.8801;0;Bottom;TXT1
15;;;57.2515;-31.0529;0;Bottom;Copper Fill9
16;;;42.6973;-23.2805;0;Bottom;Copper Fill2
17;;;38.2015;-29.5797;0;Bottom;Copper Fill7
18;220;THT;33.7602;-32.7824;0;Bottom;100KΩ
19;;;52.3239;-16.2447;0;Bottom;Copper Fill4
20;;;17.1196;-13.9079;0;Bottom;Copper Fill14
21;;;42.0369;-23.9409;0;Bottom;Copper Fill12
22;220;THT;23.6002;-30.2424;0;Bottom;100KΩ
23;;;8.02733;-30.0163;0;Bottom;TXT2
24;220;THT;23.6002;-4.84236;0;Bottom;33KΩ
25;;;5.0873;-4.2317;0;Bottom;IMG1
26;;;17.1196;-29.5797;0;Bottom;Copper Fill10
27;;db9;55.3702;-16.5025;90;Bottom;X1
28;;;14.4425;-1.30796;0;Bottom;TXT3
29;;;50.9269;-27.7509;0;Bottom;Copper Fill8
30;;;22.987;-13.7555;0;Bottom;Copper Fill15
31;;;48.0596;-30.3363;0;Bottom;TXT1

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -148,7 +148,7 @@ int CalibrationMax = 800; // allows for weird "jumpy" joystick potentiometers. t
Serial.print(" -- ");
Serial.print(digitalRead(Button1Pin));
Serial.println();
*/
// delay(100);
delay(100);
*/
}

View File

@ -1,95 +0,0 @@
/* Complete USB Joystick Example
Teensy becomes a USB joystick with 16 or 32 buttons and 6 axis input
You must select Joystick from the "Tools > USB Type" menu
Pushbuttons should be connected between the digital pins and ground.
Potentiometers should be connected to analog inputs 0 to 5.
This example code is in the public domain.
*/
// Configure the number of buttons. Be careful not
// to use a pin for both a digital button and analog
// axis. The pullup resistor will interfere with
// the analog voltage.
const int numButtons = 2; // 16 for Teensy, 32 for Teensy++
int XPin = A7;
int YPin = A8;
int Button0Pin = 9;
int Button1Pin = 10;
void setup() {
// you can print to the serial monitor while the joystick is active!
Serial.begin(9600);
// configure the joystick to manual send mode. This gives precise
// control over when the computer receives updates, but it does
// require you to manually call Joystick.send_now().
Joystick.useManualSend(true);
for (int i=Button0Pin; i<numButtons; i++) {
pinMode(i, INPUT);
}
Serial.println("Begin Complete Joystick Test");
}
byte allButtons[numButtons];
byte prevButtons[numButtons];
int angle=0;
void loop() {
// read 6 analog inputs and use them for the joystick axis
Joystick.X(analogRead(XPin));
Joystick.Y(analogRead(YPin));
// Joystick.Z(analogRead(2));
// Joystick.Zrotate(analogRead(3));
// Joystick.sliderLeft(analogRead(4));
// Joystick.sliderRight(analogRead(5));
// read digital pins and use them for the buttons
for (int i=Button0Pin; i<numButtons; i++) {
if (digitalRead(i)) {
// when a pin reads high, the button is not pressed
// the pullup resistor creates the "on" signal
allButtons[i] = 0;
} else {
// when a pin reads low, the button is connecting to ground.
allButtons[i] = 1;
}
Joystick.button(i + 1, allButtons[i]);
}
/*
// make the hat switch automatically move in a circle
angle = angle + 1;
if (angle >= 360) angle = 0;
Joystick.hat(angle);
*/
// Because setup configured the Joystick manual send,
// the computer does not see any of the changes yet.
// This send_now() transmits everything all at once.
Joystick.send_now();
// check to see if any button changed since last time
boolean anyChange = false;
for (int i=Button0Pin; i<numButtons; i++) {
if (allButtons[i] != prevButtons[i]) anyChange = true;
prevButtons[i] = allButtons[i];
}
// if any button changed, print them to the serial monitor
if (anyChange) {
Serial.print("Buttons: ");
for (int i=0; i<numButtons; i++) {
Serial.print(allButtons[i], DEC);
}
Serial.println();
}
// a brief delay, so this runs "only" 200 times per second
delay(5);
}

View File

@ -0,0 +1,67 @@
//--- SPI code
#define DATAOUT 11
#define SPICLOCK 13
#define SLAVESELECT 4
void SPIInitialize()
{
byte clr;
pinMode(DATAOUT, OUTPUT);
pinMode(SPICLOCK,OUTPUT);
pinMode(SLAVESELECT,OUTPUT);
digitalWrite(SLAVESELECT,HIGH); //disable device
SPCR = (1<<SPE)|(1<<MSTR);
clr=SPSR;
clr=SPDR;
delay(10);
}
char SPITransfer(volatile char data)
{
SPDR = data; // Start the transmission
while (!(SPSR & (1<<SPIF))) // Wait the end of the transmission
{
};
return SPDR; // return the received byte
}
//--- MCP42100 code
byte SetPot(int address, int value)
{
// Slave Select set low to allow commands
digitalWrite(SLAVESELECT, LOW);
// 2 byte command
SPITransfer(0x10 + address); // 0x10 = 'set pot' command
SPITransfer(value); // Value to set pot
// Release chip, signal end transfer
digitalWrite(SLAVESELECT, HIGH);
}
//--- Application code
void setup()
{
SPIInitialize(); // Initialize the SPI interface
SetPot(1,255);
SetPot(0,255);
}
void loop()
{
for (int level = 0; level < 255; level++) {
SetPot(1,level);;
SetPot(2,255 - level);;
delay(100);
}
}

View File

@ -0,0 +1,86 @@
#include <SPI.h>
// set pin 4 as the slave select for the digital pot:
const int slaveSelectPin = 4;
#include <avr/pgmspace.h>
#include <avrpins.h>
#include <max3421e.h>
#include <usbhost.h>
#include <usb_ch9.h>
#include <Usb.h>
#include <usbhub.h>
#include <avr/pgmspace.h>
#include <address.h>
#include <hid.h>
#include <hiduniversal.h>
#include "hidjoystickrptparser.h"
#include <printhex.h>
#include <message.h>
#include <hexdump.h>
#include <parsetools.h>
USB Usb;
USBHub Hub(&Usb);
HIDUniversal Hid(&Usb);
JoystickEvents JoyEvents;
JoystickReportParser Joy(&JoyEvents);
void setup()
{
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
Serial.begin( 115200 );
Serial.println("Start");
if (Usb.Init() == -1)
Serial.println("OSC did not start.");
delay( 200 );
if (!Hid.SetReportParser(0, &Joy))
ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1 );
}
void loop()
{
Usb.Task();
int joyX = .7 * JoyEvents.X;
digitalPotWrite(19, joyX);
// int joyY = JoyEvents.Y;
// digitalPotWrite(18, joyY);
}
int digitalPotWrite(int CommandByte, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
SPI.transfer(CommandByte);
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
}

View File

@ -0,0 +1,104 @@
#include "hidjoystickrptparser.h"
JoystickReportParser::JoystickReportParser(JoystickEvents *evt) :
joyEvents(evt),
oldHat(0xDE),
oldButtons(0)
{
for (uint8_t i=0; i<RPT_GEMEPAD_LEN; i++)
oldPad[i] = 0xD;
}
void JoystickReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf)
{
bool match = true;
// Checking if there are changes in report since the method was last called
for (uint8_t i=0; i<RPT_GEMEPAD_LEN; i++)
if (buf[i] != oldPad[i])
{
match = false;
break;
}
// Calling Game Pad event handler
if (!match && joyEvents)
{
joyEvents->OnGamePadChanged((const GamePadEventData*)buf);
for (uint8_t i=0; i<RPT_GEMEPAD_LEN; i++) oldPad[i] = buf[i];
}
uint16_t buttons = (0x0000 | buf[6]);
buttons <<= 4;
buttons |= (buf[5] >> 4);
uint16_t changes = (buttons ^ oldButtons);
// Calling Button Event Handler for every button changed
if (changes)
{
for (uint8_t i=0; i<0x0C; i++)
{
uint16_t mask = (0x0001 << i);
if (((mask & changes) > 0) && joyEvents)
if ((buttons & mask) > 0)
joyEvents->OnButtonDn(i+1);
else
joyEvents->OnButtonUp(i+1);
}
oldButtons = buttons;
}
}
void JoystickEvents::OnGamePadChanged(const GamePadEventData *evt)
{
X = evt->X;
Y = evt->Y;
Serial.print("X: ");
Serial.print(X);
//PrintHex<uint8_t>(evt->X, 0x80);
Serial.print("\tY: ");
Serial.print(Y);
// PrintHex<uint8_t>(evt->Y, 0x80);
Serial.println("");
}
void JoystickEvents::OnButtonUp(uint8_t but_id)
{
Serial.print("Up: ");
Serial.println(but_id);
if(but_id == 1) {
Butt0 = false;
}
if(but_id == 2) {
Butt1 = false;
}
}
void JoystickEvents::OnButtonDn(uint8_t but_id)
{
Serial.print("Dn: ");
Serial.println(but_id);
if(but_id == 1) {
Butt0 = true;
}
if(but_id == 2) {
Butt1 = true;
}
}

View File

@ -0,0 +1,60 @@
#if !defined(__HIDJOYSTICKRPTPARSER_H__)
#define __HIDJOYSTICKRPTPARSER_H__
#include <inttypes.h>
#include <avr/pgmspace.h>
#include "avrpins.h"
#include "max3421e.h"
#include "usbhost.h"
#include "usb_ch9.h"
#include "Usb.h"
#if defined(ARDUINO) && ARDUINO >=100
#include "Arduino.h"
#else
#include <WProgram.h>
#endif
#include "printhex.h"
#include "hexdump.h"
#include "message.h"
#include "confdescparser.h"
#include "hid.h"
struct GamePadEventData
{
uint8_t X, Y;
};
class JoystickEvents
{
public:
virtual void OnGamePadChanged(const GamePadEventData *evt);
virtual void OnButtonUp(uint8_t but_id);
virtual void OnButtonDn(uint8_t but_id);
uint8_t X;
uint8_t Y;
uint8_t Butt0;
uint8_t Butt1;
};
#define RPT_GEMEPAD_LEN 5
class JoystickReportParser : public HIDReportParser
{
JoystickEvents *joyEvents;
uint8_t oldPad[RPT_GEMEPAD_LEN];
uint8_t oldHat;
uint16_t oldButtons;
public:
JoystickReportParser(JoystickEvents *evt);
virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf);
};
#endif // __HIDJOYSTICKRPTPARSER_H__

View File

@ -0,0 +1,90 @@
/*
Digital Pot Control
Based on the original sketch for AD5206....
This example controls a Microchip digital potentiometer.
The MCP42 has 2 potentiometer channels. Each channel's pins are labeled
PAx - connect this to voltage
PWx - this is the pot's wiper, which changes when you set it
PBx - connect this to ground.
The MCP42 is SPI-compatible,and to command it, you send two bytes:
The first byte is the Command Byte which has this format when
the next byte is to be data: XX01XXpp
note these bits ...............^^.... the 01 means the next byte is data
(where pp = potentiometer selection, X= don't care)
pp= 00 = dummy code, no pot selected
pp= 01 = pot0
pp= 10 = pot1
pp= 11 = both pots
Simplest case is to have X= 0 so the Command Byte will be:
pp= 00: 00010000 = 16
pp= 01: 00010001 = 17
pp= 10: 00010010 = 18
pp= 11: 00010011 = 19
The second byte is the resistance value for the channel (0 - 255).
The circuit:
* All PA pins of MCP42 connected to +5V
* All PB pins of MCP42 connected to ground
* An LED and a 220-ohm resisor in series connected from each PW pin to ground
* CS - to digital pin 10 (SS pin)
* SI - to digital pin 11 (MOSI pin)
* SCK - to digital pin 13 (SCK pin)
created 10 Aug 2010
by Tom Igoe
Thanks to Heather Dewey-Hagborg for the original tutorial, 2005
Version for MCP42xx April 2013, Jim Brown
*/
// include the SPI library:
#include <SPI.h>
// set pin 4 as the slave select for the digital pot:
const int slaveSelectPin = 4;
void setup() {
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
}
void loop() {
// go through pp=01, 10, 11 for pot0, pot1 and both together of the digital pot:
for (int CommandByte = 17; CommandByte < 19; CommandByte++) { // 17, 18 and 19
// change the resistance on this pot from min to max:
for (int level = 0; level < 255; level++) {
digitalPotWrite(CommandByte, level);
delay(10);
}
// wait at the top:
delay(100);
// change the resistance on this channel from max to min:
for (int level = 0; level < 255; level++) {
digitalPotWrite(CommandByte, 255 - level);
delay(10);
}
}
}
int digitalPotWrite(int CommandByte, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
SPI.transfer(CommandByte);
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
}

Binary file not shown.