Rev 1 of USB Joystick Interface board

This commit is contained in:
Charles Mangin 2013-11-14 11:12:20 -05:00
parent 3cf7e2cf3c
commit 38540b4dea
17 changed files with 41243 additions and 12 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -47,9 +47,19 @@ int YMax = 0;
int XMin = 1023;
int YMin = 1023;
/*
adjust CalibrationMax up if the range on your joystick is too restricted to calibrate
adjust down if your joystick "jumps" around a lot. 800 seems to be a pretty good spot for the sticks i've tested.
*/
int CalibrationMax = 800; // allows for weird "jumpy" joystick potentiometers. these things are 30 years old, after all.
void setup() {
// Serial.begin(9600);

View File

@ -3,7 +3,10 @@
#include <SPI.h>
// set pin 4 as the slave select for the digital pot:
const int slaveSelectPin = 4;
const int slaveSelectPin = A0; //4;
const float foo = .21;
const int Butt0Pin = A4;
const int Butt1Pin = A5;
@ -40,6 +43,12 @@ void setup()
{
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
pinMode (Butt0Pin, OUTPUT);
pinMode (Butt1Pin, OUTPUT);
// initialize SPI:
SPI.begin();
@ -55,32 +64,46 @@ void setup()
if (!Hid.SetReportParser(0, &Joy))
ErrorMessage<uint8_t>(PSTR("SetReportParser"), 1 );
}
void loop()
{
Usb.Task();
int joyX = .7 * JoyEvents.X;
digitalPotWrite(19, joyX);
int joyX = JoyEvents.X;
int channel = 5;
// int joyY = JoyEvents.Y;
digitalPotWrite(channel, joyX);
digitalPotWrite(channel - 1, joyX * foo);
int joyY = JoyEvents.Y;
channel = 3;
digitalPotWrite(channel, joyY);
digitalPotWrite(channel - 1, joyY * foo);
digitalWrite(Butt0Pin,JoyEvents.Butt0);
digitalWrite(Butt1Pin,JoyEvents.Butt1);
// digitalPotWrite(18, joyY);
}
int digitalPotWrite(int CommandByte, int value) {
void digitalPotWrite(int address, 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(address);
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
}

View File

@ -36,8 +36,8 @@ public:
uint8_t X;
uint8_t Y;
uint8_t Butt0;
uint8_t Butt1;
boolean Butt0;
boolean Butt1;
};

View File

@ -0,0 +1,52 @@
// inslude the SPI library:
#include <SPI.h>
// set pin 10 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() {
int channel = 5;
float foo = .21;
delay(1000);
// change the resistance on this channel from min to max:
for (int level = 0; level < 255; level++) {
digitalPotWrite(channel, level);
digitalPotWrite(channel - 1, level * foo);
delay(10);
}
// wait a second at the top:
delay(1000);
// change the resistance on this channel from max to min:
for (int level = 0; level < 255; level++) {
digitalPotWrite(channel, 255 - level);
digitalPotWrite(channel - 1, (255 - level) * foo);
delay(10);
}
}
void digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip:
digitalWrite(slaveSelectPin,LOW);
// send in the address and value via SPI:
SPI.transfer(address);
SPI.transfer(value);
// take the SS pin high to de-select the chip:
digitalWrite(slaveSelectPin,HIGH);
}

