mirror of
https://github.com/whowechina/chu_pico.git
synced 2025-01-18 17:24:05 +01:00
Some updates (keypad, IR sensor firmware)
This commit is contained in:
parent
b50ce783ef
commit
e3d7eb6d19
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
chu_main-backups
|
||||
|
BIN
PCB/main/3dmodels/gp2y0e03.3mf
Normal file
BIN
PCB/main/3dmodels/gp2y0e03.3mf
Normal file
Binary file not shown.
21
PCB/main/3dmodels/gp2y0e03.scad
Normal file
21
PCB/main/3dmodels/gp2y0e03.scad
Normal file
@ -0,0 +1,21 @@
|
||||
$fn=64;
|
||||
translate([-5.5,-8.5]) color("green") cube([11,17,1.2]);
|
||||
|
||||
color("gray") difference() {
|
||||
translate([-5,-8.4]) cube([10,4,3]);
|
||||
translate([-4,-9.3]) cube([8,5,2.4]);
|
||||
}
|
||||
|
||||
color("gray") difference() {
|
||||
translate([-5,-1]) cube([10,5.8,5]);
|
||||
translate([2.5,1.9,-1]) cylinder(d=3.8,h=10);
|
||||
translate([-2.5,1.9,-1]) cylinder(d=3.8,h=10);
|
||||
}
|
||||
color("brown") {
|
||||
translate([2.5,1.9,3.2]) sphere(d=3.4);
|
||||
translate([-2.5,1.9,3.2]) sphere(d=3.4);
|
||||
}
|
||||
|
||||
for (i = [-4:1:4]) {
|
||||
translate([i,6.5,1]) cube([0.5,1,0.6]);
|
||||
}
|
13284
PCB/main/3dmodels/gp2y0e03.wrl
Normal file
13284
PCB/main/3dmodels/gp2y0e03.wrl
Normal file
File diff suppressed because it is too large
Load Diff
205
PCB/main/3dmodels/keypad_kicad.svg
Normal file
205
PCB/main/3dmodels/keypad_kicad.svg
Normal file
@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="297mm"
|
||||
height="210mm"
|
||||
viewBox="0 0 297 210"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="keypad_kicad.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.7385171"
|
||||
inkscape:cx="175.35139"
|
||||
inkscape:cy="252.53308"
|
||||
inkscape:window-width="1389"
|
||||
inkscape:window-height="1002"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
showborder="true"
|
||||
borderlayer="true" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Outline"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.17105263;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 28,20 17.8,50 v 30 h 256 V 50 L 263.6,20 Z"
|
||||
id="path11970"
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
inkscape:label="Shape" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="Screws">
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-3"
|
||||
cx="182.3"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc6" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-7"
|
||||
cx="109.3"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc5" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-2-8"
|
||||
cx="270.60001"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc4" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-1"
|
||||
cx="270.60001"
|
||||
cy="61.200001"
|
||||
r="1.2"
|
||||
inkscape:label="Sc3" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-2"
|
||||
cx="21"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc2" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107"
|
||||
cx="21"
|
||||
cy="61.200001"
|
||||
r="1.2"
|
||||
inkscape:label="Sc1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Splitter">
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 261.6,20 V 73.999996"
|
||||
id="path6143-0-7"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:label="S16" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 246,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-1-9-6"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S15" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 231.4,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-1-0"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S14" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 216.8,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-4-7"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S13" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 202.2,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-8-5"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S12" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 187.6,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-1-4"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S11" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 173,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-85"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S10" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 158.4,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-6"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S9" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 143.8,20 1,1.963636 v 52.03636 M 147.8,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-8-8"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S8" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 129.2,20 1,1.963636 v 52.03636 M 133.2,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-1-9"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S7" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 114.6,20 1,1.963636 v 52.03636 M 118.6,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-1"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S6" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 100,20 1,1.963636 v 52.03636 M 104,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-4"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S5" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 85.4,20 1,1.963636 v 52.03636 M 89.4,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-8"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S4" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 70.8,20 1,1.963636 v 52.03636 M 74.8,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-1"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S3" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 56.2,20 1,1.963636 v 52.03636 M 60.2,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S2" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 41.6,20 1,1.963636 v 52.03636 M 45.6,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S1" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 30,20 V 73.999996"
|
||||
id="path6143-0"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:label="S0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 9.3 KiB |
1
PCB/main/3dmodels/keypad_lgp.scad
Normal file
1
PCB/main/3dmodels/keypad_lgp.scad
Normal file
@ -0,0 +1 @@
|
||||
translate([-17,-130]) resize([256,60,1]) linear_extrude(h=100) import("keypad_kicad.svg");
|
824
PCB/main/3dmodels/keypad_lgp.wrl
Normal file
824
PCB/main/3dmodels/keypad_lgp.wrl
Normal file
@ -0,0 +1,824 @@
|
||||
#VRML V2.0 utf8
|
||||
|
||||
Shape {
|
||||
|
||||
appearance Appearance { material Material {
|
||||
ambientIntensity 0.3
|
||||
diffuseColor 0.97647 0.843137 0.172549
|
||||
specularColor 0.2 0.2 0.2
|
||||
shininess 0.3
|
||||
} }
|
||||
|
||||
geometry IndexedFaceSet {
|
||||
|
||||
creaseAngle 0.5
|
||||
|
||||
coord Coordinate { point [
|
||||
246.6 59.4383 0,
|
||||
256.8 29.527 0,
|
||||
244.732 59.4383 0,
|
||||
244.468 59.4383 0,
|
||||
244.468 59.5702 0,
|
||||
244.732 59.5702 0,
|
||||
233.148 59.4383 0,
|
||||
232.852 59.4383 0,
|
||||
232.942 59.6157 0,
|
||||
233.178 59.4959 0,
|
||||
229.148 59.4383 0,
|
||||
228.852 59.4383 0,
|
||||
229.058 59.6157 0,
|
||||
228.822 59.4959 0,
|
||||
218.548 59.4383 0,
|
||||
218.252 59.4383 0,
|
||||
218.342 59.6157 0,
|
||||
218.578 59.4959 0,
|
||||
214.548 59.4383 0,
|
||||
214.252 59.4383 0,
|
||||
214.458 59.6157 0,
|
||||
214.222 59.4959 0,
|
||||
256.8 -0.384308 0,
|
||||
203.948 59.4383 0,
|
||||
203.652 59.4383 0,
|
||||
203.742 59.6157 0,
|
||||
203.978 59.4959 0,
|
||||
199.948 59.4383 0,
|
||||
199.652 59.4383 0,
|
||||
199.858 59.6157 0,
|
||||
199.622 59.4959 0,
|
||||
189.348 59.4383 0,
|
||||
189.052 59.4383 0,
|
||||
189.142 59.6157 0,
|
||||
189.378 59.4959 0,
|
||||
185.348 59.4383 0,
|
||||
185.052 59.4383 0,
|
||||
185.258 59.6157 0,
|
||||
185.022 59.4959 0,
|
||||
174.748 59.4383 0,
|
||||
174.452 59.4383 0,
|
||||
174.778 59.4959 0,
|
||||
174.542 59.6157 0,
|
||||
170.748 59.4383 0,
|
||||
170.452 59.4383 0,
|
||||
170.658 59.6157 0,
|
||||
170.422 59.4959 0,
|
||||
160.148 59.4383 0,
|
||||
159.852 59.4383 0,
|
||||
160.178 59.4959 0,
|
||||
159.942 59.6157 0,
|
||||
156.148 59.4383 0,
|
||||
155.852 59.4383 0,
|
||||
156.058 59.6157 0,
|
||||
155.822 59.4959 0,
|
||||
145.548 59.4383 0,
|
||||
145.252 59.4383 0,
|
||||
145.578 59.4959 0,
|
||||
145.342 59.6157 0,
|
||||
141.548 59.4383 0,
|
||||
141.252 59.4383 0,
|
||||
141.458 59.6157 0,
|
||||
141.222 59.4959 0,
|
||||
130.948 59.4383 0,
|
||||
130.652 59.4383 0,
|
||||
130.978 59.4959 0,
|
||||
130.742 59.6157 0,
|
||||
0.799999 -0.384308 0,
|
||||
126.948 59.4383 0,
|
||||
126.652 59.4383 0,
|
||||
126.858 59.6157 0,
|
||||
126.622 59.4959 0,
|
||||
116.348 59.4383 0,
|
||||
116.052 59.4383 0,
|
||||
116.378 59.4959 0,
|
||||
116.142 59.6157 0,
|
||||
112.348 59.4383 0,
|
||||
112.052 59.4383 0,
|
||||
112.258 59.6157 0,
|
||||
112.022 59.4959 0,
|
||||
101.452 59.4383 0,
|
||||
101.748 59.4383 0,
|
||||
97.7484 59.4383 0,
|
||||
101.778 59.4959 0,
|
||||
101.542 59.6157 0,
|
||||
97.4515 59.4383 0,
|
||||
97.6578 59.6157 0,
|
||||
97.4221 59.4959 0,
|
||||
87.1485 59.4383 0,
|
||||
86.8516 59.4383 0,
|
||||
83.1484 59.4383 0,
|
||||
87.1779 59.4959 0,
|
||||
86.9422 59.6157 0,
|
||||
82.8515 59.4383 0,
|
||||
83.0578 59.6157 0,
|
||||
82.8221 59.4959 0,
|
||||
72.5485 59.4383 0,
|
||||
72.2516 59.4383 0,
|
||||
68.5484 59.4383 0,
|
||||
72.5779 59.4959 0,
|
||||
72.3422 59.6157 0,
|
||||
68.2515 59.4383 0,
|
||||
68.4578 59.6157 0,
|
||||
68.2221 59.4959 0,
|
||||
57.9485 59.4383 0,
|
||||
57.6516 59.4383 0,
|
||||
53.9484 59.4383 0,
|
||||
57.9779 59.4959 0,
|
||||
57.7422 59.6157 0,
|
||||
53.6515 59.4383 0,
|
||||
53.8578 59.6157 0,
|
||||
53.6221 59.4959 0,
|
||||
43.3485 59.4383 0,
|
||||
0.799999 29.527 0,
|
||||
43.0516 59.4383 0,
|
||||
43.3779 59.4959 0,
|
||||
43.1422 59.6157 0,
|
||||
39.3484 59.4383 0,
|
||||
39.0515 59.4383 0,
|
||||
39.2578 59.6157 0,
|
||||
39.0221 59.4959 0,
|
||||
28.7485 59.4383 0,
|
||||
28.4516 59.4383 0,
|
||||
28.7779 59.4959 0,
|
||||
28.5422 59.6157 0,
|
||||
24.7484 59.4383 0,
|
||||
24.4515 59.4383 0,
|
||||
24.6578 59.6157 0,
|
||||
24.4221 59.4959 0,
|
||||
13.1323 59.4383 0,
|
||||
12.8677 59.4383 0,
|
||||
13.1323 59.5702 0,
|
||||
12.8677 59.5702 0,
|
||||
11 59.4383 0,
|
||||
256.8 29.527 1,
|
||||
246.6 59.4383 1,
|
||||
244.732 59.4383 1,
|
||||
244.732 59.5702 1,
|
||||
244.468 59.5702 1,
|
||||
244.468 59.4383 1,
|
||||
233.148 59.4383 1,
|
||||
233.178 59.4959 1,
|
||||
232.942 59.6157 1,
|
||||
232.852 59.4383 1,
|
||||
229.148 59.4383 1,
|
||||
229.058 59.6157 1,
|
||||
228.822 59.4959 1,
|
||||
228.852 59.4383 1,
|
||||
218.548 59.4383 1,
|
||||
218.578 59.4959 1,
|
||||
218.342 59.6157 1,
|
||||
218.252 59.4383 1,
|
||||
214.548 59.4383 1,
|
||||
214.458 59.6157 1,
|
||||
214.222 59.4959 1,
|
||||
214.252 59.4383 1,
|
||||
203.948 59.4383 1,
|
||||
203.978 59.4959 1,
|
||||
203.742 59.6157 1,
|
||||
203.652 59.4383 1,
|
||||
199.948 59.4383 1,
|
||||
199.858 59.6157 1,
|
||||
199.622 59.4959 1,
|
||||
199.652 59.4383 1,
|
||||
189.348 59.4383 1,
|
||||
189.378 59.4959 1,
|
||||
189.142 59.6157 1,
|
||||
189.052 59.4383 1,
|
||||
185.348 59.4383 1,
|
||||
185.258 59.6157 1,
|
||||
185.022 59.4959 1,
|
||||
185.052 59.4383 1,
|
||||
174.748 59.4383 1,
|
||||
174.778 59.4959 1,
|
||||
174.542 59.6157 1,
|
||||
174.452 59.4383 1,
|
||||
170.748 59.4383 1,
|
||||
170.658 59.6157 1,
|
||||
170.422 59.4959 1,
|
||||
170.452 59.4383 1,
|
||||
160.148 59.4383 1,
|
||||
160.178 59.4959 1,
|
||||
159.942 59.6157 1,
|
||||
159.852 59.4383 1,
|
||||
156.148 59.4383 1,
|
||||
156.058 59.6157 1,
|
||||
155.822 59.4959 1,
|
||||
155.852 59.4383 1,
|
||||
145.548 59.4383 1,
|
||||
145.578 59.4959 1,
|
||||
145.342 59.6157 1,
|
||||
145.252 59.4383 1,
|
||||
141.548 59.4383 1,
|
||||
141.458 59.6157 1,
|
||||
141.222 59.4959 1,
|
||||
141.252 59.4383 1,
|
||||
130.948 59.4383 1,
|
||||
130.978 59.4959 1,
|
||||
130.742 59.6157 1,
|
||||
130.652 59.4383 1,
|
||||
126.948 59.4383 1,
|
||||
126.858 59.6157 1,
|
||||
126.622 59.4959 1,
|
||||
126.652 59.4383 1,
|
||||
116.348 59.4383 1,
|
||||
116.378 59.4959 1,
|
||||
116.142 59.6157 1,
|
||||
116.052 59.4383 1,
|
||||
112.348 59.4383 1,
|
||||
112.258 59.6157 1,
|
||||
112.022 59.4959 1,
|
||||
112.052 59.4383 1,
|
||||
101.748 59.4383 1,
|
||||
101.778 59.4959 1,
|
||||
101.542 59.6157 1,
|
||||
101.452 59.4383 1,
|
||||
97.7484 59.4383 1,
|
||||
97.6578 59.6157 1,
|
||||
97.4221 59.4959 1,
|
||||
97.4515 59.4383 1,
|
||||
87.1485 59.4383 1,
|
||||
87.1779 59.4959 1,
|
||||
86.9422 59.6157 1,
|
||||
86.8516 59.4383 1,
|
||||
83.1484 59.4383 1,
|
||||
83.0578 59.6157 1,
|
||||
82.8221 59.4959 1,
|
||||
82.8515 59.4383 1,
|
||||
72.5485 59.4383 1,
|
||||
72.5779 59.4959 1,
|
||||
72.3422 59.6157 1,
|
||||
72.2516 59.4383 1,
|
||||
68.5484 59.4383 1,
|
||||
68.4578 59.6157 1,
|
||||
68.2221 59.4959 1,
|
||||
68.2515 59.4383 1,
|
||||
57.9485 59.4383 1,
|
||||
57.9779 59.4959 1,
|
||||
57.7422 59.6157 1,
|
||||
57.6516 59.4383 1,
|
||||
53.9484 59.4383 1,
|
||||
53.8578 59.6157 1,
|
||||
53.6221 59.4959 1,
|
||||
53.6515 59.4383 1,
|
||||
43.3485 59.4383 1,
|
||||
43.3779 59.4959 1,
|
||||
43.1422 59.6157 1,
|
||||
43.0516 59.4383 1,
|
||||
39.3484 59.4383 1,
|
||||
39.2578 59.6157 1,
|
||||
39.0221 59.4959 1,
|
||||
39.0515 59.4383 1,
|
||||
28.7485 59.4383 1,
|
||||
28.7779 59.4959 1,
|
||||
28.5422 59.6157 1,
|
||||
28.4516 59.4383 1,
|
||||
24.7484 59.4383 1,
|
||||
24.6578 59.6157 1,
|
||||
24.4221 59.4959 1,
|
||||
24.4515 59.4383 1,
|
||||
13.1323 59.4383 1,
|
||||
13.1323 59.5702 1,
|
||||
12.8677 59.5702 1,
|
||||
12.8677 59.4383 1,
|
||||
11 59.4383 1,
|
||||
0.799999 29.527 1,
|
||||
0.799999 -0.384308 1,
|
||||
256.8 -0.384308 1
|
||||
] }
|
||||
|
||||
coordIndex [
|
||||
0,1,2,-1,
|
||||
1,3,2,-1,
|
||||
3,4,2,-1,
|
||||
5,2,4,-1,
|
||||
1,6,3,-1,
|
||||
1,7,6,-1,
|
||||
6,7,8,-1,
|
||||
9,6,8,-1,
|
||||
1,10,7,-1,
|
||||
11,12,10,-1,
|
||||
11,13,12,-1,
|
||||
1,14,11,-1,
|
||||
1,15,14,-1,
|
||||
1,11,10,-1,
|
||||
14,15,16,-1,
|
||||
17,14,16,-1,
|
||||
1,18,15,-1,
|
||||
1,19,18,-1,
|
||||
18,19,20,-1,
|
||||
20,19,21,-1,
|
||||
1,22,19,-1,
|
||||
19,22,23,-1,
|
||||
23,24,25,-1,
|
||||
26,23,25,-1,
|
||||
23,22,24,-1,
|
||||
24,22,27,-1,
|
||||
27,28,29,-1,
|
||||
29,28,30,-1,
|
||||
27,22,28,-1,
|
||||
28,22,31,-1,
|
||||
31,32,33,-1,
|
||||
34,31,33,-1,
|
||||
31,22,32,-1,
|
||||
32,22,35,-1,
|
||||
35,36,37,-1,
|
||||
37,36,38,-1,
|
||||
35,22,36,-1,
|
||||
36,22,39,-1,
|
||||
39,22,40,-1,
|
||||
41,39,42,-1,
|
||||
42,39,40,-1,
|
||||
40,22,43,-1,
|
||||
43,44,45,-1,
|
||||
45,44,46,-1,
|
||||
43,22,44,-1,
|
||||
44,22,47,-1,
|
||||
47,22,48,-1,
|
||||
49,47,50,-1,
|
||||
50,47,48,-1,
|
||||
48,22,51,-1,
|
||||
51,52,53,-1,
|
||||
53,52,54,-1,
|
||||
51,22,52,-1,
|
||||
52,22,55,-1,
|
||||
55,22,56,-1,
|
||||
57,55,58,-1,
|
||||
58,55,56,-1,
|
||||
56,22,59,-1,
|
||||
59,60,61,-1,
|
||||
61,60,62,-1,
|
||||
59,22,60,-1,
|
||||
60,22,63,-1,
|
||||
63,22,64,-1,
|
||||
65,63,66,-1,
|
||||
66,63,64,-1,
|
||||
64,67,68,-1,
|
||||
68,69,70,-1,
|
||||
70,69,71,-1,
|
||||
68,67,69,-1,
|
||||
69,67,72,-1,
|
||||
72,67,73,-1,
|
||||
74,72,75,-1,
|
||||
75,72,73,-1,
|
||||
73,67,76,-1,
|
||||
76,77,78,-1,
|
||||
78,77,79,-1,
|
||||
76,67,77,-1,
|
||||
67,80,81,-1,
|
||||
67,82,80,-1,
|
||||
83,81,84,-1,
|
||||
84,81,80,-1,
|
||||
67,85,82,-1,
|
||||
82,85,86,-1,
|
||||
86,85,87,-1,
|
||||
67,88,85,-1,
|
||||
67,89,88,-1,
|
||||
67,90,89,-1,
|
||||
91,88,92,-1,
|
||||
92,88,89,-1,
|
||||
67,93,90,-1,
|
||||
90,93,94,-1,
|
||||
94,93,95,-1,
|
||||
67,96,93,-1,
|
||||
67,97,96,-1,
|
||||
67,98,97,-1,
|
||||
99,96,100,-1,
|
||||
100,96,97,-1,
|
||||
67,101,98,-1,
|
||||
98,101,102,-1,
|
||||
102,101,103,-1,
|
||||
67,104,101,-1,
|
||||
67,105,104,-1,
|
||||
67,106,105,-1,
|
||||
107,104,108,-1,
|
||||
108,104,105,-1,
|
||||
67,109,106,-1,
|
||||
106,109,110,-1,
|
||||
110,109,111,-1,
|
||||
67,112,109,-1,
|
||||
67,113,112,-1,
|
||||
112,113,114,-1,
|
||||
115,112,116,-1,
|
||||
116,112,114,-1,
|
||||
114,113,117,-1,
|
||||
117,118,119,-1,
|
||||
119,118,120,-1,
|
||||
117,113,118,-1,
|
||||
118,113,121,-1,
|
||||
121,113,122,-1,
|
||||
123,121,124,-1,
|
||||
124,121,122,-1,
|
||||
122,113,125,-1,
|
||||
125,126,127,-1,
|
||||
127,126,128,-1,
|
||||
125,113,126,-1,
|
||||
126,113,129,-1,
|
||||
129,113,130,-1,
|
||||
131,129,132,-1,
|
||||
132,129,130,-1,
|
||||
130,113,133,-1,
|
||||
77,67,81,-1,
|
||||
64,22,67,-1,
|
||||
0,134,1,-1,
|
||||
0,135,134,-1,
|
||||
2,135,0,-1,
|
||||
2,136,135,-1,
|
||||
5,136,2,-1,
|
||||
5,137,136,-1,
|
||||
4,137,5,-1,
|
||||
4,138,137,-1,
|
||||
3,138,4,-1,
|
||||
3,139,138,-1,
|
||||
6,139,3,-1,
|
||||
6,140,139,-1,
|
||||
9,140,6,-1,
|
||||
9,141,140,-1,
|
||||
8,141,9,-1,
|
||||
8,142,141,-1,
|
||||
7,142,8,-1,
|
||||
7,143,142,-1,
|
||||
10,143,7,-1,
|
||||
10,144,143,-1,
|
||||
12,144,10,-1,
|
||||
12,145,144,-1,
|
||||
13,145,12,-1,
|
||||
13,146,145,-1,
|
||||
11,146,13,-1,
|
||||
11,147,146,-1,
|
||||
14,147,11,-1,
|
||||
14,148,147,-1,
|
||||
17,148,14,-1,
|
||||
17,149,148,-1,
|
||||
16,149,17,-1,
|
||||
16,150,149,-1,
|
||||
15,150,16,-1,
|
||||
15,151,150,-1,
|
||||
18,151,15,-1,
|
||||
18,152,151,-1,
|
||||
20,152,18,-1,
|
||||
20,153,152,-1,
|
||||
21,153,20,-1,
|
||||
21,154,153,-1,
|
||||
19,154,21,-1,
|
||||
19,155,154,-1,
|
||||
23,155,19,-1,
|
||||
23,156,155,-1,
|
||||
26,156,23,-1,
|
||||
26,157,156,-1,
|
||||
25,157,26,-1,
|
||||
25,158,157,-1,
|
||||
24,158,25,-1,
|
||||
24,159,158,-1,
|
||||
27,159,24,-1,
|
||||
27,160,159,-1,
|
||||
29,160,27,-1,
|
||||
29,161,160,-1,
|
||||
30,161,29,-1,
|
||||
30,162,161,-1,
|
||||
28,162,30,-1,
|
||||
28,163,162,-1,
|
||||
31,163,28,-1,
|
||||
31,164,163,-1,
|
||||
34,164,31,-1,
|
||||
34,165,164,-1,
|
||||
33,165,34,-1,
|
||||
33,166,165,-1,
|
||||
32,166,33,-1,
|
||||
32,167,166,-1,
|
||||
35,167,32,-1,
|
||||
35,168,167,-1,
|
||||
37,168,35,-1,
|
||||
37,169,168,-1,
|
||||
38,169,37,-1,
|
||||
38,170,169,-1,
|
||||
36,170,38,-1,
|
||||
36,171,170,-1,
|
||||
39,171,36,-1,
|
||||
39,172,171,-1,
|
||||
41,172,39,-1,
|
||||
41,173,172,-1,
|
||||
42,173,41,-1,
|
||||
42,174,173,-1,
|
||||
40,174,42,-1,
|
||||
40,175,174,-1,
|
||||
43,175,40,-1,
|
||||
43,176,175,-1,
|
||||
45,176,43,-1,
|
||||
45,177,176,-1,
|
||||
46,177,45,-1,
|
||||
46,178,177,-1,
|
||||
44,178,46,-1,
|
||||
44,179,178,-1,
|
||||
47,179,44,-1,
|
||||
47,180,179,-1,
|
||||
49,180,47,-1,
|
||||
49,181,180,-1,
|
||||
50,181,49,-1,
|
||||
50,182,181,-1,
|
||||
48,182,50,-1,
|
||||
48,183,182,-1,
|
||||
51,183,48,-1,
|
||||
51,184,183,-1,
|
||||
53,184,51,-1,
|
||||
53,185,184,-1,
|
||||
54,185,53,-1,
|
||||
54,186,185,-1,
|
||||
52,186,54,-1,
|
||||
52,187,186,-1,
|
||||
55,187,52,-1,
|
||||
55,188,187,-1,
|
||||
57,188,55,-1,
|
||||
57,189,188,-1,
|
||||
58,189,57,-1,
|
||||
58,190,189,-1,
|
||||
56,190,58,-1,
|
||||
56,191,190,-1,
|
||||
59,191,56,-1,
|
||||
59,192,191,-1,
|
||||
61,192,59,-1,
|
||||
61,193,192,-1,
|
||||
62,193,61,-1,
|
||||
62,194,193,-1,
|
||||
60,194,62,-1,
|
||||
60,195,194,-1,
|
||||
63,195,60,-1,
|
||||
63,196,195,-1,
|
||||
65,196,63,-1,
|
||||
65,197,196,-1,
|
||||
66,197,65,-1,
|
||||
66,198,197,-1,
|
||||
64,198,66,-1,
|
||||
64,199,198,-1,
|
||||
68,199,64,-1,
|
||||
68,200,199,-1,
|
||||
70,200,68,-1,
|
||||
70,201,200,-1,
|
||||
71,201,70,-1,
|
||||
71,202,201,-1,
|
||||
69,202,71,-1,
|
||||
69,203,202,-1,
|
||||
72,203,69,-1,
|
||||
72,204,203,-1,
|
||||
74,204,72,-1,
|
||||
74,205,204,-1,
|
||||
75,205,74,-1,
|
||||
75,206,205,-1,
|
||||
73,206,75,-1,
|
||||
73,207,206,-1,
|
||||
76,207,73,-1,
|
||||
76,208,207,-1,
|
||||
78,208,76,-1,
|
||||
78,209,208,-1,
|
||||
79,209,78,-1,
|
||||
79,210,209,-1,
|
||||
77,210,79,-1,
|
||||
77,211,210,-1,
|
||||
81,211,77,-1,
|
||||
81,212,211,-1,
|
||||
83,212,81,-1,
|
||||
83,213,212,-1,
|
||||
84,213,83,-1,
|
||||
84,214,213,-1,
|
||||
80,214,84,-1,
|
||||
80,215,214,-1,
|
||||
82,215,80,-1,
|
||||
82,216,215,-1,
|
||||
86,216,82,-1,
|
||||
86,217,216,-1,
|
||||
87,217,86,-1,
|
||||
87,218,217,-1,
|
||||
85,218,87,-1,
|
||||
85,219,218,-1,
|
||||
88,219,85,-1,
|
||||
88,220,219,-1,
|
||||
91,220,88,-1,
|
||||
91,221,220,-1,
|
||||
92,221,91,-1,
|
||||
92,222,221,-1,
|
||||
89,222,92,-1,
|
||||
89,223,222,-1,
|
||||
90,223,89,-1,
|
||||
90,224,223,-1,
|
||||
94,224,90,-1,
|
||||
94,225,224,-1,
|
||||
95,225,94,-1,
|
||||
95,226,225,-1,
|
||||
93,226,95,-1,
|
||||
93,227,226,-1,
|
||||
96,227,93,-1,
|
||||
96,228,227,-1,
|
||||
99,228,96,-1,
|
||||
99,229,228,-1,
|
||||
100,229,99,-1,
|
||||
100,230,229,-1,
|
||||
97,230,100,-1,
|
||||
97,231,230,-1,
|
||||
98,231,97,-1,
|
||||
98,232,231,-1,
|
||||
102,232,98,-1,
|
||||
102,233,232,-1,
|
||||
103,233,102,-1,
|
||||
103,234,233,-1,
|
||||
101,234,103,-1,
|
||||
101,235,234,-1,
|
||||
104,235,101,-1,
|
||||
104,236,235,-1,
|
||||
107,236,104,-1,
|
||||
107,237,236,-1,
|
||||
108,237,107,-1,
|
||||
108,238,237,-1,
|
||||
105,238,108,-1,
|
||||
105,239,238,-1,
|
||||
106,239,105,-1,
|
||||
106,240,239,-1,
|
||||
110,240,106,-1,
|
||||
110,241,240,-1,
|
||||
111,241,110,-1,
|
||||
111,242,241,-1,
|
||||
109,242,111,-1,
|
||||
109,243,242,-1,
|
||||
112,243,109,-1,
|
||||
112,244,243,-1,
|
||||
115,244,112,-1,
|
||||
115,245,244,-1,
|
||||
116,245,115,-1,
|
||||
116,246,245,-1,
|
||||
114,246,116,-1,
|
||||
114,247,246,-1,
|
||||
117,247,114,-1,
|
||||
117,248,247,-1,
|
||||
119,248,117,-1,
|
||||
119,249,248,-1,
|
||||
120,249,119,-1,
|
||||
120,250,249,-1,
|
||||
118,250,120,-1,
|
||||
118,251,250,-1,
|
||||
121,251,118,-1,
|
||||
121,252,251,-1,
|
||||
123,252,121,-1,
|
||||
123,253,252,-1,
|
||||
124,253,123,-1,
|
||||
124,254,253,-1,
|
||||
122,254,124,-1,
|
||||
122,255,254,-1,
|
||||
125,255,122,-1,
|
||||
125,256,255,-1,
|
||||
127,256,125,-1,
|
||||
127,257,256,-1,
|
||||
128,257,127,-1,
|
||||
128,258,257,-1,
|
||||
126,258,128,-1,
|
||||
126,259,258,-1,
|
||||
129,259,126,-1,
|
||||
129,260,259,-1,
|
||||
131,260,129,-1,
|
||||
131,261,260,-1,
|
||||
132,261,131,-1,
|
||||
132,262,261,-1,
|
||||
130,262,132,-1,
|
||||
130,263,262,-1,
|
||||
133,263,130,-1,
|
||||
133,264,263,-1,
|
||||
113,264,133,-1,
|
||||
113,265,264,-1,
|
||||
67,265,113,-1,
|
||||
67,266,265,-1,
|
||||
22,266,67,-1,
|
||||
22,267,266,-1,
|
||||
1,267,22,-1,
|
||||
1,134,267,-1,
|
||||
136,134,135,-1,
|
||||
136,139,134,-1,
|
||||
136,138,139,-1,
|
||||
138,136,137,-1,
|
||||
139,140,134,-1,
|
||||
140,143,134,-1,
|
||||
142,143,140,-1,
|
||||
142,140,141,-1,
|
||||
143,144,134,-1,
|
||||
144,145,147,-1,
|
||||
145,146,147,-1,
|
||||
147,148,134,-1,
|
||||
148,151,134,-1,
|
||||
144,147,134,-1,
|
||||
150,151,148,-1,
|
||||
150,148,149,-1,
|
||||
151,152,134,-1,
|
||||
152,155,134,-1,
|
||||
153,155,152,-1,
|
||||
154,155,153,-1,
|
||||
155,267,134,-1,
|
||||
156,267,155,-1,
|
||||
158,159,156,-1,
|
||||
158,156,157,-1,
|
||||
159,267,156,-1,
|
||||
160,267,159,-1,
|
||||
161,163,160,-1,
|
||||
162,163,161,-1,
|
||||
163,267,160,-1,
|
||||
164,267,163,-1,
|
||||
166,167,164,-1,
|
||||
166,164,165,-1,
|
||||
167,267,164,-1,
|
||||
168,267,167,-1,
|
||||
169,171,168,-1,
|
||||
170,171,169,-1,
|
||||
171,267,168,-1,
|
||||
172,267,171,-1,
|
||||
175,267,172,-1,
|
||||
174,172,173,-1,
|
||||
175,172,174,-1,
|
||||
176,267,175,-1,
|
||||
177,179,176,-1,
|
||||
178,179,177,-1,
|
||||
179,267,176,-1,
|
||||
180,267,179,-1,
|
||||
183,267,180,-1,
|
||||
182,180,181,-1,
|
||||
183,180,182,-1,
|
||||
184,267,183,-1,
|
||||
185,187,184,-1,
|
||||
186,187,185,-1,
|
||||
187,267,184,-1,
|
||||
188,267,187,-1,
|
||||
191,267,188,-1,
|
||||
190,188,189,-1,
|
||||
191,188,190,-1,
|
||||
192,267,191,-1,
|
||||
193,195,192,-1,
|
||||
194,195,193,-1,
|
||||
195,267,192,-1,
|
||||
196,267,195,-1,
|
||||
199,267,196,-1,
|
||||
198,196,197,-1,
|
||||
199,196,198,-1,
|
||||
200,266,199,-1,
|
||||
201,203,200,-1,
|
||||
202,203,201,-1,
|
||||
203,266,200,-1,
|
||||
204,266,203,-1,
|
||||
207,266,204,-1,
|
||||
206,204,205,-1,
|
||||
207,204,206,-1,
|
||||
208,266,207,-1,
|
||||
209,211,208,-1,
|
||||
210,211,209,-1,
|
||||
211,266,208,-1,
|
||||
212,215,266,-1,
|
||||
215,216,266,-1,
|
||||
214,212,213,-1,
|
||||
215,212,214,-1,
|
||||
216,219,266,-1,
|
||||
217,219,216,-1,
|
||||
218,219,217,-1,
|
||||
219,220,266,-1,
|
||||
220,223,266,-1,
|
||||
223,224,266,-1,
|
||||
222,220,221,-1,
|
||||
223,220,222,-1,
|
||||
224,227,266,-1,
|
||||
225,227,224,-1,
|
||||
226,227,225,-1,
|
||||
227,228,266,-1,
|
||||
228,231,266,-1,
|
||||
231,232,266,-1,
|
||||
230,228,229,-1,
|
||||
231,228,230,-1,
|
||||
232,235,266,-1,
|
||||
233,235,232,-1,
|
||||
234,235,233,-1,
|
||||
235,236,266,-1,
|
||||
236,239,266,-1,
|
||||
239,240,266,-1,
|
||||
238,236,237,-1,
|
||||
239,236,238,-1,
|
||||
240,243,266,-1,
|
||||
241,243,240,-1,
|
||||
242,243,241,-1,
|
||||
243,244,266,-1,
|
||||
244,265,266,-1,
|
||||
247,265,244,-1,
|
||||
246,244,245,-1,
|
||||
247,244,246,-1,
|
||||
248,265,247,-1,
|
||||
249,251,248,-1,
|
||||
250,251,249,-1,
|
||||
251,265,248,-1,
|
||||
252,265,251,-1,
|
||||
255,265,252,-1,
|
||||
254,252,253,-1,
|
||||
255,252,254,-1,
|
||||
256,265,255,-1,
|
||||
257,259,256,-1,
|
||||
258,259,257,-1,
|
||||
259,265,256,-1,
|
||||
260,265,259,-1,
|
||||
263,265,260,-1,
|
||||
262,260,261,-1,
|
||||
263,260,262,-1,
|
||||
264,265,263,-1,
|
||||
212,266,211,-1,
|
||||
266,267,199,-1
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@
|
||||
"footprints": true,
|
||||
"graphics": true,
|
||||
"keepouts": true,
|
||||
"lockedItems": false,
|
||||
"lockedItems": true,
|
||||
"otherItems": true,
|
||||
"pads": true,
|
||||
"text": true,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,52 @@
|
||||
(kicad_symbol_lib (version 20211014) (generator kicad_symbol_editor)
|
||||
(symbol "ChuAcrylic" (in_bom yes) (on_board yes)
|
||||
(property "Reference" "U" (id 0) (at 0 4.445 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Value" "ChuAcrylic" (id 1) (at 0 3.175 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Footprint" "chu_main:ChuAcrylic" (id 2) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "" (id 3) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "ChuAcrylic_0_0"
|
||||
(text "Chunithm" (at 0 -1.27 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
)
|
||||
(symbol "ChuAcrylic_0_1"
|
||||
(rectangle (start -5.08 0.635) (end 5.08 -2.54)
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
)
|
||||
)
|
||||
(symbol "GP2Y0E03_REAL" (in_bom yes) (on_board yes)
|
||||
(property "Reference" "X" (id 0) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
(property "Value" "GP2Y0E03_REAL" (id 1) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Footprint" "chu_main:GP2Y0E03_REAL" (id 2) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "Datasheet" "" (id 3) (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(symbol "GP2Y0E03_REAL_0_0"
|
||||
(rectangle (start -6.985 -1.905) (end 6.985 -6.985)
|
||||
(stroke (width 0) (type default) (color 0 0 0 0))
|
||||
(fill (type none))
|
||||
)
|
||||
(text "GP2Y0E03" (at 0 -4.445 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(symbol "MPR121QR2_BOARD" (in_bom yes) (on_board yes)
|
||||
(property "Reference" "U" (id 0) (at -10.16 19.05 0)
|
||||
(effects (font (size 1.27 1.27)))
|
||||
|
1859
PCB/main/chu_main.pretty/ChuAcrylic.kicad_mod
Normal file
1859
PCB/main/chu_main.pretty/ChuAcrylic.kicad_mod
Normal file
File diff suppressed because it is too large
Load Diff
@ -10,5 +10,5 @@
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp a78c44d6-409f-4574-88da-bbfbb5d29d39)
|
||||
)
|
||||
(pad "1" smd roundrect (at 0 0) (size 13.4 23.2) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a))
|
||||
(pad "1" smd roundrect (at 0 0) (size 13.4 25.2) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a))
|
||||
)
|
||||
|
@ -10,7 +10,7 @@
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp a78c44d6-409f-4574-88da-bbfbb5d29d39)
|
||||
)
|
||||
(pad "" np_thru_hole oval (at -3.4 -15) (size 2 2) (drill 2.1) (layers *.Mask) (tstamp 7be2db43-a2cf-4a25-af6d-7e74d20d8199))
|
||||
(pad "" np_thru_hole oval (at 3.4 -15) (size 2 2) (drill 2.1) (layers *.Mask) (tstamp b164a7c6-07ae-46ed-b74e-202bdc7cd652))
|
||||
(pad "1" smd roundrect (at 0 0) (size 13.4 23.2) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a))
|
||||
(pad "" np_thru_hole oval (at -3.4 -21) (size 2 2) (drill 2.1) (layers *.Mask) (tstamp 7be2db43-a2cf-4a25-af6d-7e74d20d8199))
|
||||
(pad "" np_thru_hole oval (at 3.4 -21) (size 2 2) (drill 2.1) (layers *.Mask) (tstamp b164a7c6-07ae-46ed-b74e-202bdc7cd652))
|
||||
(pad "1" smd roundrect (at 0 0) (size 13.4 25.2) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.01923076923) (tstamp c91a4918-7c7b-44c4-a8fe-15b574de971a))
|
||||
)
|
||||
|
28
PCB/main/chu_main.pretty/GP2Y0E03.kicad_mod
Normal file
28
PCB/main/chu_main.pretty/GP2Y0E03.kicad_mod
Normal file
@ -0,0 +1,28 @@
|
||||
(footprint "GP2Y0E03" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 0)
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 827ea950-012b-4519-ac59-027cdeb512b9)
|
||||
)
|
||||
(fp_text value "GP2Y0E03" (at 0 3 unlocked) (layer "F.Fab") hide
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02)
|
||||
)
|
||||
(fp_text user "V G V E C D" (at 0 4 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1.16) (thickness 0.15)))
|
||||
(tstamp a56405fb-d8d0-479c-b0d0-ba2e43f42afe)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 3 unlocked) (layer "F.Fab") hide
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 5f8d66d3-cbb6-4f8d-8c3b-c374027dcda5)
|
||||
)
|
||||
(fp_rect (start -7 -3) (end 7 3) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc))
|
||||
(pad "1" smd roundrect (at -5 0) (size 1.2 4) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.1666666667) (tstamp 49fa41bb-f1f4-4964-9db1-f426aa853525))
|
||||
(pad "2" smd roundrect (at -3 0) (size 1.2 4) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.1666666667) (tstamp 93c4b2e4-1795-480d-b0f2-f15997ebb4af))
|
||||
(pad "3" smd roundrect (at -1 0) (size 1.2 4) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.1666666667) (tstamp 08401f91-8865-426c-8742-5af2658376da))
|
||||
(pad "4" smd roundrect (at 1 0) (size 1.2 4) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.1666666667) (tstamp 9ddceccf-664d-428b-9381-7930c39a82c8))
|
||||
(pad "5" smd roundrect (at 3 0) (size 1.2 4) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.1666666667) (tstamp 35763b7e-f7e0-4335-b5f1-dc1522f8900a))
|
||||
(pad "6" smd roundrect (at 5 0) (size 1.2 4) (layers "F.Cu" "F.SilkS") (roundrect_rratio 0.1666666667) (tstamp 7180e2fa-9d46-4456-b8c5-2e6ed26a3f6c))
|
||||
)
|
27
PCB/main/chu_main.pretty/GP2Y0E03_REAL.kicad_mod
Normal file
27
PCB/main/chu_main.pretty/GP2Y0E03_REAL.kicad_mod
Normal file
@ -0,0 +1,27 @@
|
||||
(footprint "GP2Y0E03_REAL" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 0)
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -4 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 827ea950-012b-4519-ac59-027cdeb512b9)
|
||||
)
|
||||
(fp_text value "GP2Y0E03_REAL" (at 0 3 unlocked) (layer "F.Fab") hide
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 8346c2d9-d092-4781-b7b2-784caf31fc02)
|
||||
)
|
||||
(fp_line (start -3 10.5) (end -3 14) (layer "F.SilkS") (width 0.12) (tstamp 1a9cbd79-fa00-4dc8-b673-2cd36dc2535d))
|
||||
(fp_line (start 3 10.5) (end 3 14) (layer "F.SilkS") (width 0.12) (tstamp 8de0d106-a9fe-4052-8d57-3ff001621b31))
|
||||
(fp_line (start -6 0) (end 6 0) (layer "F.SilkS") (width 0.12) (tstamp 9114e558-704b-48e8-8b00-69f3c5295115))
|
||||
(fp_line (start 1.5 10.5) (end 1.5 14) (layer "F.SilkS") (width 0.12) (tstamp a5c7ea59-98f2-4ddd-ad9f-76135a5f6c23))
|
||||
(fp_line (start -1.5 10.5) (end -1.5 14) (layer "F.SilkS") (width 0.12) (tstamp c17b2166-4e2e-4026-adee-e464a669401c))
|
||||
(fp_line (start 0 10.5) (end 0 14) (layer "F.SilkS") (width 0.12) (tstamp e49fc30d-ff05-4787-a482-6d8a69b19784))
|
||||
(fp_line (start 0 -2) (end 0 2) (layer "F.SilkS") (width 0.12) (tstamp ebb6f359-1646-4812-a402-774065d58651))
|
||||
(fp_rect (start -4.5 10.5) (end 4.5 14) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 373b3318-08bc-42ef-a089-278c6f6bd095))
|
||||
(fp_rect (start -5.5 -6.5) (end 5.5 10.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 847b0a6b-122d-4dfa-b44b-cf5835a558cc))
|
||||
(model "${KIPRJMOD}/3dmodels/gp2y0e03.wrl"
|
||||
(offset (xyz 0 -2 0))
|
||||
(scale (xyz 0.3937 0.3937 0.3937))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
20713074296469267
|
||||
20718151510902424
|
||||
Battery
|
||||
BatteryHolder_Bulgin_BX0036_1xC
|
||||
Bulgin Battery Holder, BX0036, Battery Type C (https://www.bulgin.com/products/pub/media/bulgin/data/Battery_holders.pdf)
|
||||
@ -87276,6 +87276,13 @@ varistor SIOV
|
||||
2
|
||||
2
|
||||
chu_main
|
||||
ChuAcrylic
|
||||
|
||||
|
||||
0
|
||||
0
|
||||
0
|
||||
chu_main
|
||||
ChuKey
|
||||
|
||||
|
||||
@ -87297,6 +87304,20 @@ Tactile Switch
|
||||
6
|
||||
2
|
||||
chu_main
|
||||
GP2Y0E03
|
||||
|
||||
|
||||
0
|
||||
6
|
||||
6
|
||||
chu_main
|
||||
GP2Y0E03_REAL
|
||||
|
||||
|
||||
0
|
||||
0
|
||||
0
|
||||
chu_main
|
||||
MPR121_BOARD
|
||||
UQFN, 20 Pin (https://resurgentsemi.com/wp-content/uploads/2018/09/MPR121_rev5-Resurgent.pdf?d453f8&d453f8), generated with kicad-footprint-generator ipc_noLead_generator.py
|
||||
UQFN NoLead
|
||||
|
848
cad/keypad.dxf
Normal file
848
cad/keypad.dxf
Normal file
@ -0,0 +1,848 @@
|
||||
999
|
||||
"DXF R12 Output" (www.mydxf.blogspot.com)
|
||||
0
|
||||
SECTION
|
||||
2
|
||||
HEADER
|
||||
9
|
||||
$ACADVER
|
||||
1
|
||||
AC1009
|
||||
9
|
||||
$EXTMIN
|
||||
10
|
||||
0
|
||||
20
|
||||
0
|
||||
9
|
||||
$EXTMAX
|
||||
10
|
||||
8.5
|
||||
20
|
||||
11
|
||||
0
|
||||
ENDSEC
|
||||
0
|
||||
SECTION
|
||||
2
|
||||
ENTITIES
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Outline
|
||||
10
|
||||
28.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
17.800000
|
||||
21
|
||||
160.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Outline
|
||||
10
|
||||
17.800000
|
||||
20
|
||||
160.000000
|
||||
11
|
||||
17.800000
|
||||
21
|
||||
130.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Outline
|
||||
10
|
||||
17.800000
|
||||
20
|
||||
130.000000
|
||||
11
|
||||
273.800000
|
||||
21
|
||||
130.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Outline
|
||||
10
|
||||
273.800000
|
||||
20
|
||||
130.000000
|
||||
11
|
||||
273.800000
|
||||
21
|
||||
160.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Outline
|
||||
10
|
||||
273.800000
|
||||
20
|
||||
160.000000
|
||||
11
|
||||
263.600000
|
||||
21
|
||||
190.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Outline
|
||||
10
|
||||
263.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
28.000000
|
||||
21
|
||||
190.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
261.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
261.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
246.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
247.000000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
247.000000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
247.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
250.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
249.000000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
249.000000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
249.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
231.400000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
232.400000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
232.400000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
232.400000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
235.400000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
234.400000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
234.400000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
234.400000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
216.800000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
217.800000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
217.800000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
217.800000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
220.800000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
219.800000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
219.800000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
219.800000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
202.200000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
203.200000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
203.200000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
203.200000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
206.200000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
205.200000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
205.200000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
205.200000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
187.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
188.600000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
188.600000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
188.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
191.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
190.600000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
190.600000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
190.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
173.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
174.000000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
174.000000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
174.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
177.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
176.000000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
176.000000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
176.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
158.400000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
159.400000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
159.400000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
159.400000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
162.400000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
161.400000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
161.400000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
161.400000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
143.800000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
144.800000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
144.800000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
144.800000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
147.800000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
146.800000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
146.800000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
146.800000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
129.200000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
130.200000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
130.200000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
130.200000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
133.200000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
132.200000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
132.200000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
132.200000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
114.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
115.600000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
115.600000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
115.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
118.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
117.600000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
117.600000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
117.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
100.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
101.000000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
101.000000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
101.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
104.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
103.000000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
103.000000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
103.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
85.400000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
86.400000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
86.400000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
86.400000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
89.400000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
88.400000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
88.400000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
88.400000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
70.800000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
71.800000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
71.800000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
71.800000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
74.800000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
73.800000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
73.800000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
73.800000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
56.200000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
57.200000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
57.200000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
57.200000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
60.200000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
59.200000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
59.200000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
59.200000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
41.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
42.600000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
42.600000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
42.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
45.600000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
44.600000
|
||||
21
|
||||
188.036360
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
44.600000
|
||||
20
|
||||
188.036360
|
||||
11
|
||||
44.600000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
LINE
|
||||
8
|
||||
Splitter
|
||||
10
|
||||
30.000000
|
||||
20
|
||||
190.000000
|
||||
11
|
||||
30.000000
|
||||
21
|
||||
136.000000
|
||||
0
|
||||
ENDSEC
|
||||
0
|
||||
EOF
|
339
cad/keypad.svg
Normal file
339
cad/keypad.svg
Normal file
@ -0,0 +1,339 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="297mm"
|
||||
height="210mm"
|
||||
viewBox="0 0 297 210"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="keypad.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.7385171"
|
||||
inkscape:cx="175.35139"
|
||||
inkscape:cy="252.53308"
|
||||
inkscape:window-width="1389"
|
||||
inkscape:window-height="1002"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
showborder="true"
|
||||
borderlayer="true" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Outline"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:#f7a610;fill-opacity:0.17105263;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 28,20 17.8,50 v 30 h 256 V 50 L 263.6,20 Z"
|
||||
id="path11970"
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
inkscape:label="Shape" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="Screws">
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-3"
|
||||
cx="182.3"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc6" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-7"
|
||||
cx="109.3"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc5" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-2-8"
|
||||
cx="270.60001"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc4" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-1"
|
||||
cx="270.60001"
|
||||
cy="61.200001"
|
||||
r="1.2"
|
||||
inkscape:label="Sc3" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-2"
|
||||
cx="21"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc2" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107"
|
||||
cx="21"
|
||||
cy="61.200001"
|
||||
r="1.2"
|
||||
inkscape:label="Sc1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="Keys"
|
||||
style="display:none">
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-8-2-4"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="249"
|
||||
y="20"
|
||||
inkscape:label="K16" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-1-8-4"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="234.40002"
|
||||
y="20"
|
||||
inkscape:label="K15" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-4-0"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="219.8"
|
||||
y="20"
|
||||
inkscape:label="K14" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-8-2"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="205.2"
|
||||
y="20"
|
||||
inkscape:label="K13" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-8-8"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="190.59999"
|
||||
y="20"
|
||||
inkscape:label="K12" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-1-7"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="176"
|
||||
y="20"
|
||||
inkscape:label="K11" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-7"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="161.39999"
|
||||
y="20"
|
||||
inkscape:label="K10" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-3"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="146.8"
|
||||
y="20"
|
||||
inkscape:label="K9" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-8-2"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="132.2"
|
||||
y="20"
|
||||
inkscape:label="K8" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-1-8"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="117.60001"
|
||||
y="20"
|
||||
inkscape:label="K7" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-4"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="103"
|
||||
y="20"
|
||||
inkscape:label="K6" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-8"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="88.400002"
|
||||
y="20"
|
||||
inkscape:label="K5" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6-8"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="73.799995"
|
||||
y="20"
|
||||
inkscape:label="K4" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-1"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="59.200001"
|
||||
y="20"
|
||||
inkscape:label="K3" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445-6"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="44.599998"
|
||||
y="20"
|
||||
inkscape:label="K2" />
|
||||
<rect
|
||||
style="vector-effect:non-scaling-stroke;fill:#31ff00;fill-opacity:0.102632;stroke:#94f490;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="rect6445"
|
||||
width="12.6"
|
||||
height="60"
|
||||
x="30"
|
||||
y="20"
|
||||
inkscape:label="K1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Splitter">
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 261.6,20 V 73.999996"
|
||||
id="path6143-0-7"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:label="S16" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 246,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-1-9-6"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S15" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 231.4,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-1-0"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S14" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 216.8,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-4-7"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S13" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 202.2,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-8-5"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S12" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 187.6,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-1-4"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S11" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 173,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-85"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S10" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 158.4,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-6"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S9" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 143.8,20 1,1.963636 v 52.03636 M 147.8,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-8-8"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S8" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 129.2,20 1,1.963636 v 52.03636 M 133.2,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-1-9"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S7" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 114.6,20 1,1.963636 v 52.03636 M 118.6,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-1"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S6" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 100,20 1,1.963636 v 52.03636 M 104,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-4"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S5" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 85.4,20 1,1.963636 v 52.03636 M 89.4,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-8"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S4" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 70.8,20 1,1.963636 v 52.03636 M 74.8,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-1"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S3" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 56.2,20 1,1.963636 v 52.03636 M 60.2,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S2" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 41.6,20 1,1.963636 v 52.03636 M 45.6,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S1" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 30,20 V 73.999996"
|
||||
id="path6143-0"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:label="S0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 14 KiB |
205
cad/keypad_kicad.svg
Normal file
205
cad/keypad_kicad.svg
Normal file
@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="297mm"
|
||||
height="210mm"
|
||||
viewBox="0 0 297 210"
|
||||
version="1.1"
|
||||
id="svg5"
|
||||
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
|
||||
sodipodi:docname="keypad_kicad.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview7"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.7385171"
|
||||
inkscape:cx="175.35139"
|
||||
inkscape:cy="252.53308"
|
||||
inkscape:window-width="1389"
|
||||
inkscape:window-height="1002"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1"
|
||||
showborder="true"
|
||||
borderlayer="true" />
|
||||
<defs
|
||||
id="defs2" />
|
||||
<g
|
||||
inkscape:label="Outline"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.17105263;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 28,20 17.8,50 v 30 h 256 V 50 L 263.6,20 Z"
|
||||
id="path11970"
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
inkscape:label="Shape" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer4"
|
||||
inkscape:label="Screws">
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-3"
|
||||
cx="182.3"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc6" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-7"
|
||||
cx="109.3"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc5" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-2-8"
|
||||
cx="270.60001"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc4" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-1"
|
||||
cx="270.60001"
|
||||
cy="61.200001"
|
||||
r="1.2"
|
||||
inkscape:label="Sc3" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107-2"
|
||||
cx="21"
|
||||
cy="76.599998"
|
||||
r="1.2"
|
||||
inkscape:label="Sc2" />
|
||||
<circle
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:1;stroke:#00001e;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
id="path12107"
|
||||
cx="21"
|
||||
cy="61.200001"
|
||||
r="1.2"
|
||||
inkscape:label="Sc1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer2"
|
||||
inkscape:label="Splitter">
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 261.6,20 V 73.999996"
|
||||
id="path6143-0-7"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:label="S16" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 246,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-1-9-6"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S15" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 231.4,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-1-0"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S14" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 216.8,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-4-7"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S13" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 202.2,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-8-5"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S12" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 187.6,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-1-4"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S11" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 173,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-7-85"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S10" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 158.4,20 1,1.963636 V 74 m 3,-54 -1,1.963636 V 74"
|
||||
id="path6143-6"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S9" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 143.8,20 1,1.963636 v 52.03636 M 147.8,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-8-8"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S8" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 129.2,20 1,1.963636 v 52.03636 M 133.2,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-1-9"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S7" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 114.6,20 1,1.963636 v 52.03636 M 118.6,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-1"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S6" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 100,20 1,1.963636 v 52.03636 M 104,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-4"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S5" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 85.4,20 1,1.963636 v 52.03636 M 89.4,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7-8"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S4" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 70.8,20 1,1.963636 v 52.03636 M 74.8,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-1"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S3" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 56.2,20 1,1.963636 v 52.03636 M 60.2,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143-7"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S2" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="m 41.6,20 1,1.963636 v 52.03636 M 45.6,20 l -1,1.963636 v 52.03636"
|
||||
id="path6143"
|
||||
sodipodi:nodetypes="cccccc"
|
||||
inkscape:label="S1" />
|
||||
<path
|
||||
style="vector-effect:non-scaling-stroke;fill:none;fill-opacity:0.732456;stroke:#ff0000;stroke-width:0.264583;stroke-dasharray:none;stroke-opacity:1;-inkscape-stroke:hairline"
|
||||
d="M 30,20 V 73.999996"
|
||||
id="path6143-0"
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:label="S0" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 9.3 KiB |
BIN
cad/keypad_numbers.xlsx
Normal file
BIN
cad/keypad_numbers.xlsx
Normal file
Binary file not shown.
4
firmware/.gitignore
vendored
Normal file
4
firmware/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
build
|
||||
pico-examples
|
||||
pico-sdk
|
||||
.vscode
|
12
firmware/CMakeLists.txt
Normal file
12
firmware/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
# Pull in SDK (must set be before project)
|
||||
include(pico_sdk_import.cmake)
|
||||
|
||||
project(iidx_pico C CXX ASM)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
pico_sdk_init()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(lib/pico-mpr121 mpr121)
|
674
firmware/LICENSE
Normal file
674
firmware/LICENSE
Normal file
@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
10
firmware/README.md
Normal file
10
firmware/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# IIDX Pico Firmware
|
||||
|
||||
Features:
|
||||
* 1000Hz polling rate.
|
||||
* HID lights.
|
||||
* RGB turntable.
|
||||
* Configuration save.
|
||||
* Customizable through board_defs.h
|
||||
* Dymanic settings.
|
||||
|
17
firmware/lib/pico-mpr121/CMakeLists.txt
Normal file
17
firmware/lib/pico-mpr121/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
add_library(pico-mpr121 INTERFACE)
|
||||
|
||||
target_include_directories(pico-mpr121
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/include
|
||||
)
|
||||
|
||||
target_link_libraries(pico-mpr121
|
||||
INTERFACE
|
||||
hardware_i2c
|
||||
)
|
||||
|
||||
target_sources(pico-mpr121
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_LIST_DIR}/mpr121.c
|
||||
${CMAKE_CURRENT_LIST_DIR}/include/mpr121.h
|
||||
)
|
363
firmware/lib/pico-mpr121/include/mpr121.h
Normal file
363
firmware/lib/pico-mpr121/include/mpr121.h
Normal file
@ -0,0 +1,363 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Antonio González
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef _MPR121_H_
|
||||
#define _MPR121_H_
|
||||
|
||||
#include "pico.h"
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
/** \file mpr121.h
|
||||
* \brief Library for using an MPR121-based touch sensor with the
|
||||
* Raspberry Pi Pico
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct mpr121_sensor {
|
||||
i2c_inst_t *i2c_port;
|
||||
uint8_t i2c_addr;
|
||||
// uint8_t i2c_sda;
|
||||
// uint8_t ic2_scl;
|
||||
} mpr121_sensor_t;
|
||||
|
||||
/*! \brief MPR121 register map
|
||||
*/
|
||||
enum mpr121_register {
|
||||
MPR121_TOUCH_STATUS_REG = 0x00u,
|
||||
MPR121_OUT_OF_RANGE_STATUS_0_REG = 0x02u,
|
||||
MPR121_OUT_OF_RANGE_STATUS_1_REG = 0x03u,
|
||||
MPR121_ELECTRODE_FILTERED_DATA_REG = 0x04u,
|
||||
MPR121_BASELINE_VALUE_REG = 0x1Eu,
|
||||
// Registers 0x2B ~ 0x7F are control and configuration registers
|
||||
MPR121_MAX_HALF_DELTA_RISING_REG = 0x2Bu,
|
||||
MPR121_NOISE_HALF_DELTA_RISING_REG = 0x2Cu,
|
||||
MPR121_NOISE_COUNT_LIMIT_RISING_REG = 0x2Du,
|
||||
MPR121_FILTER_DELAY_COUNT_RISING_REG = 0x2Eu,
|
||||
MPR121_MAX_HALF_DELTA_FALLING_REG = 0x2Fu,
|
||||
MPR121_NOISE_HALF_DELTA_FALLING_REG = 0x30u,
|
||||
MPR121_NOISE_COUNT_LIMIT_FALLING_REG = 0x31u,
|
||||
MPR121_FILTER_DELAY_COUNT_FALLING_REG = 0x32u,
|
||||
MPR121_NOISE_HALF_DELTA_TOUCHED_REG = 0x33u,
|
||||
MPR121_NOISE_COUNT_LIMIT_TOUCHED_REG = 0x34u,
|
||||
MPR121_FILTER_DELAY_COUNT_TOUCHED_REG = 0x35u,
|
||||
// (ELEPROX 0x36 .. 0x40)
|
||||
MPR121_TOUCH_THRESHOLD_REG = 0x41u,
|
||||
MPR121_RELEASE_THRESHOLD_REG = 0x42u,
|
||||
// (ELEPROX 0x59 .. 0x5A)
|
||||
MPR121_DEBOUNCE_REG = 0x5Bu,
|
||||
MPR121_AFE_CONFIG_REG = 0x5Cu,
|
||||
MPR121_FILTER_CONFIG_REG = 0x5Du,
|
||||
MPR121_ELECTRODE_CONFIG_REG = 0x5Eu,
|
||||
MPR121_ELECTRODE_CURRENT_REG = 0x5Fu,
|
||||
MPR121_ELECTRODE_CHARGE_TIME_REG = 0x6Cu,
|
||||
MPR121_GPIO_CTRL_0_REG = 0x73u,
|
||||
MPR121_GPIO_CTRL_1_REG = 0x74u,
|
||||
MPR121_GPIO_DATA_REG = 0x75u,
|
||||
MPR121_GPIO_DIRECTION_REG = 0x76u,
|
||||
MPR121_GPIO_ENABLE_REG = 0x77u,
|
||||
MPR121_GPIO_DATA_SET_REG = 0x78u,
|
||||
MPR121_GPIO_DATA_CLEAR_REG = 0x79u,
|
||||
MPR121_GPIO_DATA_TOGGLE_REG = 0x7Au,
|
||||
MPR121_AUTOCONFIG_CONTROL_0_REG = 0x7Bu,
|
||||
MPR121_AUTOCONFIG_CONTROL_1_REG = 0x7Cu,
|
||||
MPR121_AUTOCONFIG_USL_REG = 0x7Du,
|
||||
MPR121_AUTOCONFIG_LSL_REG = 0x7Eu,
|
||||
MPR121_AUTOCONFIG_TARGET_REG = 0x7Fu,
|
||||
MPR121_SOFT_RESET_REG = 0x80u
|
||||
};
|
||||
|
||||
/*! \brief Initialise the MPR121 and configure registers
|
||||
*
|
||||
* The default parameters used here to configure the sensor are as in
|
||||
* the MPR121 Quick Start Guide (AN3944).
|
||||
*
|
||||
* \param i2c_port The I2C instance, either i2c0 or i2c1
|
||||
* \param i2c_addr The I2C address of the MPR121 device
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
void mpr121_init(i2c_inst_t *i2c_port, uint8_t i2c_addr,
|
||||
mpr121_sensor_t *sensor);
|
||||
|
||||
/*! \brief Write a value to the specified register
|
||||
*
|
||||
* \param reg The register address
|
||||
* \param val The value to write
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_write(enum mpr121_register reg, uint8_t val,
|
||||
mpr121_sensor_t *sensor) {
|
||||
uint8_t buf[] = {reg, val};
|
||||
i2c_write_blocking(sensor->i2c_port, sensor->i2c_addr, buf, 2,
|
||||
false);
|
||||
}
|
||||
|
||||
/*! \brief Read a byte from the specified register
|
||||
*
|
||||
* \param reg The register address
|
||||
* \param dst Pointer to buffer to receive data
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_read(enum mpr121_register reg, uint8_t *dst,
|
||||
mpr121_sensor_t *sensor) {
|
||||
i2c_write_blocking(sensor->i2c_port, sensor->i2c_addr, ®, 1,
|
||||
true);
|
||||
i2c_read_blocking(sensor->i2c_port, sensor->i2c_addr, dst, 1,
|
||||
false);
|
||||
}
|
||||
|
||||
/*! \brief Read a 2-byte value from the specified register
|
||||
*
|
||||
* \param reg The register address
|
||||
* \param dst Pointer to buffer to receive data
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_read16(enum mpr121_register reg, uint16_t *dst,
|
||||
mpr121_sensor_t *sensor) {
|
||||
uint8_t vals[2];
|
||||
i2c_write_blocking(sensor->i2c_port, sensor->i2c_addr, ®, 1,
|
||||
true);
|
||||
i2c_read_blocking(sensor->i2c_port, sensor->i2c_addr, vals, 2,
|
||||
false);
|
||||
*dst = vals[1] << 8 | vals[0];
|
||||
}
|
||||
|
||||
/*! \brief Set touch and release thresholds
|
||||
*
|
||||
* From the MPR121 datasheet (section 5.6):
|
||||
* > In a typical application, touch threshold is in the range 4--16,
|
||||
* > and it is several counts larger than the release threshold. This
|
||||
* > is to provide hysteresis and to prevent noise and jitter.
|
||||
*
|
||||
* \param touch Touch threshold in the range 0--255
|
||||
* \param release Release threshold in the range 0--255
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_set_thresholds(uint8_t touch, uint8_t release,
|
||||
mpr121_sensor_t *sensor) {
|
||||
uint8_t config;
|
||||
mpr121_read(MPR121_ELECTRODE_CONFIG_REG, &config, sensor);
|
||||
if (config != 0){
|
||||
// Stop mode
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<12; i++) {
|
||||
mpr121_write(MPR121_TOUCH_THRESHOLD_REG + i * 2, touch, sensor);
|
||||
mpr121_write(MPR121_RELEASE_THRESHOLD_REG + i * 2, release,
|
||||
sensor);
|
||||
}
|
||||
|
||||
if (config != 0){
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, config, sensor);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Enable only the number of electrodes specified
|
||||
*
|
||||
* \param nelec Number of electrodes to enable
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*
|
||||
* E.g. if `nelec` is 3, electrodes 0 to 2 will be enabled; if `nelec`
|
||||
* is 6, electrodes 0 to 5 will be enabled. From the datasheet:
|
||||
* "Enabling specific channels will save the scan time and sensing
|
||||
* field power spent on the unused channels."
|
||||
*/
|
||||
static void mpr121_enable_electrodes(uint8_t nelec,
|
||||
mpr121_sensor_t *sensor){
|
||||
uint8_t config;
|
||||
mpr121_read(MPR121_ELECTRODE_CONFIG_REG, &config, sensor);
|
||||
|
||||
// Clear bits 3-0, which controls the operation of the 12
|
||||
// electrodes.
|
||||
config &= ~0x0f;
|
||||
|
||||
// Set number of electrodes enabled
|
||||
config |= nelec;
|
||||
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, config, sensor);
|
||||
}
|
||||
|
||||
/*! \brief Read the touch/release status of all 13 input channels
|
||||
*
|
||||
* \param dst Pointer to buffer to receive data
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*
|
||||
* In the value read, bits 11-0 represent electrodes 11 to 0,
|
||||
* respectively, and bit 12 is the proximity detection channel. Each
|
||||
* bit represent the status of these channels: 1 if the channel is
|
||||
* touched, 0 if it is released.
|
||||
*/
|
||||
static void mpr121_touched(uint16_t *dst, mpr121_sensor_t *sensor) {
|
||||
mpr121_read16(MPR121_TOUCH_STATUS_REG, dst, sensor);
|
||||
*dst &= 0x0fff;
|
||||
}
|
||||
|
||||
/*! \brief Determine whether an electrode has been touched
|
||||
*
|
||||
* \param electrode Electrode number
|
||||
* \param dst Pointer to buffer to receive data
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_is_touched(uint8_t electrode, bool *dst,
|
||||
mpr121_sensor_t *sensor){
|
||||
uint16_t touched;
|
||||
mpr121_touched(&touched, sensor);
|
||||
*dst = (bool) ((touched >> electrode) & 1);
|
||||
}
|
||||
|
||||
/*! \brief Read an electrode's filtered data value
|
||||
*
|
||||
* \param electrode Electrode number
|
||||
* \param dst Pointer to buffer to receive data
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*
|
||||
* The data range of the filtered data is 0 to 1024.
|
||||
* \sa mpr121_baseline_value
|
||||
*/
|
||||
static void mpr121_filtered_data(uint8_t electrode, uint16_t *dst,
|
||||
mpr121_sensor_t *sensor){
|
||||
mpr121_read16(MPR121_ELECTRODE_FILTERED_DATA_REG + (electrode * 2),
|
||||
dst, sensor);
|
||||
// Filtered data is 10-bit
|
||||
*dst &= 0x3ff;
|
||||
}
|
||||
|
||||
/*! \brief Read an electrode's baseline value
|
||||
*
|
||||
* \param electrode Electrode number
|
||||
* \param dst Pointer to buffer to receive data
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*
|
||||
* From the MPR112 datasheet:
|
||||
* > Along with the 10-bit electrode filtered data output, each channel
|
||||
* > also has a 10-bit baseline value. These values are the output of
|
||||
* > the internal baseline filter operation tracking the slow-voltage
|
||||
* > variation of the background capacitance change. Touch/release
|
||||
* > detection is made based on the comparison between the 10-bit
|
||||
* > electrode filtered data and the 10-bit baseline value.
|
||||
*
|
||||
* > Although internally the baseline value is 10-bit, users can only
|
||||
* > access the 8 MSB of the 10-bit baseline value through the baseline
|
||||
* > value registers.
|
||||
*
|
||||
* \sa mpr121_filtered_data
|
||||
*/
|
||||
static void mpr121_baseline_value(uint8_t electrode, uint16_t *dst,
|
||||
mpr121_sensor_t *sensor){
|
||||
uint8_t baseline;
|
||||
mpr121_read(MPR121_BASELINE_VALUE_REG + electrode, &baseline,
|
||||
sensor);
|
||||
// From the datasheet: Although internally the baseline value is
|
||||
// 10-bit, users can only access the 8 MSB of the 10-bit baseline
|
||||
// value through the baseline value registers. The read out from the
|
||||
// baseline register must be left shift two bits before comparing it
|
||||
// with the 10-bit electrode data.
|
||||
*dst = baseline << 2;
|
||||
}
|
||||
|
||||
/*! \brief Set the Max Half Delta
|
||||
*
|
||||
* The Max Half Delta determines the largest magnitude of variation to
|
||||
* pass through the third level filter. See application note MPR121
|
||||
* Baseline System (AN3891) for details.
|
||||
*
|
||||
* \param rising Value in the range 1~63
|
||||
* \param falling Value in the range 1~63
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_set_max_half_delta(uint8_t rising, uint8_t falling,
|
||||
mpr121_sensor_t *sensor) {
|
||||
// Read current configuration then enter stop mode
|
||||
uint8_t config;
|
||||
mpr121_read(MPR121_ELECTRODE_CONFIG_REG, &config, sensor);
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
// Write MHD values
|
||||
mpr121_write(MPR121_MAX_HALF_DELTA_RISING_REG, rising, sensor);
|
||||
mpr121_write(MPR121_MAX_HALF_DELTA_FALLING_REG, falling, sensor);
|
||||
// Re-enable electrodes
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, config, sensor);
|
||||
}
|
||||
|
||||
/*! \brief Set the Noise Half Delta
|
||||
*
|
||||
* The Noise Half Delta determines the incremental change when
|
||||
* non-noise drift is detected. See application note MPR121 Baseline
|
||||
* System (AN3891) for details.
|
||||
*
|
||||
* \param rising Value in the range 1~63
|
||||
* \param falling Value in the range 1~63
|
||||
* \param touched Value in the range 1~63
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_set_noise_half_delta(uint8_t rising, uint8_t falling,
|
||||
uint8_t touched, mpr121_sensor_t *sensor) {
|
||||
// Read current configuration then enter stop mode
|
||||
uint8_t config;
|
||||
mpr121_read(MPR121_ELECTRODE_CONFIG_REG, &config, sensor);
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
// Write NHD values
|
||||
mpr121_write(MPR121_NOISE_HALF_DELTA_RISING_REG, rising, sensor);
|
||||
mpr121_write(MPR121_NOISE_HALF_DELTA_FALLING_REG, falling, sensor);
|
||||
mpr121_write(MPR121_NOISE_HALF_DELTA_TOUCHED_REG, touched, sensor);
|
||||
// Re-enable electrodes
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, config, sensor);
|
||||
}
|
||||
|
||||
/*! \brief Set the Noise Count Limit
|
||||
*
|
||||
* The Noise Count Limit determines the number of samples consecutively
|
||||
* greater than the Max Half Delta necessary before it can be
|
||||
* determined that it is non-noise. See application note MPR121 Baseline
|
||||
* System (AN3891) for details.
|
||||
*
|
||||
* \param rising Value in the range 0~255
|
||||
* \param falling Value in the range 0~255
|
||||
* \param touched Value in the range 0~255
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_set_noise_count_limit(uint8_t rising,
|
||||
uint8_t falling, uint8_t touched, mpr121_sensor_t *sensor) {
|
||||
// Read current configuration then enter stop mode
|
||||
uint8_t config;
|
||||
mpr121_read(MPR121_ELECTRODE_CONFIG_REG, &config, sensor);
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
// Write new NCL values
|
||||
mpr121_write(MPR121_NOISE_COUNT_LIMIT_RISING_REG, rising, sensor);
|
||||
mpr121_write(MPR121_NOISE_COUNT_LIMIT_FALLING_REG, falling, sensor);
|
||||
mpr121_write(MPR121_NOISE_COUNT_LIMIT_TOUCHED_REG, touched, sensor);
|
||||
// Re-enable electrodes
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, config, sensor);
|
||||
}
|
||||
|
||||
/*! \brief Set the Filter Delay Limit
|
||||
*
|
||||
* The Filter Delay Limit determines the rate of operation of the
|
||||
* filter. A larger number makes it operate slower. See application
|
||||
* note MPR121 Baseline System (AN3891) for details.
|
||||
*
|
||||
* \param rising Value in the range 0~255
|
||||
* \param falling Value in the range 0~255
|
||||
* \param touched Value in the range 0~255
|
||||
* \param sensor Pointer to the structure that stores the MPR121 info
|
||||
*/
|
||||
static void mpr121_set_filter_delay_limit(uint8_t rising,
|
||||
uint8_t falling, uint8_t touched, mpr121_sensor_t *sensor) {
|
||||
// Read current configuration then enter stop mode
|
||||
uint8_t config;
|
||||
mpr121_read(MPR121_ELECTRODE_CONFIG_REG, &config, sensor);
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
// Write new FDL values
|
||||
mpr121_write(MPR121_FILTER_DELAY_COUNT_RISING_REG, rising, sensor);
|
||||
mpr121_write(MPR121_FILTER_DELAY_COUNT_FALLING_REG, falling,
|
||||
sensor);
|
||||
mpr121_write(MPR121_FILTER_DELAY_COUNT_TOUCHED_REG, touched,
|
||||
sensor);
|
||||
// Re-enable electrodes
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, config, sensor);
|
||||
}
|
||||
|
||||
#endif
|
170
firmware/lib/pico-mpr121/mpr121.c
Normal file
170
firmware/lib/pico-mpr121/mpr121.c
Normal file
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Antonio González
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include "mpr121.h"
|
||||
|
||||
void mpr121_init(i2c_inst_t *i2c_port, uint8_t i2c_addr,
|
||||
mpr121_sensor_t *sensor) {
|
||||
sensor->i2c_port = i2c_port;
|
||||
sensor->i2c_addr = i2c_addr;
|
||||
|
||||
// Enter stop mode by setting ELEPROX_EN and ELE_EN bits to zero.
|
||||
// This is needed because register write operations can only take
|
||||
// place in stop mode.
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x00, sensor);
|
||||
|
||||
// Writing 0x80 (SOFT_RESET) with 0x63 asserts soft reset.
|
||||
mpr121_write(MPR121_SOFT_RESET_REG, 0x63, sensor);
|
||||
|
||||
// == Capacitance sensing settings (AN2889), Filtering and =========
|
||||
// timing settings (AN3890)
|
||||
|
||||
// These settings are configured in two registers: the Filter and
|
||||
// Global CDC CDT Configuration registers (0x5C, 0x5D).
|
||||
//
|
||||
// Charge-discharge current (CDC) and charge-discharge time (CDT)
|
||||
// can be configured globally or on a per-electrode basis. Here,
|
||||
// The global CDC and CDT values are set to their defaults, and then
|
||||
// these values are overriden by independently configuring each
|
||||
// electrode (auto-configuration).
|
||||
|
||||
// Filter/global CDC configuration register (0x5C)
|
||||
//
|
||||
// First filter iterations (FFI), bits 7-6. Number of samples taken
|
||||
// as input to the first level of filtering. Default is 0b00 (sets
|
||||
// samples taken to 6)
|
||||
//
|
||||
// Charge-discharge current (CDC), bits 5-0. Sets the value of
|
||||
// charge-discharge current applied to the electrode. Max is 63 µA
|
||||
// in 1 µA steps. Default is 0b010000 (16 µA)
|
||||
//
|
||||
// AFE configuration register default, 0b00010000 = 0x10
|
||||
mpr121_write(MPR121_AFE_CONFIG_REG, 0x10, sensor);
|
||||
|
||||
// Filter/global CDC configuration register (0x5D)
|
||||
//
|
||||
// Charge discharge time (CDT), bits 7-5. Selects the global value
|
||||
// of charge time applied to electrode. The maximum is 32 μs,
|
||||
// programmable as 2^(n-2) μs. Default is 0b001 (time is set to
|
||||
// 0.5 µs)
|
||||
//
|
||||
// Second filter iterations (SFI), bits 4-3. Selects the number of
|
||||
// samples taken for the second level filter. Default is 0b00
|
||||
// (number of samples is set to 4)
|
||||
//
|
||||
// Electrode sample interval (ESI), bits 2-0. Controls the sampling
|
||||
// rate of the device. The maximum is 128 ms, programmable to 2^n
|
||||
// ms. Decrease this value for better response time, increase to
|
||||
// save power. Default is 0b100 (period set to 16 ms).
|
||||
//
|
||||
// Filter configuration register default, 0b00100100 = 0x24
|
||||
// I do not need power saving features but I want fast responses,
|
||||
// so I set this to 0x20.
|
||||
mpr121_write(MPR121_FILTER_CONFIG_REG, 0x20, sensor);
|
||||
|
||||
// Auto-configuration
|
||||
//
|
||||
// Sets automatically charge current (CDC) and time (CDT) values for
|
||||
// each electrode.
|
||||
//
|
||||
// Autoconfig USL register: the upper limit for the
|
||||
// auto-configuration. This value (and those that follow below)
|
||||
// were calculated based on Vdd = 3.3 V and following the equations
|
||||
// in NXP Application Note AN3889.
|
||||
// USL = 201 = 0xC9
|
||||
mpr121_write(MPR121_AUTOCONFIG_USL_REG, 0xC9, sensor);
|
||||
|
||||
// Autoconfig target level register: the target level for the
|
||||
// auto-configuration baseline search.
|
||||
// TL = 181 = 0xB5
|
||||
mpr121_write(MPR121_AUTOCONFIG_TARGET_REG, 0xB5, sensor);
|
||||
|
||||
// Autoconfig LSL register: the lower limit for the
|
||||
// auto-configuration.
|
||||
// LSL = 131 = 0x83
|
||||
mpr121_write(MPR121_AUTOCONFIG_LSL_REG, 0x83, sensor);
|
||||
|
||||
// Autoconfiguration control register. Default value is 0b00001011 =
|
||||
// 0x0B, where:
|
||||
//
|
||||
// First filter iterations (FFI), bits 7-6. Must be the same value
|
||||
// of FFI as in register MPR121_AFE_CONFIG_REG (0x5C) above;
|
||||
// default is 0b00.
|
||||
//
|
||||
// Retry, bits 5-4. Default is disabled, 0b00.
|
||||
//
|
||||
// Baseline value adjust (BVA), bits 3-2. This value must be the
|
||||
// same as the CL (calibration lock) value in the Electrode
|
||||
// Configuration Register, below, i.e. 0b10.
|
||||
//
|
||||
// Automatic Reconfiguration Enable (ARE), bit 1. Default is 0b1,
|
||||
// enabled.
|
||||
//
|
||||
// Automatic Reconfiguration Enable (ACE), bit 0. Default is 0b1,
|
||||
// enabled.
|
||||
mpr121_write(MPR121_AUTOCONFIG_CONTROL_0_REG, 0x0B, sensor);
|
||||
|
||||
// == Baseline system (AN3891) =====================================
|
||||
|
||||
// Maximum Half Delta (MHD): Determines the largest magnitude of
|
||||
// variation to pass through the baseline filter. The range of the
|
||||
// effective value is 1~63.
|
||||
mpr121_write(MPR121_MAX_HALF_DELTA_RISING_REG, 0x01, sensor);
|
||||
mpr121_write(MPR121_MAX_HALF_DELTA_FALLING_REG, 0x01, sensor);
|
||||
|
||||
// Noise Half Delta (NHD): Determines the incremental change when
|
||||
// non-noise drift is detected. The range of the effective value is
|
||||
// 1~63.
|
||||
mpr121_write(MPR121_NOISE_HALF_DELTA_RISING_REG, 0x01, sensor);
|
||||
mpr121_write(MPR121_NOISE_HALF_DELTA_FALLING_REG, 0x01, sensor);
|
||||
mpr121_write(MPR121_NOISE_HALF_DELTA_TOUCHED_REG, 0x01, sensor);
|
||||
|
||||
// Noise Count Limit (NCL): Determines the number of samples
|
||||
// consecutively greater than the Max Half Delta value. This is
|
||||
// necessary to determine that it is not noise. The range of the
|
||||
// effective value is 0~255.
|
||||
mpr121_write(MPR121_NOISE_COUNT_LIMIT_RISING_REG, 0x00, sensor);
|
||||
mpr121_write(MPR121_NOISE_COUNT_LIMIT_FALLING_REG, 0xFF, sensor);
|
||||
mpr121_write(MPR121_NOISE_COUNT_LIMIT_TOUCHED_REG, 0x00, sensor);
|
||||
|
||||
// Filter Delay Count Limit (FDL): Determines the operation rate of
|
||||
// the filter. A larger count limit means the filter delay is
|
||||
// operating more slowly. The range of the effective value is 0~255.
|
||||
mpr121_write(MPR121_FILTER_DELAY_COUNT_RISING_REG, 0x00, sensor);
|
||||
mpr121_write(MPR121_FILTER_DELAY_COUNT_FALLING_REG, 0x02, sensor);
|
||||
mpr121_write(MPR121_FILTER_DELAY_COUNT_TOUCHED_REG, 0x00, sensor);
|
||||
|
||||
// == Debounce and thresholds (AN3892) =============================
|
||||
|
||||
// Debounce. Value range for each is 0~7.
|
||||
// Bits 2-0, debounce touch (DT).
|
||||
// Bits 6-4, debounce release (DR).
|
||||
mpr121_write(MPR121_DEBOUNCE_REG, 0x00, sensor);
|
||||
|
||||
// Touch and release threshold values for all electrodes.
|
||||
for (uint8_t i=0; i<12; i++) {
|
||||
mpr121_write(MPR121_TOUCH_THRESHOLD_REG + i * 2, 0x0F, sensor);
|
||||
mpr121_write(MPR121_RELEASE_THRESHOLD_REG + i * 2, 0x0A, sensor);
|
||||
}
|
||||
|
||||
// Electrode Configuration Register (ECR, 0x5E). This must be the
|
||||
// last register to write to because setting ELEPROX_EN and/or
|
||||
// ELE_EN to non-zero puts the sensor in Run Mode.
|
||||
//
|
||||
// Calibration lock (CL), bits 7-6. The default on reset is 0b00
|
||||
// (CL enabled). Here I set this instead to 0b10 because this
|
||||
// enables baseline tracking with initial baseline value loaded
|
||||
// with the 5 high bits of the first electrode data value, which
|
||||
// makes the sensor stabilise sooner. Note that ths value must
|
||||
// match BVA bits in the Auto-configure Control Register above.
|
||||
//
|
||||
// Proximity enable (ELEPROX_EN), bits 5-4. Default, 0b00
|
||||
// (proximity detection disabled).
|
||||
//
|
||||
// Electrode enabled (ELE_EN), bits 3-0. Default, 0b1100 (enable
|
||||
// all 12 electrodes).
|
||||
mpr121_write(MPR121_ELECTRODE_CONFIG_REG, 0x8C, sensor);
|
||||
}
|
73
firmware/pico_sdk_import.cmake
Normal file
73
firmware/pico_sdk_import.cmake
Normal file
@ -0,0 +1,73 @@
|
||||
# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake
|
||||
|
||||
# This can be dropped into an external project to help locate this SDK
|
||||
# It should be include()ed prior to project()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_PATH} AND (NOT PICO_SDK_PATH))
|
||||
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
|
||||
message("Using PICO_SDK_PATH from environment ('${PICO_SDK_PATH}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT} AND (NOT PICO_SDK_FETCH_FROM_GIT))
|
||||
set(PICO_SDK_FETCH_FROM_GIT $ENV{PICO_SDK_FETCH_FROM_GIT})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT from environment ('${PICO_SDK_FETCH_FROM_GIT}')")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_PATH))
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH $ENV{PICO_SDK_FETCH_FROM_GIT_PATH})
|
||||
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
|
||||
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
|
||||
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
|
||||
|
||||
if (NOT PICO_SDK_PATH)
|
||||
if (PICO_SDK_FETCH_FROM_GIT)
|
||||
include(FetchContent)
|
||||
set(FETCHCONTENT_BASE_DIR_SAVE ${FETCHCONTENT_BASE_DIR})
|
||||
if (PICO_SDK_FETCH_FROM_GIT_PATH)
|
||||
get_filename_component(FETCHCONTENT_BASE_DIR "${PICO_SDK_FETCH_FROM_GIT_PATH}" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}")
|
||||
endif ()
|
||||
# GIT_SUBMODULES_RECURSE was added in 3.17
|
||||
if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0")
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
GIT_SUBMODULES_RECURSE FALSE
|
||||
)
|
||||
else ()
|
||||
FetchContent_Declare(
|
||||
pico_sdk
|
||||
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
|
||||
GIT_TAG master
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT pico_sdk)
|
||||
message("Downloading Raspberry Pi Pico SDK")
|
||||
FetchContent_Populate(pico_sdk)
|
||||
set(PICO_SDK_PATH ${pico_sdk_SOURCE_DIR})
|
||||
endif ()
|
||||
set(FETCHCONTENT_BASE_DIR ${FETCHCONTENT_BASE_DIR_SAVE})
|
||||
else ()
|
||||
message(FATAL_ERROR
|
||||
"SDK location was not specified. Please set PICO_SDK_PATH or set PICO_SDK_FETCH_FROM_GIT to on to fetch from git."
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
get_filename_component(PICO_SDK_PATH "${PICO_SDK_PATH}" REALPATH BASE_DIR "${CMAKE_BINARY_DIR}")
|
||||
if (NOT EXISTS ${PICO_SDK_PATH})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' not found")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_INIT_CMAKE_FILE ${PICO_SDK_PATH}/pico_sdk_init.cmake)
|
||||
if (NOT EXISTS ${PICO_SDK_INIT_CMAKE_FILE})
|
||||
message(FATAL_ERROR "Directory '${PICO_SDK_PATH}' does not appear to contain the Raspberry Pi Pico SDK")
|
||||
endif ()
|
||||
|
||||
set(PICO_SDK_PATH ${PICO_SDK_PATH} CACHE PATH "Path to the Raspberry Pi Pico SDK" FORCE)
|
||||
|
||||
include(${PICO_SDK_INIT_CMAKE_FILE})
|
33
firmware/src/CMakeLists.txt
Normal file
33
firmware/src/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack)
|
||||
set(LWIP_ROOT ${PICO_SDK_PATH}/lib/lwip)
|
||||
|
||||
function(make_firmware board board_def)
|
||||
pico_sdk_init()
|
||||
add_executable(${board}
|
||||
main.c buttons.c rgb.c save.c config.c setup.c vl6180.c
|
||||
usb_descriptors.c)
|
||||
target_compile_definitions(${board} PUBLIC ${board_def})
|
||||
pico_enable_stdio_usb(${board} 1)
|
||||
pico_enable_stdio_uart(${board} 0)
|
||||
|
||||
pico_generate_pio_header(${board} ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio)
|
||||
|
||||
target_compile_options(${board} PRIVATE -Wfatal-errors -O3)
|
||||
target_include_directories(${board} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_include_directories(${board} PRIVATE
|
||||
${BTSTACK_ROOT}/src
|
||||
${LWIP_ROOT}/src/include)
|
||||
|
||||
target_link_libraries(${board} PRIVATE
|
||||
pico_multicore pico_stdlib hardware_pio hardware_pwm hardware_flash
|
||||
hardware_adc hardware_i2c hardware_watchdog
|
||||
tinyusb_device tinyusb_board pico-mpr121)
|
||||
|
||||
pico_add_extra_outputs(${board})
|
||||
|
||||
add_custom_command(TARGET ${board} POST_BUILD
|
||||
COMMAND cp ${board}.uf2 /mnt/d/Code/iidx_pico/firmware/build)
|
||||
endfunction()
|
||||
|
||||
make_firmware(chu_pico BOARD_IIDX_PICO)
|
||||
|
32
firmware/src/board_defs.h
Normal file
32
firmware/src/board_defs.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* IIDX Controller Board Definitions
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#if defined BOARD_IIDX_PICO
|
||||
/* List of button pins */
|
||||
#define BUTTON_DEF { 8, 7, 6, 5, 4, 3, 2, 12, 11, 10, 9, 1, 0 }
|
||||
|
||||
#define BUTTON_RGB_PIN 13
|
||||
#define BUTTON_RGB_ORDER GRB // or RGB
|
||||
|
||||
#define BUTTON_RGB_NUM 11
|
||||
#define BUTTON_RGB_MAP { 6, 0, 5, 1, 4, 2, 3, 7, 8, 9, 10}
|
||||
|
||||
|
||||
#define TT_RGB_PIN 28
|
||||
#define TT_RGB_ORDER GRB // or RGB
|
||||
|
||||
#define TT_AS5600_ANALOG 26
|
||||
#define TT_AS5600_SCL 27
|
||||
#define TT_AS5600_SDA 26
|
||||
#define TT_AS5600_I2C i2c1
|
||||
|
||||
// Alternative I2C pins
|
||||
//#define TT_AS5600_SCL 21
|
||||
//#define TT_AS5600_SDA 20
|
||||
//#define TT_AS5600_I2C i2c0
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
73
firmware/src/buttons.c
Normal file
73
firmware/src/buttons.c
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Controller Buttons
|
||||
* WHowe <github.com/whowechina>
|
||||
*
|
||||
* A button consists of a switch and an LED
|
||||
*/
|
||||
|
||||
#include "buttons.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "hardware/gpio.h"
|
||||
|
||||
#include "board_defs.h"
|
||||
|
||||
static const uint8_t BUTTON_GPIOS[] = BUTTON_DEF;
|
||||
#define BUTTON_NUM (sizeof(BUTTON_GPIOS))
|
||||
|
||||
static bool sw_val[BUTTON_NUM]; /* true if pressed */
|
||||
static uint64_t sw_freeze_time[BUTTON_NUM];
|
||||
|
||||
#define LIMIT_MAX(a, max, def) { if (a > max) a = def; }
|
||||
|
||||
void button_init()
|
||||
{
|
||||
for (int i = 0; i < BUTTON_NUM; i++) {
|
||||
sw_val[i] = false;
|
||||
sw_freeze_time[i] = 0;
|
||||
int8_t gpio = BUTTON_GPIOS[i];
|
||||
gpio_init(gpio);
|
||||
gpio_set_function(gpio, GPIO_FUNC_SIO);
|
||||
gpio_set_dir(gpio, GPIO_IN);
|
||||
gpio_pull_up(gpio);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t button_num()
|
||||
{
|
||||
return BUTTON_NUM;
|
||||
}
|
||||
|
||||
uint8_t button_gpio(uint8_t id)
|
||||
{
|
||||
return BUTTON_GPIOS[id];
|
||||
}
|
||||
|
||||
/* If a switch flips, it freezes for a while */
|
||||
#define DEBOUNCE_FREEZE_TIME_US 5000
|
||||
uint16_t button_read()
|
||||
{
|
||||
uint64_t now = time_us_64();
|
||||
uint16_t buttons = 0;
|
||||
|
||||
for (int i = BUTTON_NUM - 1; i >= 0; i--) {
|
||||
bool sw_pressed = !gpio_get(BUTTON_GPIOS[i]);
|
||||
|
||||
if (now >= sw_freeze_time[i]) {
|
||||
if (sw_pressed != sw_val[i]) {
|
||||
sw_val[i] = sw_pressed;
|
||||
sw_freeze_time[i] = now + DEBOUNCE_FREEZE_TIME_US;
|
||||
}
|
||||
}
|
||||
|
||||
buttons <<= 1;
|
||||
if (sw_val[i]) {
|
||||
buttons |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
17
firmware/src/buttons.h
Normal file
17
firmware/src/buttons.h
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Controller Buttons
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef BUTTONS_H
|
||||
#define BUTTONS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void button_init();
|
||||
uint8_t button_num();
|
||||
uint8_t button_gpio(uint8_t id);
|
||||
|
||||
uint16_t button_read();
|
||||
|
||||
#endif
|
84
firmware/src/config.c
Normal file
84
firmware/src/config.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Controller Config Data
|
||||
* WHowe <github.com/whowechina>
|
||||
*
|
||||
* Config is a global data structure that stores all the configuration
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "save.h"
|
||||
|
||||
iidx_cfg_t *iidx_cfg;
|
||||
|
||||
static iidx_cfg_t default_cfg = {
|
||||
.key_off = { {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}},
|
||||
.key_on = { {40,40,40}, {40,40,40}, {40,40,40}, {40,40,40}, {40,40,40}, {40,40,40},
|
||||
{40,40,40}, {40,40,40}, {40,40,40}, {40,40,40}, {40,40,40},
|
||||
},
|
||||
.tt_led = {
|
||||
.start = 0,
|
||||
.num = 24,
|
||||
.effect = 0,
|
||||
.param = 0,
|
||||
.mode = 0,
|
||||
},
|
||||
.tt_sensor = {
|
||||
.mode = 2,
|
||||
.deadzone = 1,
|
||||
.ppr = 1,
|
||||
},
|
||||
.effects = {
|
||||
.e1 = 255,
|
||||
.e2 = 128,
|
||||
.e3 = 128,
|
||||
.e4 = 128,
|
||||
},
|
||||
.level = 128,
|
||||
.konami = false,
|
||||
};
|
||||
|
||||
static void config_loaded()
|
||||
{
|
||||
if (iidx_cfg->tt_led.num == 0) {
|
||||
iidx_cfg->tt_led.num = 24;
|
||||
config_changed();
|
||||
}
|
||||
if ((iidx_cfg->tt_led.start > 8) ||
|
||||
(iidx_cfg->tt_led.start + iidx_cfg->tt_led.num > 128)) {
|
||||
iidx_cfg->tt_led.start = 0;
|
||||
iidx_cfg->tt_led.num = 24;
|
||||
config_changed();
|
||||
}
|
||||
if (iidx_cfg->tt_sensor.deadzone > 2) {
|
||||
iidx_cfg->tt_sensor.deadzone = 0;
|
||||
config_changed();
|
||||
}
|
||||
if (iidx_cfg->tt_led.mode > 2) {
|
||||
iidx_cfg->tt_led.mode = 0;
|
||||
config_changed();
|
||||
}
|
||||
if (iidx_cfg->tt_sensor.mode > 3) {
|
||||
iidx_cfg->tt_sensor.mode = 2;
|
||||
config_changed();
|
||||
}
|
||||
if (iidx_cfg->tt_sensor.ppr > 3) {
|
||||
iidx_cfg->tt_sensor.ppr = 1;
|
||||
config_changed();
|
||||
}
|
||||
}
|
||||
|
||||
void config_changed()
|
||||
{
|
||||
save_request(false);
|
||||
}
|
||||
|
||||
void config_factory_reset()
|
||||
{
|
||||
*iidx_cfg = default_cfg;
|
||||
save_request(true);
|
||||
}
|
||||
|
||||
void config_init()
|
||||
{
|
||||
iidx_cfg = (iidx_cfg_t *)save_alloc(sizeof(iidx_cfg), &default_cfg, config_loaded);
|
||||
}
|
49
firmware/src/config.h
Normal file
49
firmware/src/config.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Controller Config
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct __attribute ((packed)) {
|
||||
uint8_t h; // hue;
|
||||
uint8_t s; // saturation;
|
||||
uint8_t v; // value;
|
||||
} hsv_t;
|
||||
|
||||
typedef struct __attribute ((packed)) {
|
||||
hsv_t key_off[11];
|
||||
hsv_t key_on[11];
|
||||
struct {
|
||||
uint8_t start;
|
||||
uint8_t num;
|
||||
uint8_t effect;
|
||||
uint8_t param;
|
||||
uint8_t mode; /* 0: on, 1: reversed, 2: off */
|
||||
} tt_led;
|
||||
struct {
|
||||
uint8_t mode; /* 0: analog, 1: analog reversed, 2: i2c, 3: i2c reversed */
|
||||
uint8_t deadzone; /* only for analog */
|
||||
uint8_t ppr; /* 0: 256, 1: 128, 2: 96, 3: 64, other: 256 */
|
||||
} tt_sensor;
|
||||
struct {
|
||||
uint8_t e1;
|
||||
uint8_t e2;
|
||||
uint8_t e3;
|
||||
uint8_t e4;
|
||||
} effects;
|
||||
uint8_t level; /* led brightness limit */
|
||||
bool konami; /* konami spoof */
|
||||
} iidx_cfg_t;
|
||||
|
||||
extern iidx_cfg_t *iidx_cfg;
|
||||
|
||||
void config_init();
|
||||
void config_changed(); // Notify the config has changed
|
||||
void config_factory_reset(); // Reset the config to factory default
|
||||
|
||||
#endif
|
39
firmware/src/gp2y0e.h
Normal file
39
firmware/src/gp2y0e.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* GP2Y0E Distance measurement sensor
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef GP2Y0E_H
|
||||
#define GP2Y0E_H
|
||||
|
||||
#define GP2Y0E_DEF_ADDR 0x40
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
static inline uint16_t gp2y0e_write(i2c_inst_t *i2c_port, uint8_t addr, uint8_t val)
|
||||
{
|
||||
uint8_t cmd[] = {addr, val};
|
||||
i2c_write_blocking(i2c_port, GP2Y0E_DEF_ADDR, cmd, 2, false);
|
||||
}
|
||||
|
||||
static inline uint8_t gp2y0e_dist(i2c_inst_t *i2c_port)
|
||||
{
|
||||
uint8_t cmd[] = {0x5e};
|
||||
i2c_write_blocking(i2c_port, GP2Y0E_DEF_ADDR, cmd, 1, true);
|
||||
uint8_t data;
|
||||
i2c_read_blocking(i2c_port, GP2Y0E_DEF_ADDR, &data, 1, false);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
static inline uint16_t gp2y0e_dist16(i2c_inst_t *i2c_port)
|
||||
{
|
||||
uint8_t cmd[] = {0x5e};
|
||||
i2c_write_blocking(i2c_port, GP2Y0E_DEF_ADDR, cmd, 1, true);
|
||||
uint8_t data[2];
|
||||
i2c_read_blocking(i2c_port, GP2Y0E_DEF_ADDR, data, 2, false);
|
||||
|
||||
return (data[0] << 4) | data[1];
|
||||
}
|
||||
|
||||
#endif
|
21
firmware/src/i2c_hub.h
Normal file
21
firmware/src/i2c_hub.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* I2C Hub Using PCA9548A
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef I2C_HUB_H
|
||||
#define I2C_HUB_H
|
||||
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
#define I2C_HUB_ADDR 0x70
|
||||
|
||||
static inline void i2c_select(i2c_inst_t *i2c_port, uint8_t chn)
|
||||
{
|
||||
sleep_us(10);
|
||||
i2c_write_blocking(i2c_port, I2C_HUB_ADDR, &chn, 1, false);
|
||||
sleep_us(10);
|
||||
}
|
||||
|
||||
#endif
|
261
firmware/src/main.c
Normal file
261
firmware/src/main.c
Normal file
@ -0,0 +1,261 @@
|
||||
/*
|
||||
* Controller Main
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "pico/multicore.h"
|
||||
#include "pico/bootrom.h"
|
||||
#include "pico/stdio.h"
|
||||
#include "hardware/watchdog.h"
|
||||
#include "hardware/gpio.h"
|
||||
#include "hardware/adc.h"
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
#include "i2c_hub.h"
|
||||
#include "gp2y0e.h"
|
||||
#include "vl6180.h"
|
||||
|
||||
#include "mpr121.h"
|
||||
#include "tusb.h"
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
/* Measure the time of a function call */
|
||||
#define RUN_TIME(func) \
|
||||
{ uint64_t _t = time_us_64(); func; \
|
||||
printf(#func ":%lld\n", time_us_64() - _t); }
|
||||
|
||||
struct {
|
||||
uint16_t buttons;
|
||||
uint8_t joy[6];
|
||||
} hid_report;
|
||||
|
||||
void report_usb_hid()
|
||||
{
|
||||
if (tud_hid_ready()) {
|
||||
hid_report.joy[2] = 0;
|
||||
hid_report.joy[3] = 64;
|
||||
hid_report.joy[4] = 128;
|
||||
hid_report.joy[5] = 192;
|
||||
tud_hid_n_report(0x00, REPORT_ID_JOYSTICK, &hid_report, sizeof(hid_report));
|
||||
}
|
||||
}
|
||||
|
||||
static bool request_core1_pause = false;
|
||||
|
||||
static void pause_core1(bool pause)
|
||||
{
|
||||
request_core1_pause = pause;
|
||||
if (pause) {
|
||||
sleep_ms(5); /* wait for any IO ops to finish */
|
||||
}
|
||||
}
|
||||
|
||||
static void core1_loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// I2C definitions: port and pin numbers
|
||||
#define MPR121_PORT i2c1
|
||||
#define MPR121_SDA 6
|
||||
#define MPR121_SCL 7
|
||||
|
||||
// MPR121 I2C definitions: address and frequency.
|
||||
#define MPR121_ADDR 0x5A
|
||||
#define MPR121_I2C_FREQ 400000
|
||||
|
||||
// Touch and release thresholds.
|
||||
#define MPR121_TOUCH_THRESHOLD 16
|
||||
#define MPR121_RELEASE_THRESHOLD 10
|
||||
|
||||
#define I2C_PORT i2c1
|
||||
#define I2C_I2C_FREQ 200000
|
||||
#define I2C_SDA 26
|
||||
#define I2C_SCL 27
|
||||
|
||||
static void core0_loop_gp2y()
|
||||
{
|
||||
sleep_ms(100);
|
||||
|
||||
i2c_init(I2C_PORT, I2C_I2C_FREQ);
|
||||
gpio_set_function(I2C_SDA, GPIO_FUNC_I2C);
|
||||
gpio_set_function(I2C_SCL, GPIO_FUNC_I2C);
|
||||
gpio_pull_up(I2C_SDA);
|
||||
gpio_pull_up(I2C_SCL);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 4);
|
||||
gp2y0e_write(I2C_PORT, 0xa8, 0x00);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 3);
|
||||
vl6180_init(I2C_PORT);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 5);
|
||||
vl6180_init(I2C_PORT);
|
||||
|
||||
sleep_ms(100);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 3);
|
||||
vl6180_write(I2C_PORT, 0x01b, 0x05);
|
||||
vl6180_write(I2C_PORT, 0x018, 3);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 5);
|
||||
vl6180_write(I2C_PORT, 0x01b, 0x05);
|
||||
vl6180_write(I2C_PORT, 0x018, 3);
|
||||
|
||||
uint8_t od1 = 0, od2 = 0, od3 = 0;
|
||||
while(1) {
|
||||
tud_task();
|
||||
|
||||
hid_report.buttons = 0xcccc;
|
||||
report_usb_hid();
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 4);
|
||||
uint8_t d1 = gp2y0e_dist(I2C_PORT);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 3);
|
||||
uint8_t d2 = vl6180_dist(I2C_PORT, od2);
|
||||
|
||||
i2c_select(I2C_PORT, 1 << 5);
|
||||
uint8_t d3 = vl6180_dist(I2C_PORT, od3);
|
||||
|
||||
if (d1 != od1 || d2 != od2 || d3 != od3) {
|
||||
if ((d1 == 255) && (d2 = 255) && (d3 == 255)) {
|
||||
printf("---\t---\t---\n");
|
||||
} else {
|
||||
printf("%3d\t%3d\t%3d\n", d1, d2, d3);
|
||||
}
|
||||
od1 = d1;
|
||||
od2 = d2;
|
||||
od3 = d3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void core0_loop_adc()
|
||||
{
|
||||
adc_init();
|
||||
adc_gpio_init(28);
|
||||
adc_select_input(2);
|
||||
|
||||
while(1) {
|
||||
tud_task();
|
||||
|
||||
hid_report.buttons = 0xcccc;
|
||||
report_usb_hid();
|
||||
|
||||
uint16_t result = adc_read();
|
||||
printf("%6o\n", result);
|
||||
sleep_ms(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void core0_loop_mpr121()
|
||||
{
|
||||
// Initialise I2C.
|
||||
i2c_init(MPR121_PORT, MPR121_I2C_FREQ);
|
||||
gpio_set_function(MPR121_SDA, GPIO_FUNC_I2C);
|
||||
gpio_set_function(MPR121_SCL, GPIO_FUNC_I2C);
|
||||
gpio_pull_up(MPR121_SDA);
|
||||
gpio_pull_up(MPR121_SCL);
|
||||
|
||||
struct mpr121_sensor mpr121[3];
|
||||
for (int m = 0; m < 3; m++) {
|
||||
mpr121_init(MPR121_PORT, MPR121_ADDR + m, mpr121 + m);
|
||||
mpr121_set_thresholds(MPR121_TOUCH_THRESHOLD,
|
||||
MPR121_RELEASE_THRESHOLD, mpr121 + m);
|
||||
// Enable only one touch sensor (electrode 0).
|
||||
mpr121_enable_electrodes(12, mpr121 + m);
|
||||
}
|
||||
|
||||
int16_t baseline[34] = {0};
|
||||
|
||||
uint32_t counter[34] = {0};
|
||||
for (int c = 0; c < 2000; c++) {
|
||||
tud_task();
|
||||
hid_report.buttons = 0xcccc;
|
||||
report_usb_hid();
|
||||
for (int i = 0; i < 34; i++) {
|
||||
int16_t touch_data;
|
||||
mpr121_baseline_value(i % 12, &touch_data, mpr121 + i / 12);
|
||||
counter[i] += touch_data;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 34; i++) {
|
||||
baseline[i] = counter[i] / 2000;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
tud_task();
|
||||
|
||||
hid_report.buttons = 0xcccc;
|
||||
report_usb_hid();
|
||||
|
||||
for (int i = 0; i < 34; i++) {
|
||||
int16_t touch_data;
|
||||
mpr121_baseline_value(i % 12, &touch_data, mpr121 + i / 12);
|
||||
int16_t display_data = (baseline[i] - touch_data) / 8;
|
||||
if (display_data) {
|
||||
printf("%2d", display_data);
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("%c", i % 12 == 11 ? ':' : ' ');
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void core0_loop()
|
||||
{
|
||||
core0_loop_gp2y();
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
board_init();
|
||||
tusb_init();
|
||||
|
||||
stdio_init_all();
|
||||
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
sleep_ms(1000);
|
||||
|
||||
init();
|
||||
//multicore_launch_core1(core1_loop);
|
||||
|
||||
core0_loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Invoked when received GET_REPORT control request
|
||||
// Application must fill buffer report's content and return its length.
|
||||
// Return zero will cause the stack to STALL request
|
||||
uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id,
|
||||
hid_report_type_t report_type, uint8_t *buffer,
|
||||
uint16_t reqlen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Invoked when received SET_REPORT control request or
|
||||
// received data on OUT endpoint ( Report ID = 0, Type = 0 )
|
||||
void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id,
|
||||
hid_report_type_t report_type, uint8_t const *buffer,
|
||||
uint16_t bufsize)
|
||||
{
|
||||
if ((report_id == REPORT_ID_LIGHTS) &&
|
||||
(report_type == HID_REPORT_TYPE_OUTPUT)) {
|
||||
if (bufsize >= 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
311
firmware/src/rgb.c
Normal file
311
firmware/src/rgb.c
Normal file
@ -0,0 +1,311 @@
|
||||
/*
|
||||
* RGB LED (WS2812) Strip control
|
||||
* WHowe <github.com/whowechina>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rgb.h"
|
||||
|
||||
#include "buttons.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "hardware/pio.h"
|
||||
#include "hardware/timer.h"
|
||||
|
||||
#include "ws2812.pio.h"
|
||||
|
||||
#include "board_defs.h"
|
||||
#include "config.h"
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
static const uint8_t button_rgb_map[BUTTON_RGB_NUM] = BUTTON_RGB_MAP;
|
||||
|
||||
static void trap() {}
|
||||
static tt_effect_t effects[10] = { {trap, trap, trap, 0} };
|
||||
static size_t effect_num = 0;
|
||||
static unsigned current_effect = 0;
|
||||
|
||||
#define _MAP_LED(x) _MAKE_MAPPER(x)
|
||||
#define _MAKE_MAPPER(x) MAP_LED_##x
|
||||
#define MAP_LED_RGB { c1 = r; c2 = g; c3 = b; }
|
||||
#define MAP_LED_GRB { c1 = g; c2 = r; c3 = b; }
|
||||
|
||||
#define REMAP_BUTTON_RGB _MAP_LED(BUTTON_RGB_ORDER)
|
||||
#define REMAP_TT_RGB _MAP_LED(TT_RGB_ORDER)
|
||||
|
||||
static inline uint32_t _rgb32(uint32_t c1, uint32_t c2, uint32_t c3, bool gamma_fix)
|
||||
{
|
||||
c1 = c1 * iidx_cfg->level / 255;
|
||||
c2 = c2 * iidx_cfg->level / 255;
|
||||
c3 = c3 * iidx_cfg->level / 255;
|
||||
|
||||
if (gamma_fix) {
|
||||
c1 = ((c1 + 1) * (c1 + 1) - 1) >> 8;
|
||||
c2 = ((c2 + 1) * (c2 + 1) - 1) >> 8;
|
||||
c3 = ((c3 + 1) * (c3 + 1) - 1) >> 8;
|
||||
}
|
||||
|
||||
return (c1 << 16) | (c2 << 8) | (c3 << 0);
|
||||
}
|
||||
|
||||
uint32_t button_rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix)
|
||||
{
|
||||
#if BUTTON_RGB_ORDER == GRB
|
||||
return _rgb32(g, r, b, gamma_fix);
|
||||
#else
|
||||
return _rgb32(r, g, b, gamma_fix);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t tt_rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix)
|
||||
{
|
||||
#if TT_RGB_ORDER == GRB
|
||||
return _rgb32(g, r, b, gamma_fix);
|
||||
#else
|
||||
return _rgb32(r, g, b, gamma_fix);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t rgb_button_num()
|
||||
{
|
||||
return BUTTON_RGB_NUM;
|
||||
}
|
||||
|
||||
uint8_t button_lights[BUTTON_RGB_NUM];
|
||||
uint32_t tt_led_buf[128] = {0};
|
||||
uint32_t tt_led_angle = 0;
|
||||
|
||||
static uint32_t button_led_buf[BUTTON_RGB_NUM] = {0};
|
||||
|
||||
void set_effect(uint32_t index)
|
||||
{
|
||||
if (index < effect_num) {
|
||||
current_effect = index;
|
||||
effects[current_effect].init(effects[current_effect].context);
|
||||
} else {
|
||||
current_effect = effect_num;
|
||||
}
|
||||
}
|
||||
|
||||
void drive_led()
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(button_led_buf); i++) {
|
||||
pio_sm_put_blocking(pio0, 0, button_led_buf[i] << 8u);
|
||||
}
|
||||
|
||||
if (iidx_cfg->tt_led.mode == 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < iidx_cfg->tt_led.start; i++) {
|
||||
pio_sm_put_blocking(pio1, 0, 0);
|
||||
}
|
||||
for (int i = 0; i < TT_LED_NUM; i++) {
|
||||
bool reversed = iidx_cfg->tt_led.mode & 0x01;
|
||||
uint8_t id = reversed ? TT_LED_NUM - i - 1 : i;
|
||||
pio_sm_put_blocking(pio1, 0, tt_led_buf[id] << 8u);
|
||||
}
|
||||
for (int i = 0; i < 8; i++) { // a few more to wipe out the last led
|
||||
pio_sm_put_blocking(pio1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t rgb32_from_hsv(hsv_t hsv)
|
||||
{
|
||||
uint32_t region, remainder, p, q, t;
|
||||
|
||||
if (hsv.s == 0) {
|
||||
return hsv.v << 16 | hsv.v << 8 | hsv.v;
|
||||
}
|
||||
|
||||
region = hsv.h / 43;
|
||||
remainder = (hsv.h % 43) * 6;
|
||||
|
||||
p = (hsv.v * (255 - hsv.s)) >> 8;
|
||||
q = (hsv.v * (255 - ((hsv.s * remainder) >> 8))) >> 8;
|
||||
t = (hsv.v * (255 - ((hsv.s * (255 - remainder)) >> 8))) >> 8;
|
||||
|
||||
switch (region) {
|
||||
case 0:
|
||||
return hsv.v << 16 | t << 8 | p;
|
||||
case 1:
|
||||
return q << 16 | hsv.v << 8 | p;
|
||||
case 2:
|
||||
return p << 16 | hsv.v << 8 | t;
|
||||
case 3:
|
||||
return p << 16 | q << 8 | hsv.v;
|
||||
case 4:
|
||||
return t << 16 | p << 8 | hsv.v;
|
||||
default:
|
||||
return hsv.v << 16 | p << 8 | q;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t button_hsv(hsv_t hsv)
|
||||
{
|
||||
uint32_t rgb = rgb32_from_hsv(hsv);
|
||||
uint32_t r = (rgb >> 16) & 0xff;
|
||||
uint32_t g = (rgb >> 8) & 0xff;
|
||||
uint32_t b = (rgb >> 0) & 0xff;
|
||||
#if BUTTON_RGB_ORDER == GRB
|
||||
return _rgb32(g, r, b, false);
|
||||
#else
|
||||
return _rgb32(r, g, b, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t tt_hsv(hsv_t hsv)
|
||||
{
|
||||
uint32_t rgb = rgb32_from_hsv(hsv);
|
||||
uint32_t r = (rgb >> 16) & 0xff;
|
||||
uint32_t g = (rgb >> 8) & 0xff;
|
||||
uint32_t b = (rgb >> 0) & 0xff;
|
||||
#if TT_RGB_ORDER == GRB
|
||||
return _rgb32(g, r, b, false);
|
||||
#else
|
||||
return _rgb32(r, g, b, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define HID_EXPIRE_DURATION 1000000ULL
|
||||
static uint64_t hid_expire_time = 0;
|
||||
|
||||
static void button_lights_update()
|
||||
{
|
||||
for (int i = 0; i < BUTTON_RGB_NUM; i++) {
|
||||
int led = button_rgb_map[i];
|
||||
if (button_lights[i] > 0) {
|
||||
button_led_buf[led] = button_hsv(iidx_cfg->key_on[i]);
|
||||
} else {
|
||||
button_led_buf[led] = button_hsv(iidx_cfg->key_off[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_set_angle(uint32_t angle)
|
||||
{
|
||||
tt_led_angle = angle;
|
||||
effects[current_effect].set_angle(angle);
|
||||
}
|
||||
|
||||
void rgb_set_button_light(uint16_t buttons)
|
||||
{
|
||||
if (time_us_64() < hid_expire_time) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < BUTTON_RGB_NUM; i++) {
|
||||
uint16_t flag = 1 << i;
|
||||
button_lights[i] = (buttons & flag) > 0 ? 0xff : 0;
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_set_hid_light(uint8_t const *lights, uint8_t num)
|
||||
{
|
||||
memcpy(button_lights, lights, num);
|
||||
hid_expire_time = time_us_64() + HID_EXPIRE_DURATION;
|
||||
}
|
||||
|
||||
static void effect_update()
|
||||
{
|
||||
effects[current_effect].update(effects[current_effect].context);
|
||||
}
|
||||
|
||||
#define FORCE_EXPIRE_DURATION 100000ULL
|
||||
static uint64_t force_expire_time = 0;
|
||||
uint32_t *force_buttons = NULL;
|
||||
uint32_t *force_tt = NULL;
|
||||
|
||||
void force_update()
|
||||
{
|
||||
for (int i = 0; i < BUTTON_RGB_NUM; i++) {
|
||||
int led = button_rgb_map[i];
|
||||
button_led_buf[led] = force_buttons[i];
|
||||
}
|
||||
|
||||
memcpy(tt_led_buf, force_tt, TT_LED_NUM * sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void rgb_force_display(uint32_t *buttons, uint32_t *tt)
|
||||
{
|
||||
force_buttons = buttons;
|
||||
force_tt = tt;
|
||||
force_expire_time = time_us_64() + FORCE_EXPIRE_DURATION;
|
||||
}
|
||||
|
||||
static void wipe_out_tt_led()
|
||||
{
|
||||
sleep_ms(5);
|
||||
for (int i = 0; i < 128; i++) {
|
||||
pio_sm_put_blocking(pio1, 0, 0);
|
||||
}
|
||||
sleep_ms(5);
|
||||
}
|
||||
|
||||
static uint pio1_offset;
|
||||
static bool pio1_running = false;
|
||||
|
||||
static void pio1_run()
|
||||
{
|
||||
gpio_set_drive_strength(TT_RGB_PIN, GPIO_DRIVE_STRENGTH_8MA);
|
||||
ws2812_program_init(pio1, 0, pio1_offset, TT_RGB_PIN, 800000, false);
|
||||
}
|
||||
|
||||
static void pio1_stop()
|
||||
{
|
||||
wipe_out_tt_led();
|
||||
pio_sm_set_enabled(pio1, 0, false);
|
||||
|
||||
gpio_set_function(TT_RGB_PIN, GPIO_FUNC_SIO);
|
||||
gpio_set_dir(TT_RGB_PIN, GPIO_IN);
|
||||
gpio_disable_pulls(TT_RGB_PIN);
|
||||
}
|
||||
|
||||
void rgb_init()
|
||||
{
|
||||
uint pio0_offset = pio_add_program(pio0, &ws2812_program);
|
||||
pio1_offset = pio_add_program(pio1, &ws2812_program);
|
||||
|
||||
gpio_set_drive_strength(BUTTON_RGB_PIN, GPIO_DRIVE_STRENGTH_2MA);
|
||||
ws2812_program_init(pio0, 0, pio0_offset, BUTTON_RGB_PIN, 800000, false);
|
||||
|
||||
/* We don't start the tt LED program yet */
|
||||
}
|
||||
|
||||
static void follow_mode_change()
|
||||
{
|
||||
bool pio1_should_run = (iidx_cfg->tt_led.mode != 2);
|
||||
if (pio1_should_run == pio1_running) {
|
||||
return;
|
||||
}
|
||||
pio1_running = pio1_should_run;
|
||||
if (pio1_should_run) {
|
||||
pio1_run();
|
||||
} else {
|
||||
pio1_stop();
|
||||
}
|
||||
}
|
||||
|
||||
void rgb_update()
|
||||
{
|
||||
follow_mode_change();
|
||||
set_effect(iidx_cfg->tt_led.effect);
|
||||
if (time_us_64() > force_expire_time) {
|
||||
effect_update();
|
||||
button_lights_update();
|
||||
} else {
|
||||
force_update();
|
||||
}
|
||||
drive_led();
|
||||
}
|
||||
|
||||
void rgb_reg_tt_effect(tt_effect_t effect)
|
||||
{
|
||||
effects[effect_num] = effect;
|
||||
effect_num++;
|
||||
effects[effect_num] = (tt_effect_t) { trap, trap, trap, 0 };
|
||||
}
|
49
firmware/src/rgb.h
Normal file
49
firmware/src/rgb.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* RGB LED (WS2812) Strip control
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef RGB_H
|
||||
#define RGB_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
void rgb_init();
|
||||
void rgb_set_hardware(uint16_t tt_start, uint16_t tt_num, bool tt_reversed);
|
||||
|
||||
uint8_t rgb_button_num();
|
||||
void rgb_update();
|
||||
|
||||
void rgb_set_angle(uint32_t angle);
|
||||
void rgb_set_level(uint8_t level);
|
||||
|
||||
void rgb_set_button_light(uint16_t buttons);
|
||||
void rgb_set_hid_light(uint8_t const *lights, uint8_t num);
|
||||
|
||||
void rgb_force_display(uint32_t *keyboard, uint32_t *tt);
|
||||
|
||||
typedef struct {
|
||||
void (*init)(uint32_t context);
|
||||
void (*set_angle)(uint32_t angle);
|
||||
void (*update)(uint32_t context);
|
||||
uint32_t context;
|
||||
} tt_effect_t;
|
||||
|
||||
void rgb_reg_tt_effect(tt_effect_t effect);
|
||||
|
||||
extern uint32_t tt_led_buf[];
|
||||
#define TT_LED_NUM (iidx_cfg->tt_led.num)
|
||||
|
||||
/* These global variables meant to be accessed by effect codes */
|
||||
extern uint32_t tt_led_angle;
|
||||
|
||||
|
||||
uint32_t button_rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix);
|
||||
uint32_t tt_rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix);
|
||||
uint32_t button_hsv(hsv_t hsv);
|
||||
uint32_t tt_hsv(hsv_t hsv);
|
||||
|
||||
#endif
|
152
firmware/src/save.c
Normal file
152
firmware/src/save.c
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Controller Save Save and Load
|
||||
* WHowe <github.com/whowechina>
|
||||
*
|
||||
* Save is stored in last sector of flash
|
||||
*/
|
||||
|
||||
#include "save.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <memory.h>
|
||||
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "pico/bootrom.h"
|
||||
#include "pico/stdio.h"
|
||||
|
||||
#include "hardware/flash.h"
|
||||
#include "hardware/sync.h"
|
||||
|
||||
static struct {
|
||||
size_t size;
|
||||
size_t offset;
|
||||
void (*after_load)();
|
||||
} modules[8] = {0};
|
||||
static int module_num = 0;
|
||||
|
||||
#define SAVE_PAGE_MAGIC 0x13424321
|
||||
#define SAVE_SECTOR_OFFSET (PICO_FLASH_SIZE_BYTES - FLASH_SECTOR_SIZE)
|
||||
|
||||
typedef struct __attribute ((packed)) {
|
||||
uint32_t magic;
|
||||
uint8_t data[FLASH_PAGE_SIZE - 4];
|
||||
} page_t;
|
||||
|
||||
static page_t old_data = {0};
|
||||
static page_t new_data = {0};
|
||||
static page_t default_data = {0};
|
||||
static int data_page = -1;
|
||||
|
||||
static bool requesting_save = false;
|
||||
static uint64_t requesting_time = 0;
|
||||
|
||||
static io_locker_func io_lock;
|
||||
|
||||
static void save_program()
|
||||
{
|
||||
old_data = new_data;
|
||||
|
||||
data_page = (data_page + 1) % (FLASH_SECTOR_SIZE / FLASH_PAGE_SIZE);
|
||||
printf("Program Flash %d %8lx\n", data_page, old_data.magic);
|
||||
io_lock(true);
|
||||
uint32_t ints = save_and_disable_interrupts();
|
||||
if (data_page == 0) {
|
||||
flash_range_erase(SAVE_SECTOR_OFFSET, FLASH_SECTOR_SIZE);
|
||||
}
|
||||
flash_range_program(SAVE_SECTOR_OFFSET + data_page * FLASH_PAGE_SIZE,
|
||||
(uint8_t *)&old_data, FLASH_PAGE_SIZE);
|
||||
restore_interrupts(ints);
|
||||
io_lock(false);
|
||||
}
|
||||
|
||||
static void load_default()
|
||||
{
|
||||
printf("Load Default\n");
|
||||
new_data = default_data;
|
||||
new_data.magic = SAVE_PAGE_MAGIC;
|
||||
}
|
||||
|
||||
static const page_t *get_page(int id)
|
||||
{
|
||||
int addr = XIP_BASE + SAVE_SECTOR_OFFSET;
|
||||
return (page_t *)(addr + FLASH_PAGE_SIZE * id);
|
||||
}
|
||||
|
||||
static void save_load()
|
||||
{
|
||||
for (int i = 0; i < FLASH_SECTOR_SIZE / FLASH_PAGE_SIZE; i++) {
|
||||
if (get_page(i)->magic != SAVE_PAGE_MAGIC) {
|
||||
break;
|
||||
}
|
||||
data_page = i;
|
||||
}
|
||||
|
||||
if (data_page < 0) {
|
||||
load_default();
|
||||
save_request(false);
|
||||
return;
|
||||
}
|
||||
|
||||
old_data = *get_page(data_page);
|
||||
new_data = old_data;
|
||||
printf("Page Loaded %d %8lx\n", data_page, new_data.magic);
|
||||
}
|
||||
|
||||
static void save_loaded()
|
||||
{
|
||||
for (int i = 0; i < module_num; i++) {
|
||||
modules[i].after_load();
|
||||
}
|
||||
}
|
||||
|
||||
void save_init(io_locker_func locker)
|
||||
{
|
||||
io_lock = locker;
|
||||
save_load();
|
||||
save_loop();
|
||||
save_loaded();
|
||||
}
|
||||
|
||||
void save_loop()
|
||||
{
|
||||
if (requesting_save && (time_us_64() - requesting_time > 1000000)) {
|
||||
requesting_save = false;
|
||||
printf("Time to save.\n");
|
||||
/* only when data is actually changed */
|
||||
for (int i = 0; i < sizeof(old_data); i++) {
|
||||
if (((uint8_t *)&old_data)[i] != ((uint8_t *)&new_data)[i]) {
|
||||
save_program();
|
||||
return;
|
||||
}
|
||||
}
|
||||
printf("No change.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void *save_alloc(size_t size, void *def, void (*after_load)())
|
||||
{
|
||||
modules[module_num].size = size;
|
||||
size_t offset = module_num > 0 ? modules[module_num - 1].offset + size : 0;
|
||||
modules[module_num].offset = offset;
|
||||
modules[module_num].after_load = after_load;
|
||||
module_num++;
|
||||
memcpy(default_data.data + offset, def, size); // backup the default
|
||||
return new_data.data + offset;
|
||||
}
|
||||
|
||||
void save_request(bool immediately)
|
||||
{
|
||||
if (!requesting_save) {
|
||||
printf("Save marked.\n");
|
||||
requesting_save = true;
|
||||
new_data.magic = SAVE_PAGE_MAGIC;
|
||||
requesting_time = time_us_64();
|
||||
}
|
||||
if (immediately) {
|
||||
requesting_time = 0;
|
||||
save_loop();
|
||||
}
|
||||
}
|
21
firmware/src/save.h
Normal file
21
firmware/src/save.h
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Controller Flash Save and Load
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef SAVE_H
|
||||
#define SAVE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* It's safer to lock other I/O ops during saving, so we need a locker */
|
||||
typedef void (*io_locker_func)(bool pause);
|
||||
void save_init(io_locker_func locker);
|
||||
|
||||
void save_loop();
|
||||
|
||||
void *save_alloc(size_t size, void *def, void (*after_load)());
|
||||
void save_request(bool immediately);
|
||||
|
||||
#endif
|
725
firmware/src/setup.c
Normal file
725
firmware/src/setup.c
Normal file
@ -0,0 +1,725 @@
|
||||
/*
|
||||
* Controller Setup Menu
|
||||
* WHowe <github.com/whowechina>
|
||||
*
|
||||
* Setup is a mode, so one can change settings live
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "pico/bootrom.h"
|
||||
|
||||
#include "rgb.h"
|
||||
#include "config.h"
|
||||
|
||||
static iidx_cfg_t cfg_save;
|
||||
|
||||
static uint64_t setup_tick_ms = 0;
|
||||
#define CONCAT(a, b) a ## b
|
||||
#define TVAR(line) CONCAT(a, line)
|
||||
#define RUN_EVERY_N_MS(a, ms) { static uint64_t TVAR(__LINE__) = 0; \
|
||||
if (setup_tick_ms - TVAR(__LINE__) >= ms) { a; TVAR(__LINE__) = setup_tick_ms; } }
|
||||
static uint32_t blink_fast = 0xffffffff;
|
||||
static uint32_t blink_slow = 0xffffffff;
|
||||
|
||||
uint32_t setup_led_tt[128];
|
||||
uint32_t setup_led_button[BUTTON_RGB_NUM];
|
||||
|
||||
typedef enum {
|
||||
MODE_NONE,
|
||||
MODE_TURNTABLE,
|
||||
MODE_ANALOG,
|
||||
MODE_LEVEL,
|
||||
MODE_TT_THEME,
|
||||
MODE_KEY_THEME,
|
||||
MODE_KEY_OFF,
|
||||
MODE_KEY_ON,
|
||||
} setup_mode_t;
|
||||
static setup_mode_t current_mode = MODE_NONE;
|
||||
|
||||
static struct {
|
||||
uint16_t last_keys;
|
||||
uint16_t keys;
|
||||
uint16_t just_pressed;
|
||||
uint16_t just_released;
|
||||
|
||||
int16_t last_angle;
|
||||
int16_t angle;
|
||||
int16_t rotate;
|
||||
} input = { 0 };
|
||||
|
||||
#define KEY_1 0x0001
|
||||
#define KEY_2 0x0002
|
||||
#define KEY_3 0x0004
|
||||
#define KEY_4 0x0008
|
||||
#define KEY_5 0x0010
|
||||
#define KEY_6 0x0020
|
||||
#define KEY_7 0x0040
|
||||
#define E1 0x0080
|
||||
#define E2 0x0100
|
||||
#define E3 0x0200
|
||||
#define E4 0x0400
|
||||
#define AUX_NO 0x0800
|
||||
#define AUX_YES 0x1000
|
||||
|
||||
#define LED_KEY_1 0
|
||||
#define LED_KEY_2 1
|
||||
#define LED_KEY_3 2
|
||||
#define LED_KEY_4 3
|
||||
#define LED_KEY_5 4
|
||||
#define LED_KEY_6 5
|
||||
#define LED_KEY_7 6
|
||||
#define LED_E1 7
|
||||
#define LED_E2 8
|
||||
#define LED_E3 9
|
||||
#define LED_E4 10
|
||||
|
||||
#define PRESSED_ALL(k) ((input.keys & (k)) == (k))
|
||||
#define PRESSED_ANY(k) (input.keys & (k))
|
||||
#define JUST_PRESSED(k) (input.just_pressed & (k))
|
||||
#define JUST_RELEASED(k) (input.just_released & (k))
|
||||
|
||||
#define RED button_rgb32(99, 0, 0, false)
|
||||
#define GREEN button_rgb32(0, 99, 0, false)
|
||||
#define CYAN button_rgb32(0, 40, 99, false)
|
||||
#define YELLOW button_rgb32(99, 99, 0, false)
|
||||
#define SILVER button_rgb32(60, 60, 60, false)
|
||||
|
||||
#define TT_RED tt_rgb32(99, 0, 0, false)
|
||||
#define TT_GREEN tt_rgb32(0, 99, 0, false)
|
||||
#define TT_CYAN tt_rgb32(0, 40, 99, false)
|
||||
#define TT_YELLOW tt_rgb32(99, 99, 0, false)
|
||||
#define TT_SILVER tt_rgb32(60, 60, 60, false)
|
||||
|
||||
typedef void (*mode_func)();
|
||||
|
||||
static void join_mode(setup_mode_t new_mode);
|
||||
static void quit_mode(bool apply);
|
||||
|
||||
static void nop()
|
||||
{
|
||||
}
|
||||
|
||||
static void check_exit()
|
||||
{
|
||||
if (JUST_PRESSED(AUX_YES)) {
|
||||
quit_mode(true);
|
||||
} else if (JUST_PRESSED(AUX_NO)) {
|
||||
quit_mode(false);
|
||||
}
|
||||
}
|
||||
|
||||
static int16_t input_delta(int16_t start_angle)
|
||||
{
|
||||
int16_t delta = input.angle - start_angle;
|
||||
if (delta > 128) {
|
||||
delta -= 256;
|
||||
}
|
||||
if (delta < -128) {
|
||||
delta += 256;
|
||||
}
|
||||
return delta;
|
||||
}
|
||||
|
||||
static setup_mode_t key_to_mode[11] = {
|
||||
MODE_KEY_THEME, MODE_TT_THEME, MODE_KEY_ON, MODE_KEY_OFF,
|
||||
MODE_NONE, MODE_NONE, MODE_NONE,
|
||||
MODE_ANALOG, MODE_ANALOG, MODE_ANALOG, MODE_ANALOG,
|
||||
};
|
||||
|
||||
static struct {
|
||||
bool escaped;
|
||||
uint64_t escape_time;
|
||||
uint16_t start_angle;
|
||||
} none_ctx = { 0 };
|
||||
|
||||
static void none_rotate()
|
||||
{
|
||||
if (!none_ctx.escaped) {
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t delta = input_delta(none_ctx.start_angle);
|
||||
if (abs(delta) > 10) {
|
||||
join_mode(MODE_LEVEL);
|
||||
none_ctx.escaped = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void none_loop()
|
||||
{
|
||||
if (PRESSED_ALL(AUX_YES | AUX_NO)) {
|
||||
if (!none_ctx.escaped) {
|
||||
none_ctx.escaped = true;
|
||||
none_ctx.escape_time = time_us_64();
|
||||
none_ctx.start_angle = input.angle;
|
||||
}
|
||||
} else {
|
||||
none_ctx.escaped = false;
|
||||
}
|
||||
|
||||
if (!none_ctx.escaped) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (PRESSED_ANY(KEY_1 << i)) {
|
||||
none_ctx.escaped = false;
|
||||
join_mode(key_to_mode[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (time_us_64() - none_ctx.escape_time > 5000000) {
|
||||
none_ctx.escaped = false;
|
||||
join_mode(MODE_TURNTABLE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
uint8_t adjust_led; /* 0: nothing, 1: adjust start, 2: adjust stop */
|
||||
int16_t start_angle;
|
||||
} tt_ctx;
|
||||
|
||||
static void tt_enter()
|
||||
{
|
||||
tt_ctx.start_angle = input.angle;
|
||||
}
|
||||
|
||||
static void tt_key_change()
|
||||
{
|
||||
if (JUST_PRESSED(E1)) {
|
||||
tt_ctx.adjust_led = (tt_ctx.adjust_led == 1) ? 0 : 1;
|
||||
tt_ctx.start_angle = input.angle;
|
||||
} else if (JUST_PRESSED(E2)) {
|
||||
tt_ctx.adjust_led = (tt_ctx.adjust_led == 2) ? 0 : 2;
|
||||
tt_ctx.start_angle = input.angle;
|
||||
} else if (JUST_PRESSED(E3)) {
|
||||
iidx_cfg->tt_led.mode = (iidx_cfg->tt_led.mode + 1) % 3;
|
||||
} else if (JUST_PRESSED(E4)) {
|
||||
iidx_cfg->tt_sensor.mode = (iidx_cfg->tt_sensor.mode + 1) % 4;
|
||||
} else if (JUST_PRESSED(KEY_2)) {
|
||||
iidx_cfg->tt_sensor.deadzone = 0;
|
||||
} else if (JUST_PRESSED(KEY_4)) {
|
||||
iidx_cfg->tt_sensor.deadzone = 1;
|
||||
} else if (JUST_PRESSED(KEY_6)) {
|
||||
iidx_cfg->tt_sensor.deadzone = 2;
|
||||
} else if (JUST_PRESSED(KEY_1)) {
|
||||
iidx_cfg->tt_sensor.ppr = 0;
|
||||
} else if (JUST_PRESSED(KEY_3)) {
|
||||
iidx_cfg->tt_sensor.ppr = 1;
|
||||
} else if (JUST_PRESSED(KEY_5)) {
|
||||
iidx_cfg->tt_sensor.ppr = 2;
|
||||
} else if (JUST_PRESSED(KEY_7)) {
|
||||
iidx_cfg->tt_sensor.ppr = 3;
|
||||
}
|
||||
|
||||
check_exit();
|
||||
}
|
||||
|
||||
static void tt_rotate()
|
||||
{
|
||||
int16_t delta = input_delta(tt_ctx.start_angle);
|
||||
if (abs(delta) > 8) {
|
||||
tt_ctx.start_angle = input.angle;
|
||||
|
||||
#define LED_START iidx_cfg->tt_led.start
|
||||
#define LED_NUM iidx_cfg->tt_led.num
|
||||
|
||||
if (tt_ctx.adjust_led == 1) {
|
||||
if ((delta > 0) & (LED_START < 8)) {
|
||||
LED_START++;
|
||||
if (LED_NUM > 1) {
|
||||
LED_NUM--;
|
||||
}
|
||||
} else if ((delta < 0) & (LED_START > 0)) {
|
||||
LED_START--;
|
||||
LED_NUM++;
|
||||
}
|
||||
} else if (tt_ctx.adjust_led == 2) {
|
||||
if ((delta > 0) & (LED_NUM + LED_START < 128)) {
|
||||
LED_NUM++;
|
||||
} else if ((delta < 0) & (LED_NUM > 1)) { // at least 1 led
|
||||
LED_NUM--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void tt_loop()
|
||||
{
|
||||
for (int i = 1; i < iidx_cfg->tt_led.num - 1; i++) {
|
||||
setup_led_tt[i] = tt_rgb32(10, 10, 10, false);
|
||||
}
|
||||
|
||||
bool led_reversed = (iidx_cfg->tt_led.mode == 1);
|
||||
int head = led_reversed ? TT_LED_NUM - 1 : 0;
|
||||
int tail = led_reversed ? 0 : TT_LED_NUM - 1;
|
||||
|
||||
setup_led_tt[head] = tt_rgb32(0xa0, 0, 0, false);
|
||||
setup_led_tt[tail] = tt_rgb32(0, 0xa0, 0, false);
|
||||
setup_led_button[LED_E2] = button_rgb32(0, 10, 0, false);
|
||||
setup_led_button[LED_E1] = button_rgb32(10, 0, 0, false);
|
||||
|
||||
if (tt_ctx.adjust_led == 1) {
|
||||
setup_led_tt[head] &= blink_fast;
|
||||
setup_led_button[LED_E1] = RED & blink_fast;
|
||||
} else if (tt_ctx.adjust_led == 2) {
|
||||
setup_led_tt[tail] &= blink_fast;
|
||||
setup_led_button[LED_E2] = GREEN & blink_fast;
|
||||
}
|
||||
|
||||
switch (iidx_cfg->tt_led.mode) {
|
||||
case 0:
|
||||
setup_led_button[LED_E3] = GREEN;
|
||||
break;
|
||||
case 1:
|
||||
setup_led_button[LED_E3] = RED;
|
||||
break;
|
||||
default:
|
||||
setup_led_button[LED_E3] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (iidx_cfg->tt_sensor.mode) {
|
||||
case 0:
|
||||
setup_led_button[LED_E4] = GREEN;
|
||||
break;
|
||||
case 1:
|
||||
setup_led_button[LED_E4] = RED;
|
||||
break;
|
||||
case 2:
|
||||
setup_led_button[LED_E4] = CYAN;
|
||||
break;
|
||||
default:
|
||||
setup_led_button[LED_E4] = YELLOW;
|
||||
break;
|
||||
}
|
||||
setup_led_button[LED_KEY_2] = iidx_cfg->tt_sensor.deadzone == 0 ? SILVER : 0;
|
||||
setup_led_button[LED_KEY_4] = iidx_cfg->tt_sensor.deadzone == 1 ? SILVER : 0;
|
||||
setup_led_button[LED_KEY_6] = iidx_cfg->tt_sensor.deadzone == 2 ? SILVER : 0;
|
||||
setup_led_button[LED_KEY_1] = iidx_cfg->tt_sensor.ppr == 0 ? SILVER : 0;
|
||||
setup_led_button[LED_KEY_3] = iidx_cfg->tt_sensor.ppr == 1 ? SILVER : 0;
|
||||
setup_led_button[LED_KEY_5] = iidx_cfg->tt_sensor.ppr == 2 ? SILVER : 0;
|
||||
setup_led_button[LED_KEY_7] = iidx_cfg->tt_sensor.ppr == 3 ? SILVER : 0;
|
||||
}
|
||||
|
||||
static void level_rotate()
|
||||
{
|
||||
int16_t new_value = iidx_cfg->level;
|
||||
new_value += input.rotate;
|
||||
if (new_value < 0) {
|
||||
new_value = 0;
|
||||
} else if (new_value > 255) {
|
||||
new_value = 255;
|
||||
}
|
||||
iidx_cfg->level = new_value;
|
||||
printf("Level: %d\n", iidx_cfg->level);
|
||||
}
|
||||
|
||||
static void level_key_change()
|
||||
{
|
||||
if (JUST_PRESSED(KEY_1)) {
|
||||
iidx_cfg->level = 0;
|
||||
} else if (JUST_PRESSED(KEY_2)) {
|
||||
iidx_cfg->level = 20;
|
||||
} else if (JUST_PRESSED(KEY_3)) {
|
||||
iidx_cfg->level = 50;
|
||||
} else if (JUST_PRESSED(KEY_4)) {
|
||||
iidx_cfg->level = 85;
|
||||
} else if (JUST_PRESSED(KEY_5)) {
|
||||
iidx_cfg->level = 130;
|
||||
} else if (JUST_PRESSED(KEY_6)) {
|
||||
iidx_cfg->level = 190;
|
||||
} else if (JUST_PRESSED(KEY_7)) {
|
||||
iidx_cfg->level = 255;
|
||||
}
|
||||
|
||||
check_exit();
|
||||
}
|
||||
|
||||
static void level_loop()
|
||||
{
|
||||
for (int i = 0; i < 7; i++) {
|
||||
hsv_t key_color = {i * 255 / 7, 255, 255 };
|
||||
setup_led_button[i] = button_hsv(key_color);
|
||||
}
|
||||
|
||||
uint16_t pos = iidx_cfg->level * iidx_cfg->tt_led.num / 256;
|
||||
for (unsigned i = 0; i < iidx_cfg->tt_led.num; i++) {
|
||||
setup_led_tt[i] = (i == pos) ? tt_rgb32(90, 90, 90, false) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
uint8_t channel; /* 0:E1(Start), 1:E2(Effect), 2:E3(VEFX), 3:E4 */
|
||||
volatile uint8_t *value;
|
||||
int16_t start_angle;
|
||||
} analog_ctx;
|
||||
|
||||
static void analog_key_change()
|
||||
{
|
||||
if (JUST_PRESSED(E1)) {
|
||||
analog_ctx.channel = 0;
|
||||
analog_ctx.value = &iidx_cfg->effects.e1;
|
||||
} else if (JUST_PRESSED(E2)) {
|
||||
analog_ctx.channel = 1;
|
||||
analog_ctx.value = &iidx_cfg->effects.e2;
|
||||
} else if (JUST_PRESSED(E3)) {
|
||||
analog_ctx.channel = 2;
|
||||
analog_ctx.value = &iidx_cfg->effects.e3;
|
||||
} else if (JUST_PRESSED(E4)) {
|
||||
analog_ctx.channel = 3;
|
||||
analog_ctx.value = &iidx_cfg->effects.e4;
|
||||
} else if (JUST_PRESSED(KEY_1)) {
|
||||
*analog_ctx.value = 0;
|
||||
} else if (JUST_PRESSED(KEY_2)) {
|
||||
*analog_ctx.value = 43;
|
||||
} else if (JUST_PRESSED(KEY_3)) {
|
||||
*analog_ctx.value = 85;
|
||||
} else if (JUST_PRESSED(KEY_4)) {
|
||||
*analog_ctx.value = 128;
|
||||
} else if (JUST_PRESSED(KEY_5)) {
|
||||
*analog_ctx.value = 170;
|
||||
} else if (JUST_PRESSED(KEY_6)) {
|
||||
*analog_ctx.value = 213;
|
||||
} else if (JUST_PRESSED(KEY_7)) {
|
||||
*analog_ctx.value = 255;
|
||||
}
|
||||
|
||||
check_exit();
|
||||
}
|
||||
|
||||
static void analog_enter()
|
||||
{
|
||||
analog_key_change();
|
||||
}
|
||||
|
||||
static void analog_rotate()
|
||||
{
|
||||
int16_t new_value = *analog_ctx.value;
|
||||
new_value += input.rotate;
|
||||
if (new_value < 0) {
|
||||
new_value = 0;
|
||||
} else if (new_value > 255) {
|
||||
new_value = 255;
|
||||
}
|
||||
*analog_ctx.value = new_value;
|
||||
}
|
||||
|
||||
static uint32_t scale_color(uint32_t color, uint8_t value, uint8_t factor)
|
||||
{
|
||||
uint8_t r = (color >> 16) & 0xff;
|
||||
uint8_t g = (color >> 8) & 0xff;
|
||||
uint8_t b = color & 0xff;
|
||||
|
||||
r = (r * value) / factor;
|
||||
g = (g * value) / factor;
|
||||
b = (b * value) / factor;
|
||||
|
||||
return (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
static void analog_loop()
|
||||
{
|
||||
uint32_t colors[4] = { RED, GREEN, CYAN, YELLOW};
|
||||
uint32_t tt_colors[4] = { TT_RED, TT_GREEN, TT_CYAN, TT_YELLOW };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
uint32_t color = colors[i];
|
||||
if (analog_ctx.channel == i) {
|
||||
color &= blink_fast;
|
||||
}
|
||||
setup_led_button[LED_E1 + i] = color;
|
||||
}
|
||||
|
||||
int tt_split = (int)*analog_ctx.value * iidx_cfg->tt_led.num / 255;
|
||||
|
||||
for (int i = 1; i < iidx_cfg->tt_led.num - 1; i++) {
|
||||
setup_led_tt[i] = i < tt_split ? tt_colors[analog_ctx.channel] : 0;
|
||||
}
|
||||
|
||||
int button_split = *analog_ctx.value / 37;
|
||||
int scale = *analog_ctx.value % 37;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
uint32_t color = colors[analog_ctx.channel];
|
||||
if (i == button_split) {
|
||||
color = scale_color(color, scale, 37);
|
||||
} else if (i > button_split) {
|
||||
color = 0;
|
||||
}
|
||||
setup_led_button[LED_KEY_1 + i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
uint8_t phase; /* 0:H, 1:S, 2:V */
|
||||
hsv_t hsv;
|
||||
uint8_t *value;
|
||||
int16_t start_angle;
|
||||
uint16_t keys;
|
||||
hsv_t *leds;
|
||||
} key_ctx;
|
||||
|
||||
static void key_apply()
|
||||
{
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (key_ctx.keys & (1 << i)) {
|
||||
key_ctx.leds[i] = key_ctx.hsv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void key_change()
|
||||
{
|
||||
if (JUST_PRESSED(AUX_NO)) {
|
||||
quit_mode(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (JUST_PRESSED(AUX_YES)) {
|
||||
key_ctx.phase++;
|
||||
if (key_ctx.phase == 3) {
|
||||
key_apply();
|
||||
quit_mode(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_ctx.phase == 1) {
|
||||
key_ctx.value = &key_ctx.hsv.s;
|
||||
} else {
|
||||
key_ctx.value = &key_ctx.hsv.v;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
key_ctx.keys ^= input.just_pressed;
|
||||
}
|
||||
|
||||
static void key_rotate()
|
||||
{
|
||||
int16_t new_value = *key_ctx.value;
|
||||
new_value += input.rotate;
|
||||
if (key_ctx.phase > 0) {
|
||||
if (new_value < 0) {
|
||||
new_value = 0;
|
||||
} else if (new_value > 255) {
|
||||
new_value = 255;
|
||||
}
|
||||
}
|
||||
*key_ctx.value = (uint8_t)new_value;
|
||||
}
|
||||
|
||||
static void key_loop()
|
||||
{
|
||||
for (int i = 0; i < 11; i ++) {
|
||||
if (key_ctx.keys == 0) {
|
||||
setup_led_button[i] = button_hsv(key_ctx.hsv) & blink_slow;
|
||||
} else if (key_ctx.keys & (1 << i)) {
|
||||
setup_led_button[i] = button_hsv(key_ctx.hsv);
|
||||
} else {
|
||||
setup_led_button[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t pos = *key_ctx.value * iidx_cfg->tt_led.num / 256;
|
||||
for (unsigned i = 0; i < iidx_cfg->tt_led.num; i++) {
|
||||
setup_led_tt[i] = (i == pos) ? tt_rgb32(90, 90, 90, false) : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void key_enter()
|
||||
{
|
||||
key_ctx = (typeof(key_ctx)) {
|
||||
.phase = 0,
|
||||
.hsv = { .h = 200, .s = 255, .v = 128 },
|
||||
.value = &key_ctx.hsv.h,
|
||||
.start_angle = input.angle,
|
||||
.keys = 0,
|
||||
.leds = iidx_cfg->key_on,
|
||||
};
|
||||
|
||||
if (current_mode == MODE_KEY_OFF) {
|
||||
key_ctx.hsv = (hsv_t) { .h = 60, .s = 255, .v = 5 };
|
||||
key_ctx.leds = iidx_cfg->key_off;
|
||||
}
|
||||
}
|
||||
|
||||
#define K0_WHITE {.v = 5}
|
||||
#define K0_SKY {.h = 215, .s = 255, .v = 20}
|
||||
#define K0_RED {.h = 87, .s = 255, .v = 20}
|
||||
#define K0_GREEN {.h = 0, .s = 255, .v = 20}
|
||||
|
||||
#define K1_WHITE {.v = 200}
|
||||
#define K1_SKY {.h = 215, .s = 255, .v = 230}
|
||||
#define K1_RED {.h = 87, .s = 255, .v = 230}
|
||||
#define K1_GREEN {.h = 0, .s = 255, .v = 230}
|
||||
|
||||
#define K0_RAINBOW(x) {.h = 23 * x, .s = 255, .v = 20}
|
||||
#define K1_RAINBOW(x) {.h = 23 * x, .s = 255, .v = 230}
|
||||
|
||||
static struct {
|
||||
hsv_t key_off[11];
|
||||
hsv_t key_on[11];
|
||||
} themes[7] = {
|
||||
{{ { 0 }, },
|
||||
{ K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE,
|
||||
K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE },
|
||||
},
|
||||
{{ { 0 }, },
|
||||
{ K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE,
|
||||
K1_RED, K1_GREEN, K1_GREEN, K1_SKY },
|
||||
},
|
||||
{{ { 0 }, },
|
||||
{ K1_RED, K1_SKY, K1_RED, K1_SKY, K1_RED, K1_SKY, K1_RED,
|
||||
K1_RED, K1_GREEN, K1_GREEN, K1_GREEN },
|
||||
},
|
||||
{{ K0_WHITE, K0_WHITE, K0_WHITE, K0_WHITE, K0_WHITE, K0_WHITE, K0_WHITE,
|
||||
K0_WHITE, K0_WHITE, K0_WHITE, K0_WHITE },
|
||||
{ K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE,
|
||||
K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE },
|
||||
},
|
||||
{{ K0_RED, K0_SKY, K0_RED, K0_SKY, K0_RED, K0_SKY, K0_RED,
|
||||
K0_RED, K0_GREEN, K0_GREEN, K0_GREEN },
|
||||
{ K1_RED, K1_SKY, K1_RED, K1_SKY, K1_RED, K1_SKY, K1_RED,
|
||||
K1_RED, K1_GREEN, K1_GREEN, K1_GREEN },
|
||||
},
|
||||
{{ K0_RAINBOW(0), K0_RAINBOW(1), K0_RAINBOW(2), K0_RAINBOW(3),
|
||||
K0_RAINBOW(4), K0_RAINBOW(5), K0_RAINBOW(6),
|
||||
K0_RAINBOW(7), K0_RAINBOW(8), K0_RAINBOW(9), K0_RAINBOW(10)
|
||||
},
|
||||
{ K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE,
|
||||
K1_WHITE, K1_WHITE, K1_WHITE, K1_WHITE },
|
||||
},
|
||||
{{ K0_RAINBOW(0), K0_RAINBOW(1), K0_RAINBOW(2), K0_RAINBOW(3),
|
||||
K0_RAINBOW(4), K0_RAINBOW(5), K0_RAINBOW(6),
|
||||
K0_RAINBOW(7), K0_RAINBOW(8), K0_RAINBOW(9), K0_RAINBOW(10)
|
||||
},
|
||||
{ K1_RAINBOW(0), K1_RAINBOW(1), K1_RAINBOW(2), K1_RAINBOW(3),
|
||||
K1_RAINBOW(4), K1_RAINBOW(5), K1_RAINBOW(6),
|
||||
K1_RAINBOW(7), K1_RAINBOW(8), K1_RAINBOW(9), K1_RAINBOW(10)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
static void key_theme_key_change()
|
||||
{
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (JUST_PRESSED(KEY_1 << i)) {
|
||||
memcpy(iidx_cfg->key_off, themes[i].key_off, sizeof(iidx_cfg->key_off));
|
||||
memcpy(iidx_cfg->key_on, themes[i].key_on, sizeof(iidx_cfg->key_on));
|
||||
break;
|
||||
}
|
||||
}
|
||||
check_exit();
|
||||
}
|
||||
|
||||
static void key_theme_loop()
|
||||
{
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (blink_slow) {
|
||||
setup_led_button[i] = button_hsv(iidx_cfg->key_on[i]);
|
||||
} else {
|
||||
setup_led_button[i] = button_hsv(iidx_cfg->key_off[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void tt_theme_key_change()
|
||||
{
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (JUST_PRESSED(KEY_1 << i)) {
|
||||
iidx_cfg->tt_led.effect = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
check_exit();
|
||||
}
|
||||
|
||||
static void tt_theme_loop()
|
||||
{
|
||||
for (int i = 0; i < 7; i++) {
|
||||
setup_led_button[i] = iidx_cfg->tt_led.effect == i ? SILVER : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
mode_func key_change;
|
||||
mode_func rotate;
|
||||
mode_func loop;
|
||||
mode_func enter;
|
||||
} mode_defs[] = {
|
||||
[MODE_NONE] = { nop, none_rotate, none_loop, nop},
|
||||
[MODE_TURNTABLE] = { tt_key_change, tt_rotate, tt_loop, tt_enter},
|
||||
[MODE_ANALOG] = { analog_key_change, analog_rotate, analog_loop, analog_enter},
|
||||
[MODE_LEVEL] = { level_key_change, level_rotate, level_loop, nop},
|
||||
[MODE_TT_THEME] = { tt_theme_key_change, nop, tt_theme_loop, nop},
|
||||
[MODE_KEY_THEME] = { key_theme_key_change, nop, key_theme_loop, nop},
|
||||
[MODE_KEY_OFF] = { key_change, key_rotate, key_loop, key_enter},
|
||||
[MODE_KEY_ON] = { key_change, key_rotate, key_loop, key_enter},
|
||||
};
|
||||
|
||||
static void join_mode(setup_mode_t new_mode)
|
||||
{
|
||||
cfg_save = *iidx_cfg;
|
||||
memset(&setup_led_tt, 0, sizeof(setup_led_tt));
|
||||
memset(&setup_led_button, 0, sizeof(setup_led_button));
|
||||
current_mode = new_mode;
|
||||
mode_defs[current_mode].enter();
|
||||
printf("Entering setup %d\n", new_mode);
|
||||
}
|
||||
|
||||
static void quit_mode(bool apply)
|
||||
{
|
||||
if (apply) {
|
||||
config_changed();
|
||||
} else {
|
||||
*iidx_cfg = cfg_save;
|
||||
}
|
||||
current_mode = MODE_NONE;
|
||||
printf("Quit setup %s\n", apply ? "saved." : "discarded.");
|
||||
}
|
||||
|
||||
bool setup_run(uint16_t keys, uint16_t angle)
|
||||
{
|
||||
setup_tick_ms = time_us_64() / 1000;
|
||||
input.keys = keys;
|
||||
input.angle = angle;
|
||||
input.just_pressed = keys & ~input.last_keys;
|
||||
input.just_released = ~keys & input.last_keys;
|
||||
input.rotate = input_delta(input.last_angle);
|
||||
if (input.rotate != 0) {
|
||||
printf("@ %3d %2x\n", input.rotate, input.angle);
|
||||
mode_defs[current_mode].rotate();
|
||||
}
|
||||
if (input.just_pressed) {
|
||||
printf("+ %04x\n", input.just_pressed);
|
||||
}
|
||||
if (input.just_released) {
|
||||
printf("- %04x\n", input.just_released);
|
||||
}
|
||||
|
||||
if (input.just_pressed || input.just_released) {
|
||||
mode_defs[current_mode].key_change();
|
||||
}
|
||||
|
||||
RUN_EVERY_N_MS(blink_fast = ~blink_fast, 100);
|
||||
RUN_EVERY_N_MS(blink_slow = ~blink_slow, 500);
|
||||
|
||||
mode_defs[current_mode].loop();
|
||||
|
||||
input.last_keys = keys;
|
||||
input.last_angle = angle;
|
||||
|
||||
return current_mode != MODE_NONE;
|
||||
}
|
||||
|
||||
void setup_init()
|
||||
{
|
||||
}
|
19
firmware/src/setup.h
Normal file
19
firmware/src/setup.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Controller Setup
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef SETUP_H
|
||||
#define SETUP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "board_defs.h"
|
||||
|
||||
void setup_init();
|
||||
bool setup_run(uint16_t key_flag, uint16_t tt_angle);
|
||||
|
||||
extern uint32_t setup_led_tt[];
|
||||
extern uint32_t setup_led_button[BUTTON_RGB_NUM];
|
||||
|
||||
#endif
|
124
firmware/src/tusb_config.h
Normal file
124
firmware/src/tusb_config.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_CONFIG_H_
|
||||
#define _TUSB_CONFIG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// COMMON CONFIGURATION
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// defined by board.mk
|
||||
#ifndef CFG_TUSB_MCU
|
||||
#error CFG_TUSB_MCU must be defined
|
||||
#endif
|
||||
|
||||
// RHPort number used for device can be defined by board.mk, default to port 0
|
||||
#ifndef BOARD_DEVICE_RHPORT_NUM
|
||||
#define BOARD_DEVICE_RHPORT_NUM 0
|
||||
#endif
|
||||
|
||||
// RHPort max operational speed can defined by board.mk
|
||||
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port
|
||||
// specific), otherwise FullSpeed
|
||||
#ifndef BOARD_DEVICE_RHPORT_SPEED
|
||||
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || \
|
||||
CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || CFG_TUSB_MCU == OPT_MCU_NUC505 || \
|
||||
CFG_TUSB_MCU == OPT_MCU_CXD56)
|
||||
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
|
||||
#else
|
||||
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Device mode with rhport and speed defined by board.mk
|
||||
#if BOARD_DEVICE_RHPORT_NUM == 0
|
||||
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
|
||||
#elif BOARD_DEVICE_RHPORT_NUM == 1
|
||||
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
|
||||
#else
|
||||
#error "Incorrect RHPort configuration"
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_OS
|
||||
#define CFG_TUSB_OS OPT_OS_NONE
|
||||
#endif
|
||||
|
||||
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
|
||||
// #define CFG_TUSB_DEBUG 0
|
||||
|
||||
/* USB DMA on some MCUs can only access a specific SRAM region with restriction
|
||||
* on alignment. Tinyusb use follows macros to declare transferring memory so
|
||||
* that they can be put into those specific section. e.g
|
||||
* - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
|
||||
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
|
||||
*/
|
||||
#ifndef CFG_TUSB_MEM_SECTION
|
||||
#define CFG_TUSB_MEM_SECTION
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_MEM_ALIGN
|
||||
#define CFG_TUSB_MEM_ALIGN __attribute__((aligned(4)))
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifndef CFG_TUD_ENDPOINT0_SIZE
|
||||
#define CFG_TUD_ENDPOINT0_SIZE 64
|
||||
#endif
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#define CFG_TUD_HID 1
|
||||
#define CFG_TUD_CDC 1
|
||||
#define CFG_TUD_MSC 0
|
||||
#define CFG_TUD_MIDI 0
|
||||
#define CFG_TUD_VENDOR 0
|
||||
|
||||
// HID buffer size Should be sufficient to hold ID (if any) + Data
|
||||
#define CFG_TUD_HID_EP_BUFSIZE 64
|
||||
|
||||
#define CFG_TUD_VENDOR 0
|
||||
|
||||
// HID buffer size Should be sufficient to hold ID (if any) + Data
|
||||
#define CFG_TUD_HID_EP_BUFSIZE 64
|
||||
|
||||
// CDC FIFO size of TX and RX
|
||||
#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
|
||||
// CDC Endpoint transfer buffer size, more is faster
|
||||
#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_CONFIG_H_ */
|
195
firmware/src/usb_descriptors.c
Normal file
195
firmware/src/usb_descriptors.c
Normal file
@ -0,0 +1,195 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
#include "tusb.h"
|
||||
|
||||
/* A combination of interfaces must have a unique product id, since PC will save
|
||||
* device driver after the first plug. Same VID/PID with different interface e.g
|
||||
* MSC (first), then CDC (later) will possibly cause system error on PC.
|
||||
*
|
||||
* Auto ProductID layout's Bitmap:
|
||||
* [MSB] HID | MSC | CDC [LSB]
|
||||
*/
|
||||
#define _PID_MAP(itf, n) ((CFG_TUD_##itf) << (n))
|
||||
#define USB_PID \
|
||||
(0x4000 | _PID_MAP(CDC, 0) | _PID_MAP(MSC, 1) | _PID_MAP(HID, 2) | \
|
||||
_PID_MAP(MIDI, 3) | _PID_MAP(VENDOR, 4))
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Device Descriptors
|
||||
//--------------------------------------------------------------------+
|
||||
tusb_desc_device_t desc_device_joy = {
|
||||
.bLength = sizeof(tusb_desc_device_t),
|
||||
.bDescriptorType = TUSB_DESC_DEVICE,
|
||||
.bcdUSB = 0x0200,
|
||||
.bDeviceClass = 0x00,
|
||||
.bDeviceSubClass = 0x00,
|
||||
.bDeviceProtocol = 0x00,
|
||||
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
|
||||
|
||||
.idVendor = 0xCaff,
|
||||
.idProduct = USB_PID,
|
||||
.bcdDevice = 0x0100,
|
||||
|
||||
.iManufacturer = 0x01,
|
||||
.iProduct = 0x02,
|
||||
.iSerialNumber = 0x03,
|
||||
|
||||
.bNumConfigurations = 0x01};
|
||||
|
||||
// Invoked when received GET DEVICE DESCRIPTOR
|
||||
// Application return pointer to descriptor
|
||||
uint8_t const* tud_descriptor_device_cb(void) {
|
||||
return (uint8_t const*)&desc_device_joy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HID Report Descriptor
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
uint8_t const desc_hid_report_joy[] = {
|
||||
GAMECON_REPORT_DESC_JOYSTICK(HID_REPORT_ID(REPORT_ID_JOYSTICK)),
|
||||
GAMECON_REPORT_DESC_LIGHTS(HID_REPORT_ID(REPORT_ID_LIGHTS))
|
||||
};
|
||||
|
||||
// Invoked when received GET HID REPORT DESCRIPTOR
|
||||
// Application return pointer to descriptor
|
||||
// Descriptor contents must exist long enough for transfer to complete
|
||||
uint8_t const* tud_hid_descriptor_report_cb(uint8_t itf) {
|
||||
(void)itf;
|
||||
return desc_hid_report_joy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Configuration Descriptor
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
enum { ITF_NUM_HID, ITF_NUM_CDC, ITF_NUM_CDC_DATA, ITF_NUM_TOTAL };
|
||||
|
||||
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_HID_DESC_LEN + TUD_CDC_DESC_LEN)
|
||||
|
||||
#define EPNUM_HID 0x84
|
||||
#define EPNUM_CDC_NOTIF 0x81
|
||||
#define EPNUM_CDC_OUT 0x02
|
||||
#define EPNUM_CDC_IN 0x82
|
||||
|
||||
uint8_t const desc_configuration_joy[] = {
|
||||
// Config number, interface count, string index, total length, attribute,
|
||||
// power in mA
|
||||
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN,
|
||||
TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 100),
|
||||
|
||||
// Interface number, string index, protocol, report descriptor len, EP In
|
||||
// address, size & polling interval
|
||||
TUD_HID_DESCRIPTOR(ITF_NUM_HID, 0, HID_ITF_PROTOCOL_NONE,
|
||||
sizeof(desc_hid_report_joy), EPNUM_HID,
|
||||
CFG_TUD_HID_EP_BUFSIZE, 1),
|
||||
|
||||
TUD_CDC_DESCRIPTOR(ITF_NUM_CDC, 4, EPNUM_CDC_NOTIF,
|
||||
8, EPNUM_CDC_OUT, EPNUM_CDC_IN, 64)
|
||||
|
||||
};
|
||||
|
||||
// Invoked when received GET CONFIGURATION DESCRIPTOR
|
||||
// Application return pointer to descriptor
|
||||
// Descriptor contents must exist long enough for transfer to complete
|
||||
uint8_t const* tud_descriptor_configuration_cb(uint8_t index) {
|
||||
(void)index; // for multiple configurations
|
||||
return desc_configuration_joy;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// String Descriptors
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// array of pointer to string descriptors
|
||||
const char *string_desc_arr[] = {
|
||||
(const char[]){0x09, 0x04}, // 0: is supported language is English (0x0409)
|
||||
"WHowe" , // 1: Manufacturer
|
||||
"Pico IIDX Controller", // 2: Product
|
||||
"654321", // 3: Serials, should use chip ID
|
||||
"Button 1",
|
||||
"Button 2",
|
||||
"Button 3",
|
||||
"Button 4",
|
||||
"Button 5",
|
||||
"Button 6",
|
||||
"Button 7",
|
||||
"E1",
|
||||
"E2",
|
||||
"E3",
|
||||
"E4"
|
||||
};
|
||||
|
||||
static uint16_t _desc_str[64];
|
||||
|
||||
// Invoked when received GET STRING DESCRIPTOR request
|
||||
// Application return pointer to descriptor, whose contents must exist long
|
||||
// enough for transfer to complete
|
||||
uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
|
||||
(void)langid;
|
||||
|
||||
uint8_t chr_count;
|
||||
|
||||
if (index == 0) {
|
||||
memcpy(&_desc_str[1], string_desc_arr[0], 2);
|
||||
chr_count = 1;
|
||||
} else {
|
||||
// Note: the 0xEE index string is a Microsoft OS 1.0 Descriptors.
|
||||
// https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/microsoft-defined-usb-descriptors
|
||||
|
||||
if (index < sizeof(string_desc_arr) / sizeof(string_desc_arr[0])) {
|
||||
const char* str = string_desc_arr[index];
|
||||
|
||||
// Cap at max char
|
||||
chr_count = strlen(str);
|
||||
if (chr_count > 63) chr_count = 63;
|
||||
|
||||
// Convert ASCII string into UTF-16
|
||||
for (uint8_t i = 0; i < chr_count; i++) {
|
||||
_desc_str[1 + i] = str[i];
|
||||
}
|
||||
} else {
|
||||
_desc_str[1] = 'X';
|
||||
chr_count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// first byte is length (including header), second byte is string type
|
||||
_desc_str[0] = (TUSB_DESC_STRING << 8) | (2 * chr_count + 2);
|
||||
|
||||
return _desc_str;
|
||||
}
|
||||
|
||||
void konami_mode()
|
||||
{
|
||||
desc_device_joy.idVendor = 0x1ccf;
|
||||
desc_device_joy.idProduct = 0x8048;
|
||||
string_desc_arr[1] = "Konami Amusement";
|
||||
string_desc_arr[2] = "beatmania IIDX controller premium model";
|
||||
}
|
71
firmware/src/usb_descriptors.h
Normal file
71
firmware/src/usb_descriptors.h
Normal file
@ -0,0 +1,71 @@
|
||||
#ifndef USB_DESCRIPTORS_H_
|
||||
#define USB_DESCRIPTORS_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
|
||||
enum {
|
||||
REPORT_ID_JOYSTICK = 1,
|
||||
REPORT_ID_LIGHTS,
|
||||
REPORT_ID_KEYBOARD,
|
||||
REPORT_ID_MOUSE,
|
||||
};
|
||||
|
||||
// because they are missing from tusb_hid.h
|
||||
#define HID_STRING_INDEX(x) HID_REPORT_ITEM(x, 7, RI_TYPE_LOCAL, 1)
|
||||
#define HID_STRING_INDEX_N(x, n) HID_REPORT_ITEM(x, 7, RI_TYPE_LOCAL, n)
|
||||
#define HID_STRING_MINIMUM(x) HID_REPORT_ITEM(x, 8, RI_TYPE_LOCAL, 1)
|
||||
#define HID_STRING_MINIMUM_N(x, n) HID_REPORT_ITEM(x, 8, RI_TYPE_LOCAL, n)
|
||||
#define HID_STRING_MAXIMUM(x) HID_REPORT_ITEM(x, 9, RI_TYPE_LOCAL, 1)
|
||||
#define HID_STRING_MAXIMUM_N(x, n) HID_REPORT_ITEM(x, 9, RI_TYPE_LOCAL, n)
|
||||
|
||||
// Joystick Report Descriptor Template - Based off Drewol/rp2040-gamecon
|
||||
// Button Map | X | Y
|
||||
#define GAMECON_REPORT_DESC_JOYSTICK(...) \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), \
|
||||
HID_USAGE(HID_USAGE_DESKTOP_JOYSTICK), \
|
||||
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
|
||||
__VA_ARGS__ HID_USAGE_PAGE(HID_USAGE_PAGE_BUTTON), HID_USAGE_MIN(1), \
|
||||
HID_USAGE_MAX(13), \
|
||||
HID_LOGICAL_MIN(0), HID_LOGICAL_MAX(1), HID_REPORT_COUNT(13), \
|
||||
HID_REPORT_SIZE(1), HID_INPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), \
|
||||
HID_REPORT_COUNT(1), HID_REPORT_SIZE(16 - 13), /*Padding*/ \
|
||||
HID_INPUT(HID_CONSTANT | HID_VARIABLE | HID_ABSOLUTE), \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), HID_LOGICAL_MIN(0x00), \
|
||||
HID_LOGICAL_MAX_N(0x00ff, 2), /* Below is Joystick/analog */ \
|
||||
HID_USAGE(HID_USAGE_DESKTOP_X), HID_USAGE(HID_USAGE_DESKTOP_Y), \
|
||||
HID_USAGE(HID_USAGE_DESKTOP_Z), HID_USAGE(HID_USAGE_DESKTOP_RX), \
|
||||
HID_USAGE(HID_USAGE_DESKTOP_RY), HID_USAGE(HID_USAGE_DESKTOP_RZ), \
|
||||
HID_REPORT_COUNT(6), HID_REPORT_SIZE(8), \
|
||||
HID_INPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), HID_COLLECTION_END
|
||||
|
||||
// Light Map
|
||||
#define GAMECON_REPORT_DESC_LIGHTS(...) \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), HID_USAGE(0x00), \
|
||||
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
|
||||
__VA_ARGS__ HID_REPORT_COUNT(11), /* LED NUM */ \
|
||||
HID_REPORT_SIZE(8), HID_LOGICAL_MIN(0x00), HID_LOGICAL_MAX_N(0x00ff, 2), \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_ORDINAL), HID_STRING_MINIMUM(4), \
|
||||
HID_STRING_MAXIMUM(16), HID_USAGE_MIN(1), HID_USAGE_MAX(16), \
|
||||
HID_OUTPUT(HID_DATA | HID_VARIABLE | HID_ABSOLUTE), HID_REPORT_COUNT(1), \
|
||||
HID_REPORT_SIZE(8), /*Padding*/ \
|
||||
HID_INPUT(HID_CONSTANT | HID_VARIABLE | HID_ABSOLUTE), \
|
||||
HID_COLLECTION_END
|
||||
|
||||
// NKRO Descriptor
|
||||
#define GAMECON_REPORT_DESC_NKRO(...) \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_DESKTOP), HID_USAGE(HID_USAGE_PAGE_KEYBOARD), \
|
||||
HID_COLLECTION(HID_COLLECTION_APPLICATION), \
|
||||
__VA_ARGS__ HID_REPORT_SIZE(1), HID_REPORT_COUNT(8), \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_KEYBOARD), HID_USAGE_MIN(224), \
|
||||
HID_USAGE_MAX(231), HID_LOGICAL_MIN(0), HID_LOGICAL_MAX(1), \
|
||||
HID_INPUT(HID_VARIABLE), HID_REPORT_SIZE(1), HID_REPORT_COUNT(31 * 8), \
|
||||
HID_LOGICAL_MIN(0), HID_LOGICAL_MAX(1), \
|
||||
HID_USAGE_PAGE(HID_USAGE_PAGE_KEYBOARD), HID_USAGE_MIN(0), \
|
||||
HID_USAGE_MAX(31 * 8 - 1), HID_INPUT(HID_VARIABLE), HID_COLLECTION_END
|
||||
|
||||
|
||||
/* Enable Konami spoof mode */
|
||||
void konami_mode();
|
||||
|
||||
#endif /* USB_DESCRIPTORS_H_ */
|
108
firmware/src/vl6180.c
Normal file
108
firmware/src/vl6180.c
Normal file
@ -0,0 +1,108 @@
|
||||
/*
|
||||
* VL6180X Distance measurement sensor
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef VL6180_H
|
||||
#define VL6180_H
|
||||
|
||||
#include "hardware/i2c.h"
|
||||
#include "vl6180.h"
|
||||
|
||||
#define VL6180_DEF_ADDR 0x29
|
||||
|
||||
void vl6180_write(i2c_inst_t *i2c_port, uint16_t addr, uint8_t data)
|
||||
{
|
||||
uint8_t cmd[] = {addr >> 8, addr & 0xff, data};
|
||||
i2c_write_blocking(i2c_port, VL6180_DEF_ADDR, cmd, 3, false);
|
||||
}
|
||||
|
||||
uint8_t vl6180_read(i2c_inst_t *i2c_port, uint16_t addr)
|
||||
{
|
||||
uint8_t cmd[] = {addr >> 8, addr & 0xff, 0};
|
||||
i2c_write_blocking(i2c_port, VL6180_DEF_ADDR, cmd, 3, true);
|
||||
sleep_us(1);
|
||||
uint8_t data;
|
||||
i2c_read_blocking(i2c_port, VL6180_DEF_ADDR, &data, 1, false);
|
||||
return data;
|
||||
}
|
||||
|
||||
uint16_t vl6180_read16(i2c_inst_t *i2c_port, uint16_t addr)
|
||||
{
|
||||
uint8_t cmd[] = {addr >> 8, addr & 0xff};
|
||||
i2c_write_blocking(i2c_port, VL6180_DEF_ADDR, cmd, 2, true);
|
||||
uint8_t data[2];
|
||||
i2c_read_blocking(i2c_port, VL6180_DEF_ADDR, data, 2, false);
|
||||
return data[0] << 8 | data[1];
|
||||
}
|
||||
|
||||
void vl6180_init(i2c_inst_t *i2c_port)
|
||||
{
|
||||
if (vl6180_read(i2c_port, 0x016) == 1) // reset flag
|
||||
{
|
||||
vl6180_write(i2c_port, 0x207, 0x01);
|
||||
vl6180_write(i2c_port, 0x208, 0x01);
|
||||
vl6180_write(i2c_port, 0x096, 0x00);
|
||||
vl6180_write(i2c_port, 0x097, 0xFD); // RANGE_SCALER = 253
|
||||
vl6180_write(i2c_port, 0x0E3, 0x00);
|
||||
vl6180_write(i2c_port, 0x0E4, 0x04);
|
||||
vl6180_write(i2c_port, 0x0E5, 0x02);
|
||||
vl6180_write(i2c_port, 0x0E6, 0x01);
|
||||
vl6180_write(i2c_port, 0x0E7, 0x03);
|
||||
vl6180_write(i2c_port, 0x0F5, 0x02);
|
||||
vl6180_write(i2c_port, 0x0D9, 0x05);
|
||||
vl6180_write(i2c_port, 0x0DB, 0xCE);
|
||||
vl6180_write(i2c_port, 0x0DC, 0x03);
|
||||
vl6180_write(i2c_port, 0x0DD, 0xF8);
|
||||
vl6180_write(i2c_port, 0x09F, 0x00);
|
||||
vl6180_write(i2c_port, 0x0A3, 0x3C);
|
||||
vl6180_write(i2c_port, 0x0B7, 0x00);
|
||||
vl6180_write(i2c_port, 0x0BB, 0x3C);
|
||||
vl6180_write(i2c_port, 0x0B2, 0x09);
|
||||
vl6180_write(i2c_port, 0x0CA, 0x09);
|
||||
vl6180_write(i2c_port, 0x198, 0x01);
|
||||
vl6180_write(i2c_port, 0x1B0, 0x17);
|
||||
vl6180_write(i2c_port, 0x1AD, 0x00);
|
||||
vl6180_write(i2c_port, 0x0FF, 0x05);
|
||||
vl6180_write(i2c_port, 0x100, 0x05);
|
||||
vl6180_write(i2c_port, 0x199, 0x05);
|
||||
vl6180_write(i2c_port, 0x1A6, 0x1B);
|
||||
vl6180_write(i2c_port, 0x1AC, 0x3E);
|
||||
vl6180_write(i2c_port, 0x1A7, 0x1F);
|
||||
vl6180_write(i2c_port, 0x030, 0x00);
|
||||
|
||||
vl6180_write(i2c_port, 0x011, 0x10);
|
||||
vl6180_write(i2c_port, 0x10a, 0x30);
|
||||
vl6180_write(i2c_port, 0x03f, 0x46);
|
||||
vl6180_write(i2c_port, 0x031, 0xff);
|
||||
vl6180_write(i2c_port, 0x040, 0x63);
|
||||
vl6180_write(i2c_port, 0x02e, 0x01);
|
||||
vl6180_write(i2c_port, 0x01b, 0x00);
|
||||
vl6180_write(i2c_port, 0x01c, 0x01);
|
||||
|
||||
vl6180_write(i2c_port, 0x03e, 0x31);
|
||||
vl6180_write(i2c_port, 0x014, 0x24);
|
||||
|
||||
vl6180_write(i2c_port, 0x016, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void vl6180_continous(i2c_inst_t *i2c_port)
|
||||
{
|
||||
while (vl6180_read(i2c_port, 0x04d) & 1 == 0);
|
||||
|
||||
vl6180_write(i2c_port, 0x018, 3); // start/stop continous mode
|
||||
}
|
||||
|
||||
uint8_t vl6180_dist(i2c_inst_t *i2c_port, uint8_t old)
|
||||
{
|
||||
while (vl6180_read(i2c_port, 0x04d) & 1 == 0);
|
||||
return vl6180_read(i2c_port, 0x064);
|
||||
}
|
||||
|
||||
uint16_t vl6180_dist16(i2c_inst_t *i2c_port)
|
||||
{
|
||||
return vl6180_read16(i2c_port, 0x064);
|
||||
}
|
||||
|
||||
#endif
|
22
firmware/src/vl6180.h
Normal file
22
firmware/src/vl6180.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* VL6180X Distance measurement sensor
|
||||
* WHowe <github.com/whowechina>
|
||||
*/
|
||||
|
||||
#ifndef VL6180_H
|
||||
#define VL6180_H
|
||||
|
||||
#include "hardware/i2c.h"
|
||||
|
||||
#define VL6180_DEF_ADDR 0x29
|
||||
|
||||
void vl6180_write(i2c_inst_t *i2c_port, uint16_t addr, uint8_t data);
|
||||
uint8_t vl6180_read(i2c_inst_t *i2c_port, uint16_t addr);
|
||||
uint16_t vl6180_read16(i2c_inst_t *i2c_port, uint16_t addr);
|
||||
|
||||
void vl6180_init(i2c_inst_t *i2c_port);
|
||||
void vl6180_continous(i2c_inst_t *i2c_port);
|
||||
uint8_t vl6180_dist(i2c_inst_t *i2c_port, uint8_t old);
|
||||
uint16_t vl6180_dist16(i2c_inst_t *i2c_port);
|
||||
|
||||
#endif
|
85
firmware/src/ws2812.pio
Normal file
85
firmware/src/ws2812.pio
Normal file
@ -0,0 +1,85 @@
|
||||
;
|
||||
; Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
|
||||
;
|
||||
; SPDX-License-Identifier: BSD-3-Clause
|
||||
;
|
||||
|
||||
.program ws2812
|
||||
.side_set 1
|
||||
|
||||
.define public T1 2
|
||||
.define public T2 5
|
||||
.define public T3 3
|
||||
|
||||
.lang_opt python sideset_init = pico.PIO.OUT_HIGH
|
||||
.lang_opt python out_init = pico.PIO.OUT_HIGH
|
||||
.lang_opt python out_shiftdir = 1
|
||||
|
||||
.wrap_target
|
||||
bitloop:
|
||||
out x, 1 side 0 [T3 - 1] ; Side-set still takes place when instruction stalls
|
||||
jmp !x do_zero side 1 [T1 - 1] ; Branch on the bit we shifted out. Positive pulse
|
||||
do_one:
|
||||
jmp bitloop side 1 [T2 - 1] ; Continue driving high, for a long pulse
|
||||
do_zero:
|
||||
nop side 0 [T2 - 1] ; Or drive low, for a short pulse
|
||||
.wrap
|
||||
|
||||
% c-sdk {
|
||||
#include "hardware/clocks.h"
|
||||
|
||||
static inline void ws2812_program_init(PIO pio, uint sm, uint offset, uint pin, float freq, bool rgbw) {
|
||||
|
||||
pio_gpio_init(pio, pin);
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true);
|
||||
|
||||
pio_sm_config c = ws2812_program_get_default_config(offset);
|
||||
sm_config_set_sideset_pins(&c, pin);
|
||||
sm_config_set_out_shift(&c, false, true, rgbw ? 32 : 24);
|
||||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
|
||||
|
||||
int cycles_per_bit = ws2812_T1 + ws2812_T2 + ws2812_T3;
|
||||
float div = clock_get_hz(clk_sys) / (freq * cycles_per_bit);
|
||||
sm_config_set_clkdiv(&c, div);
|
||||
|
||||
pio_sm_init(pio, sm, offset, &c);
|
||||
pio_sm_set_enabled(pio, sm, true);
|
||||
}
|
||||
%}
|
||||
|
||||
.program ws2812_parallel
|
||||
|
||||
.define public T1 2
|
||||
.define public T2 5
|
||||
.define public T3 3
|
||||
|
||||
.wrap_target
|
||||
out x, 32
|
||||
mov pins, !null [T1-1]
|
||||
mov pins, x [T2-1]
|
||||
mov pins, null [T3-2]
|
||||
.wrap
|
||||
|
||||
% c-sdk {
|
||||
#include "hardware/clocks.h"
|
||||
|
||||
static inline void ws2812_parallel_program_init(PIO pio, uint sm, uint offset, uint pin_base, uint pin_count, float freq) {
|
||||
for(uint i=pin_base; i<pin_base+pin_count; i++) {
|
||||
pio_gpio_init(pio, i);
|
||||
}
|
||||
pio_sm_set_consecutive_pindirs(pio, sm, pin_base, pin_count, true);
|
||||
|
||||
pio_sm_config c = ws2812_parallel_program_get_default_config(offset);
|
||||
sm_config_set_out_shift(&c, true, true, 32);
|
||||
sm_config_set_out_pins(&c, pin_base, pin_count);
|
||||
sm_config_set_set_pins(&c, pin_base, pin_count);
|
||||
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
|
||||
|
||||
int cycles_per_bit = ws2812_parallel_T1 + ws2812_parallel_T2 + ws2812_parallel_T3;
|
||||
float div = clock_get_hz(clk_sys) / (freq * cycles_per_bit);
|
||||
sm_config_set_clkdiv(&c, div);
|
||||
|
||||
pio_sm_init(pio, sm, offset, &c);
|
||||
pio_sm_set_enabled(pio, sm, true);
|
||||
}
|
||||
%}
|
Loading…
x
Reference in New Issue
Block a user