Binary file not shown.

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.795280X1.751970*%
%ADD11C,0.008000*%
%ADD10C,0.008*%
%LNCONTOUR*%
G90*
G70*
G54D10*
G54D11*
X4Y1748D02*
X2791Y1748D01*
X2791Y4D01*
X4Y4D01*
X4Y1748D01*
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,121 @@
M48
INCH
T10C0.015748
T11C0.035000
T12C0.042000
T13C0.031555
T14C0.031496
T15C0.038000
%
T10
X014777Y007759
X015277Y005759
X016270Y001750
X016779Y010738
X015295Y010738
X016777Y004759
T11
X023277Y014759
X023277Y011759
X022277Y014759
X022277Y011759
X021277Y014759
X021277Y011759
X020277Y014759
X020277Y011759
X019277Y014759
X019277Y011759
X018277Y014759
X018277Y011759
X017277Y014759
X017277Y011759
X016277Y014759
X016277Y011759
X008277Y003759
X002277Y003759
X008277Y004759
X002277Y004759
X008277Y005759
X002277Y005759
X008277Y006759
X002277Y006759
X008277Y007759
X002277Y007759
X008277Y008759
X002277Y008759
X008277Y009759
X002277Y009759
X008277Y010759
X002277Y010759
X008277Y011759
X002277Y011759
X008277Y012759
X002277Y012759
X008277Y013759
X002277Y013759
X008277Y014759
X002277Y014759
X013777Y001759
X010777Y001759
X013777Y002759
X010777Y002759
X013777Y003759
X010777Y003759
X013777Y004759
X010777Y004759
X013777Y005759
X010777Y005759
X013777Y006759
X010777Y006759
X013777Y007759
X010777Y007759
X013777Y008759
X010777Y008759
X013777Y009759
X010777Y009759
X013777Y010759
X010777Y010759
X013777Y011759
X010777Y011759
X013777Y012759
X010777Y012759
X013777Y013759
X010777Y013759
X013777Y014759
X010777Y014759
X016277Y000759
X016277Y003759
X017277Y000759
X017277Y003759
X018277Y000759
X018277Y003759
X019277Y000759
X019277Y003759
X020277Y000759
X020277Y003759
X021277Y000759
X021277Y003759
X022277Y000759
X022277Y003759
X023277Y000759
X023277Y003759
X024277Y000759
X024277Y003759
X025277Y000759
X025277Y003759
X026277Y000759
X026277Y003759
X027277Y000759
X027277Y003759
T12
X001777Y001759
X002777Y001759
X003777Y001759
T13
X006346Y001759
T14
X008277Y001759
T15
X007277Y015259
T00
M30

View File

@ -0,0 +1,142 @@
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.049370*%
%ADD11C,0.085000*%
%ADD12C,0.092000*%
%ADD13C,0.080925*%
%ADD14C,0.080866*%
%ADD15C,0.088000*%
%ADD16R,0.085000X0.085000*%
%ADD17R,0.092000X0.092000*%
%LNMASK0*%
G90*
G70*
G54D10*
X1678Y476D03*
X1530Y1074D03*
X1678Y1074D03*
X1627Y175D03*
X1528Y576D03*
X1478Y776D03*
G54D11*
X2728Y376D03*
X2728Y76D03*
X2628Y376D03*
X2628Y76D03*
X2528Y376D03*
X2528Y76D03*
X2428Y376D03*
X2428Y76D03*
X2328Y376D03*
X2328Y76D03*
X2228Y376D03*
X2228Y76D03*
X2128Y376D03*
X2128Y76D03*
X2028Y376D03*
X2028Y76D03*
X1928Y376D03*
X1928Y76D03*
X1828Y376D03*
X1828Y76D03*
X1728Y376D03*
X1728Y76D03*
X1628Y376D03*
X1628Y76D03*
X1078Y1476D03*
X1378Y1476D03*
X1078Y1376D03*
X1378Y1376D03*
X1078Y1276D03*
X1378Y1276D03*
X1078Y1176D03*
X1378Y1176D03*
X1078Y1076D03*
X1378Y1076D03*
X1078Y976D03*
X1378Y976D03*
X1078Y876D03*
X1378Y876D03*
X1078Y776D03*
X1378Y776D03*
X1078Y676D03*
X1378Y676D03*
X1078Y576D03*
X1378Y576D03*
X1078Y476D03*
X1378Y476D03*
X1078Y376D03*
X1378Y376D03*
X1078Y276D03*
X1378Y276D03*
X1078Y176D03*
X1378Y176D03*
X228Y1476D03*
X828Y1476D03*
X228Y1376D03*
X828Y1376D03*
X228Y1276D03*
X828Y1276D03*
X228Y1176D03*
X828Y1176D03*
X228Y1076D03*
X828Y1076D03*
X228Y976D03*
X828Y976D03*
X228Y876D03*
X828Y876D03*
X228Y776D03*
X828Y776D03*
X228Y676D03*
X828Y676D03*
X228Y576D03*
X828Y576D03*
X228Y476D03*
X828Y476D03*
X228Y376D03*
X828Y376D03*
G54D12*
X378Y176D03*
X278Y176D03*
X178Y176D03*
G54D13*
X635Y176D03*
G54D14*
X828Y176D03*
G54D11*
X1628Y1176D03*
X1628Y1476D03*
X1728Y1176D03*
X1728Y1476D03*
X1828Y1176D03*
X1828Y1476D03*
X1928Y1176D03*
X1928Y1476D03*
X2028Y1176D03*
X2028Y1476D03*
X2128Y1176D03*
X2128Y1476D03*
X2228Y1176D03*
X2228Y1476D03*
X2328Y1176D03*
X2328Y1476D03*
G54D15*
X728Y1526D03*
G54D16*
X2728Y376D03*
X1078Y1476D03*
X228Y1476D03*
G54D17*
X378Y176D03*
G54D16*
X1628Y1176D03*
G04 End of Mask0*
M02*

View File

@ -0,0 +1,142 @@
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.049370*%
%ADD11C,0.085000*%
%ADD12C,0.092000*%
%ADD13C,0.080925*%
%ADD14C,0.080866*%
%ADD15C,0.088000*%
%ADD16R,0.085000X0.085000*%
%ADD17R,0.092000X0.092000*%
%LNMASK1*%
G90*
G70*
G54D10*
X1678Y476D03*
X1530Y1074D03*
X1678Y1074D03*
X1627Y175D03*
X1528Y576D03*
X1478Y776D03*
G54D11*
X2728Y376D03*
X2728Y76D03*
X2628Y376D03*
X2628Y76D03*
X2528Y376D03*
X2528Y76D03*
X2428Y376D03*
X2428Y76D03*
X2328Y376D03*
X2328Y76D03*
X2228Y376D03*
X2228Y76D03*
X2128Y376D03*
X2128Y76D03*
X2028Y376D03*
X2028Y76D03*
X1928Y376D03*
X1928Y76D03*
X1828Y376D03*
X1828Y76D03*
X1728Y376D03*
X1728Y76D03*
X1628Y376D03*
X1628Y76D03*
X1078Y1476D03*
X1378Y1476D03*
X1078Y1376D03*
X1378Y1376D03*
X1078Y1276D03*
X1378Y1276D03*
X1078Y1176D03*
X1378Y1176D03*
X1078Y1076D03*
X1378Y1076D03*
X1078Y976D03*
X1378Y976D03*
X1078Y876D03*
X1378Y876D03*
X1078Y776D03*
X1378Y776D03*
X1078Y676D03*
X1378Y676D03*
X1078Y576D03*
X1378Y576D03*
X1078Y476D03*
X1378Y476D03*
X1078Y376D03*
X1378Y376D03*
X1078Y276D03*
X1378Y276D03*
X1078Y176D03*
X1378Y176D03*
X228Y1476D03*
X828Y1476D03*
X228Y1376D03*
X828Y1376D03*
X228Y1276D03*
X828Y1276D03*
X228Y1176D03*
X828Y1176D03*
X228Y1076D03*
X828Y1076D03*
X228Y976D03*
X828Y976D03*
X228Y876D03*
X828Y876D03*
X228Y776D03*
X828Y776D03*
X228Y676D03*
X828Y676D03*
X228Y576D03*
X828Y576D03*
X228Y476D03*
X828Y476D03*
X228Y376D03*
X828Y376D03*
G54D12*
X378Y176D03*
X278Y176D03*
X178Y176D03*
G54D13*
X635Y176D03*
G54D14*
X828Y176D03*
G54D11*
X1628Y1176D03*
X1628Y1476D03*
X1728Y1176D03*
X1728Y1476D03*
X1828Y1176D03*
X1828Y1476D03*
X1928Y1176D03*
X1928Y1476D03*
X2028Y1176D03*
X2028Y1476D03*
X2128Y1176D03*
X2128Y1476D03*
X2228Y1176D03*
X2228Y1476D03*
X2328Y1176D03*
X2328Y1476D03*
G54D15*
X728Y1526D03*
G54D16*
X2728Y376D03*
X1078Y1476D03*
X228Y1476D03*
G54D17*
X378Y176D03*
G54D16*
X1628Y1176D03*
G04 End of Mask1*
M02*

View File

@ -0,0 +1,67 @@
*Pick And Place List
*Company=
*Author=
*eMail=
*
*Project=USB_Joystick-PCB
*Date=15:54:51
*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;;;51.4125;-23.4913;0;Bottom;TXT1
2;;;38.7724;-29.8808;0;Bottom;TXT2
3;;;64.1858;-11.48;0;Bottom;Copper Fill10
4;;THT;18.4839;-38.759;0;Bottom;5v
5;;;60.3758;-7.6446;0;Bottom;Copper Fill14
6;;;3.9116;-26.0342;0;Bottom;Copper Fill22
7;;;42.6186;-27.2766;0;Bottom;Via5
8;;;38.8038;-14.6291;0;Bottom;Via1
9;;;55.3212;-10.8196;0;Bottom;Copper Fill12
10;;;52.0598;-20.3333;0;Bottom;TXT2
11;;;36.2966;-12.0896;0;Bottom;Copper Fill28
12;;;52.0446;-3.1234;0;Bottom;Copper Fill16
13;;;3.7592;-32.2572;0;Bottom;Copper Fill3
14;;;36.9062;-36.1688;0;Bottom;Copper Fill21
15;5V;TO220 [THT];7.05386;-2.94504;180;Bottom;3v
16;;;25.4508;-29.8442;0;Bottom;Copper Fill2
17;;;10.9338;-6.8049;0;Bottom;TXT2
18;;;66.9636;-20.1489;0;Bottom;TXT3
19;;;54.6862;-7.67;0;Bottom;Copper Fill29
20;;;4.5466;-37.7436;0;Bottom;Copper Fill1
21;;;35.4838;-26.7962;0;Bottom;Copper Fill19
22;;;44.5262;-12.115;0;Bottom;Copper Fill7
23;;;21.6662;-21.6146;0;Bottom;Copper Fill18
24;;;67.0161;-40.4144;0;Bottom;IMG1
25;;;47.0916;-28.5996;0;Bottom;Copper Fill23
26;;;41.3263;-4.4474;0;Bottom;Via6
27;;DIP (Dual Inline) [THT];50.2339;-33.679;-90;Bottom;GAME
28;;DIP28 [THT];55.3139;-5.73904;90;Bottom;AD5206
29;;;51.5112;-26.7962;0;Bottom;Copper Fill6
30;;;6.76246;-6.89437;0;Bottom;TXT1
31;;;39.4716;-5.0538;0;Bottom;Copper Fill31
32;;;47.7012;-11.48;0;Bottom;Copper Fill9
33;;;33.1216;-13.3596;0;Bottom;Copper Fill8
34;;;45.1612;-31.7746;0;Bottom;Copper Fill24
35;;;10.8712;-26.6946;0;Bottom;Copper Fill20
36;;;67.3354;-7.6446;0;Bottom;Copper Fill15
37;;;32.4104;-5.1046;0;Bottom;Copper Fill30
38;;;3.8608;-16.56;0;Bottom;Copper Fill4
39;;DIP (Dual Inline) [THT];13.4039;-23.519;0;Bottom;UHS Mini
40;;;25.146;-13.6898;0;Bottom;Copper Fill27
41;;;18.5166;-11.9118;0;Bottom;Copper Fill32
42;;;54.0512;-7.6446;0;Bottom;Copper Fill13
43;;;42.6138;-12.0891;0;Bottom;Via3
44;;;37.5338;-19.7091;0;Bottom;Via2
45;;THT;18.5739;-4.46894;180;Bottom;XTAL
46;;;48.3362;-15.925;0;Bottom;Copper Fill25
47;;dip;31.1839;-20.979;0;Bottom;ATMEGA328
48;;;38.8498;-27.2766;0;Bottom;Via4
49;;;67.9958;-3.8346;0;Bottom;Copper Fill17
50;;;32.4358;-9.6004;0;Bottom;Copper Fill11
51;;;6.4008;-10.8958;0;Bottom;Copper Fill26
52;;;47.7012;-23.4942;0;Bottom;Copper Fill5

View File

@ -0,0 +1,24 @@
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.795280X1.751970X2.779280X1.735970*%
%ADD11C,0.008000*%
%LNSILK0*%
G90*
G70*
G54D11*
X4Y1748D02*
X2791Y1748D01*
X2791Y4D01*
X4Y4D01*
X4Y1748D01*
D02*
G04 End of Silk0*
M02*

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.