├── .gitignore ├── components ├── BG030-06-A-0400-0300-N-G.stp ├── BG030-12-A-0400-0300-N-G.stp ├── kailh-socket-choc.stp ├── kailh_socket_mx.stp ├── proton-c.step ├── proton_c_cad.jpg └── readme.md ├── eagle └── proton_c.lbr ├── kicad └── proton_c │ ├── README.md │ ├── proton_c.kicad_mod │ └── proton_c.lib ├── license ├── readme.md └── tools ├── png2kicad_mod.py ├── png2kicad_pcb.py ├── png2lbr.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /components/proton_c_cad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qmk/qmk_hardware/819b22b92f7af715336042deea8cb002d6f68580/components/proton_c_cad.jpg -------------------------------------------------------------------------------- /components/readme.md: -------------------------------------------------------------------------------- 1 | # Components 2 | 3 | --- 4 | 5 | ## Proton C 6 | 7 | ![Proton C on Footprint](proton_c_cad.jpg) 8 | 9 | You'll need to download the components and associate them with the kicad_mod file manually - if there's a better workflow for this, please let us know! 10 | 11 | ## Kailh PCB Socket 12 | 13 | ![Kailh PCB Socket bottom (Cherry-style)](https://i.imgur.com/Pd1VoPb.png) 14 | 15 | ![Kailh PCB Socket top (Cherry-style)](https://i.imgur.com/yvTgS6g.png) 16 | 17 | Kailh makes PCB hot-swappable sockets. They come in two flavors, `Cherry MX` and `Choc` style sockets. 18 | 19 | Datasheets are available at novelkeys.xyz; here are some quick links: 20 | 21 | * [MX Sockets](https://cdn.shopify.com/s/files/1/3099/8088/files/CPG151101S11_MX_Socket.pdf?4656976507916097806) 22 | * [Choc Sockets](https://cdn.shopify.com/s/files/1/3099/8088/files/CPG135001S30_Choc_PCB_Socket.pdf?11560148761728190369) 23 | 24 | Please be aware that it is your own responsibility to double-check the dimensions of this 3D model (and any other). You can't hold me responsible for any errors/mistakes. 25 | 26 | * Maintainer: [Pawnerd](https://github.com/pawnerd) / [Knops.io](http://www.knops.io/) 27 | * Hardware Supported: 28 | * MX style (kailh_socket_mx.stp) 29 | 30 | --- -------------------------------------------------------------------------------- /eagle/proton_c.lbr: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | Footprints used for the controller and other supporting hardware 164 | 165 | 166 | Footprint for Proton C when mounted top-up to the bottom of the board. 167 | 168 | This has holes cut out to accomodate the USB connector and to allow you to press the RESET button using a small tool. This will allow you to place the top side of the Proton C towards the board and still have a low profile. 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | >NAME 206 | >VALUE 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | FLASH 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | >NAME 259 | >VALUE 260 | 261 | 262 | Standard Proton C Footprint. 263 | 264 | This allows you to mount the Proton C on the top of a board. It has a cutout to allow the speaker to be heard. 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | >NAME 302 | >VALUE 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | Proton C Footprint. 373 | 374 | This allows you to mount the Proton C on the top of a board. There are SMD pads corresponding to internal SMD pins. 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | >NAME 412 | >VALUE 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | Proton C Footprint. 454 | 455 | This allows you to mount the Proton C on the top of a board. There are 0.5mm drill THT pads corresponding to internal SMD pins. 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | >NAME 493 | >VALUE 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | Proton C Footprint. 535 | 536 | This allows you to mount the Proton C on the top of a board. There are 0.5mm drill THT pads corresponding to internal SMD pins. There is a cutout for the speaker. 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | >NAME 574 | >VALUE 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | Proton C Footprint. 624 | 625 | This allows you to mount the Proton C on the top of a board. There are SMD pads corresponding to internal SMD pins. There is a cutout for the speaker. 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | >NAME 663 | >VALUE 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | Standard Proton C Footprint. 713 | 714 | This allows you to mount the Proton C on the top of a board. It has a cutout to allow the speaker to be heard. 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | >NAME 752 | >VALUE 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | Proton C, All Pins 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | >NAME 845 | >VALUE 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | Proton C, THT Pins 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | >NAME 943 | >VALUE 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | -------------------------------------------------------------------------------- /kicad/proton_c/README.md: -------------------------------------------------------------------------------- 1 | # Proton C 2 | 3 | ![Image](https://i.imgur.com/4q1FKLo.png) 4 | -------------------------------------------------------------------------------- /kicad/proton_c/proton_c.kicad_mod: -------------------------------------------------------------------------------- 1 | (module QMK:proton_c (layer F.Cu) (tedit 5E0CDFAC) 2 | (fp_text reference REF** (at 0.01 3.39) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.15))) 4 | ) 5 | (fp_text value Proton_C (at -0.05 1.67) (layer F.Fab) 6 | (effects (font (size 1 1) (thickness 0.15))) 7 | ) 8 | (fp_text user "DFU Button" (at 0.8 -1.3 180) (layer Cmts.User) 9 | (effects (font (size 0.8 0.8) (thickness 0.15))) 10 | ) 11 | (fp_text user A13 (at 4.2 10.9 90) (layer Cmts.User) 12 | (effects (font (size 0.8 0.8) (thickness 0.15))) 13 | ) 14 | (fp_text user A14 (at 5.7 10.9 90) (layer Cmts.User) 15 | (effects (font (size 0.8 0.8) (thickness 0.15))) 16 | ) 17 | (fp_text user RESET (at -3.3 10.3 90) (layer Cmts.User) 18 | (effects (font (size 0.8 0.8) (thickness 0.15))) 19 | ) 20 | (fp_line (start 5.1588 13.317) (end 6.1588 13.317) (layer Cmts.User) (width 0.15)) 21 | (fp_line (start 5.1588 12.317) (end 6.1588 12.317) (layer Cmts.User) (width 0.15)) 22 | (fp_line (start 5.1588 12.317) (end 5.1588 13.317) (layer Cmts.User) (width 0.15)) 23 | (fp_line (start 3.711 13.317) (end 4.711 13.317) (layer Cmts.User) (width 0.15)) 24 | (fp_line (start 3.711 12.317) (end 3.711 13.317) (layer Cmts.User) (width 0.15)) 25 | (fp_line (start 4.711 12.317) (end 4.711 13.317) (layer Cmts.User) (width 0.15)) 26 | (fp_line (start 6.1588 12.317) (end 6.1588 13.317) (layer Cmts.User) (width 0.15)) 27 | (fp_line (start 3.711 12.317) (end 4.711 12.317) (layer Cmts.User) (width 0.15)) 28 | (fp_line (start -3.909 12.317) (end -3.909 13.317) (layer Cmts.User) (width 0.15)) 29 | (fp_line (start -3.909 13.317) (end -2.909 13.317) (layer Cmts.User) (width 0.15)) 30 | (fp_line (start -3.909 12.317) (end -2.909 12.317) (layer Cmts.User) (width 0.15)) 31 | (fp_line (start -2.909 12.317) (end -2.909 13.317) (layer Cmts.User) (width 0.15)) 32 | (fp_text user "A3(3.3v)" (at -1.1 -7.1 90) (layer Cmts.User) 33 | (effects (font (size 0.8 0.8) (thickness 0.15))) 34 | ) 35 | (fp_text user C15 (at -3.3 -5.6 90) (layer Cmts.User) 36 | (effects (font (size 0.8 0.8) (thickness 0.15))) 37 | ) 38 | (fp_text user C14 (at -4.8 -5.6 90) (layer Cmts.User) 39 | (effects (font (size 0.8 0.8) (thickness 0.15))) 40 | ) 41 | (fp_text user C13/LED (at 0.1 5) (layer Cmts.User) 42 | (effects (font (size 0.8 0.8) (thickness 0.15))) 43 | ) 44 | (fp_text user "the PCB" (at -0.05 -14.98) (layer B.SilkS) 45 | (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) 46 | ) 47 | (fp_text user "away from" (at -0.05 -16.48) (layer F.SilkS) 48 | (effects (font (size 1 1) (thickness 0.15))) 49 | ) 50 | (fp_text user "the PCB" (at -0.05 -14.98) (layer F.SilkS) 51 | (effects (font (size 1 1) (thickness 0.15))) 52 | ) 53 | (fp_text user towards (at -0.05 -16.48) (layer B.SilkS) 54 | (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) 55 | ) 56 | (fp_text user "USB facing" (at -0.05 -17.98) (layer B.SilkS) 57 | (effects (font (size 1 1) (thickness 0.15)) (justify mirror)) 58 | ) 59 | (fp_line (start 4.7 29.2) (end 4.7 17.7) (layer F.SilkS) (width 0.15)) 60 | (fp_line (start -4.679 17.7) (end 4.7 17.7) (layer F.SilkS) (width 0.15)) 61 | (fp_line (start -4.679 29.2) (end 4.7 29.2) (layer F.SilkS) (width 0.15)) 62 | (fp_line (start -2.75 4.45) (end -2.75 5.45) (layer Cmts.User) (width 0.15)) 63 | (fp_line (start -3.75 4.45) (end -3.75 5.45) (layer Cmts.User) (width 0.15)) 64 | (fp_line (start -3.75 5.45) (end -2.75 5.45) (layer Cmts.User) (width 0.15)) 65 | (fp_line (start -3.75 4.45) (end -2.75 4.45) (layer Cmts.User) (width 0.15)) 66 | (fp_line (start 1.95 -4.31) (end 2.95 -4.31) (layer Cmts.User) (width 0.15)) 67 | (fp_line (start 1.95 -3.31) (end 2.95 -3.31) (layer Cmts.User) (width 0.15)) 68 | (fp_line (start 1.95 -4.31) (end 1.95 -3.31) (layer Cmts.User) (width 0.15)) 69 | (fp_line (start 2.95 -3.31) (end 2.95 -4.31) (layer Cmts.User) (width 0.15)) 70 | (fp_line (start -1.7 -3.31) (end -0.7 -3.31) (layer Cmts.User) (width 0.15)) 71 | (fp_line (start -1.7 -4.31) (end -1.7 -3.31) (layer Cmts.User) (width 0.15)) 72 | (fp_line (start -0.7 -3.31) (end -0.7 -4.31) (layer Cmts.User) (width 0.15)) 73 | (fp_line (start -1.7 -4.31) (end -0.7 -4.31) (layer Cmts.User) (width 0.15)) 74 | (fp_line (start -3.85 -4.31) (end -2.85 -4.31) (layer Cmts.User) (width 0.15)) 75 | (fp_line (start -3.85 -3.31) (end -2.85 -3.31) (layer Cmts.User) (width 0.15)) 76 | (fp_line (start -2.85 -3.31) (end -2.85 -4.31) (layer Cmts.User) (width 0.15)) 77 | (fp_line (start -3.85 -4.31) (end -3.85 -3.31) (layer Cmts.User) (width 0.15)) 78 | (fp_line (start -5.4 -3.31) (end -4.4 -3.31) (layer Cmts.User) (width 0.15)) 79 | (fp_line (start -5.4 -4.31) (end -4.4 -4.31) (layer Cmts.User) (width 0.15)) 80 | (fp_line (start -5.4 -4.31) (end -5.4 -3.31) (layer Cmts.User) (width 0.15)) 81 | (fp_line (start 7.64 31.74) (end -7.6 31.74) (layer F.SilkS) (width 0.15)) 82 | (fp_line (start -8.87 17.77) (end -8.87 30.47) (layer F.SilkS) (width 0.15)) 83 | (fp_line (start 8.91 17.77) (end 8.91 30.47) (layer F.SilkS) (width 0.15)) 84 | (fp_line (start 7.386 16.5) (end 7.64 16.5) (layer F.SilkS) (width 0.15)) 85 | (fp_line (start 7.132 14.976) (end 7.132 16.246) (layer F.SilkS) (width 0.15)) 86 | (fp_arc (start -7.346 16.246) (end -7.092 16.246) (angle 90) (layer F.SilkS) (width 0.15)) 87 | (fp_arc (start 7.386 16.246) (end 7.386 16.5) (angle 90) (layer F.SilkS) (width 0.15)) 88 | (fp_arc (start -7.6 17.77) (end -8.87 17.77) (angle 90) (layer F.SilkS) (width 0.15)) 89 | (fp_arc (start 7.64 17.77) (end 7.64 16.5) (angle 90) (layer F.SilkS) (width 0.15)) 90 | (fp_arc (start -7.6 30.47) (end -7.6 31.74) (angle 90) (layer F.SilkS) (width 0.15)) 91 | (fp_arc (start 7.64 30.47) (end 8.91 30.47) (angle 90) (layer F.SilkS) (width 0.15)) 92 | (fp_line (start 7.132 13.96) (end 7.64 13.96) (layer F.SilkS) (width 0.15)) 93 | (fp_arc (start -7.092 14.468) (end -7.092 13.96) (angle 180) (layer F.SilkS) (width 0.15)) 94 | (fp_arc (start -7.6 12.69) (end -7.6 13.96) (angle 90) (layer F.SilkS) (width 0.15)) 95 | (fp_arc (start 7.64 12.69) (end 8.91 12.69) (angle 90) (layer F.SilkS) (width 0.15)) 96 | (fp_arc (start 7.132 14.468) (end 7.132 14.976) (angle 180) (layer F.SilkS) (width 0.15)) 97 | (fp_arc (start -7.6 -18.524) (end -8.87 -18.524) (angle 90) (layer F.SilkS) (width 0.15)) 98 | (fp_line (start -4.48 -12.22) (end 4.52 -12.22) (layer Cmts.User) (width 0.15)) 99 | (fp_line (start -4.48 -20.71) (end 4.52 -20.71) (layer Cmts.User) (width 0.15)) 100 | (fp_line (start 4.52 -20.71) (end 4.52 -12.22) (layer Cmts.User) (width 0.15)) 101 | (fp_circle (center 0 -0.035) (end 0.75 -0.035) (layer F.SilkS) (width 0.15)) 102 | (fp_line (start -4.48 -20.71) (end -4.48 -12.22) (layer Cmts.User) (width 0.15)) 103 | (fp_arc (start 7.64 -18.524) (end 7.64 -19.794) (angle 90) (layer F.SilkS) (width 0.15)) 104 | (fp_line (start -7.6 -19.794) (end 7.64 -19.794) (layer F.SilkS) (width 0.15)) 105 | (fp_line (start -8.87 -18.524) (end -8.87 12.69) (layer F.SilkS) (width 0.15)) 106 | (fp_line (start 8.91 12.69) (end 8.91 -18.524) (layer F.SilkS) (width 0.15)) 107 | (fp_line (start -7.6 13.96) (end -7.09 13.96) (layer F.SilkS) (width 0.15)) 108 | (fp_line (start -7.6 16.5) (end -7.346 16.5) (layer F.SilkS) (width 0.15)) 109 | (fp_line (start -7.092 14.976) (end -7.092 16.246) (layer F.SilkS) (width 0.15)) 110 | (fp_line (start -4.4 -3.31) (end -4.4 -4.31) (layer Cmts.User) (width 0.15)) 111 | (fp_line (start -4.679 17.7) (end -4.679 29.2) (layer F.SilkS) (width 0.15)) 112 | (fp_text user "USB facing" (at -0.05 -17.98) (layer F.SilkS) 113 | (effects (font (size 1 1) (thickness 0.15))) 114 | ) 115 | (fp_text user BOOT0 (at 2.5 -6.4 90) (layer Cmts.User) 116 | (effects (font (size 0.8 0.8) (thickness 0.15))) 117 | ) 118 | (pad RST thru_hole circle (at 7.615 30.47) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 119 | (pad A13 thru_hole circle (at 7.615 27.93) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 120 | (pad B12 thru_hole circle (at 7.615 22.85) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 121 | (pad A14 thru_hole circle (at 7.615 25.39) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 122 | (pad B10 thru_hole circle (at 7.615 17.77) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 123 | (pad B11 thru_hole circle (at 7.615 20.31) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 124 | (pad B9 thru_hole circle (at 7.615 12.69) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 125 | (pad B13 thru_hole circle (at 7.615 5.07) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 126 | (pad B15 thru_hole circle (at 7.615 10.15) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 127 | (pad B14 thru_hole circle (at 7.615 7.61) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 128 | (pad B8 thru_hole circle (at 7.615 2.53) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 129 | (pad A0 thru_hole circle (at 7.615 -0.01) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 130 | (pad A1 thru_hole circle (at 7.615 -2.55) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 131 | (pad 3.3V thru_hole circle (at 7.615 -7.63) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 132 | (pad A3|5v thru_hole circle (at 5.075 -10.17) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 133 | (pad A2 thru_hole circle (at 7.615 -5.09) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 134 | (pad DFU thru_hole circle (at 7.615 -10.17) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 135 | (pad GND thru_hole circle (at 7.615 -12.71) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 136 | (pad A4 thru_hole circle (at -7.6 17.77) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 137 | (pad A15 thru_hole circle (at -7.6 30.47) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 138 | (pad A6 thru_hole circle (at -7.6 22.85) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 139 | (pad A8 thru_hole circle (at -7.6 27.93) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 140 | (pad A7 thru_hole circle (at -7.6 25.39) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 141 | (pad A5 thru_hole circle (at -7.6 20.31) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 142 | (pad B0 thru_hole circle (at -7.6 12.69) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 143 | (pad B1 thru_hole circle (at -7.6 10.15) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 144 | (pad B2 thru_hole circle (at -7.6 7.61) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 145 | (pad B3 thru_hole circle (at -7.6 5.07) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 146 | (pad B4 thru_hole circle (at -7.6 2.53) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 147 | (pad B5 thru_hole circle (at -7.6 -0.01) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 148 | (pad CHRG thru_hole circle (at 0.02 -10.17) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 149 | (pad D- thru_hole circle (at -2.52 -10.17) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 150 | (pad B6 thru_hole circle (at -7.6 -2.55) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 151 | (pad B7 thru_hole circle (at -7.6 -5.09) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 152 | (pad GND thru_hole circle (at -7.6 -7.63) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 153 | (pad GND thru_hole circle (at -7.6 -10.17) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 154 | (pad D+ thru_hole circle (at -5.06 -10.17) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 155 | (pad A9 thru_hole circle (at -7.6 -15.25) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 156 | (pad SCRE thru_hole circle (at -6.9904 -18.0748) (size 2.2 2.2) (drill 2.2) (layers *.Cu *.Mask)) 157 | (pad SCRE thru_hole circle (at 7.005 -18.0748) (size 2.2 2.2) (drill 2.2) (layers *.Cu *.Mask)) 158 | (pad A10 thru_hole circle (at -7.6 -12.71) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 159 | (pad 5V thru_hole circle (at 7.615 -15.25) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask)) 160 | (model BG030-06-A-0400-0300-N-G.stp 161 | (offset (xyz 7.62 -16.5 0)) 162 | (scale (xyz 1 1 1)) 163 | (rotate (xyz -90 0 90)) 164 | ) 165 | (model BG030-06-A-0400-0300-N-G.stp 166 | (offset (xyz -7.62 -16.5 0)) 167 | (scale (xyz 1 1 1)) 168 | (rotate (xyz -90 0 90)) 169 | ) 170 | (model BG030-12-A-0400-0300-N-G.stp 171 | (offset (xyz 7.62 16.5 -0.06)) 172 | (scale (xyz 1 1 1)) 173 | (rotate (xyz -90 0 90)) 174 | ) 175 | (model BG030-12-A-0400-0300-N-G.stp 176 | (offset (xyz -7.62 16.5 -0.06)) 177 | (scale (xyz 1 1 1)) 178 | (rotate (xyz -90 0 90)) 179 | ) 180 | (model proton-c.step 181 | (offset (xyz 0 -6 4.08)) 182 | (scale (xyz 1 1 1)) 183 | (rotate (xyz 0 0 0)) 184 | ) 185 | ) 186 | -------------------------------------------------------------------------------- /kicad/proton_c/proton_c.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | # proton_c 5 | # 6 | DEF proton_c U 0 40 Y Y 1 F N 7 | F0 "U" 0 0 50 H V C CNN 8 | F1 "proton_c" 0 100 50 H V C CNN 9 | F2 "" -150 0 50 H I C CNN 10 | F3 "" -150 0 50 H I C CNN 11 | $FPLIST 12 | proton_c 13 | $ENDFPLIST 14 | DRAW 15 | C -500 400 50 0 1 0 f 16 | C -300 400 50 0 1 0 f 17 | C -100 400 50 0 1 0 f 18 | C 250 400 50 0 1 0 f 19 | S -550 -650 -450 -750 0 1 0 f 20 | S -550 -400 -450 -500 0 1 0 f 21 | S -550 -50 -450 -150 0 1 0 f 22 | S -350 -50 -250 -150 0 1 0 f 23 | S -150 -1300 50 -1350 0 1 0 f 24 | S -150 -750 50 -800 0 1 0 f 25 | S -150 -50 -50 -150 0 1 0 f 26 | S 150 -50 250 -150 0 1 0 f 27 | S 200 -650 300 -750 0 1 0 f 28 | S 350 -650 450 -750 0 1 0 f 29 | P 2 0 1 0 -550 -450 -650 -450 N 30 | P 2 0 1 0 -300 450 -300 700 N 31 | P 2 0 1 0 -200 -900 -150 -900 N 32 | P 3 0 1 0 -450 400 -400 400 -400 700 N 33 | P 3 0 1 0 -150 400 -200 400 -200 700 N 34 | P 3 0 1 0 -100 -800 -100 -1000 -200 -1000 N 35 | P 3 0 1 0 -50 -900 0 -900 0 -1300 N 36 | P 3 0 1 0 200 400 150 400 150 500 N 37 | P 4 0 1 0 -450 -700 100 -700 100 -1400 500 -1400 N 38 | P 4 0 1 0 -450 -100 -400 -100 -400 -600 550 -600 N 39 | P 4 0 1 0 -250 -100 -200 -100 -200 -500 550 -500 N 40 | P 4 0 1 0 -50 -100 0 -100 0 -400 350 -400 N 41 | P 4 0 1 0 200 -700 150 -700 150 -1300 250 -1300 N 42 | P 4 0 1 0 250 -100 300 -100 300 -300 500 -300 N 43 | P 5 0 1 0 250 -1200 200 -1200 200 -850 400 -850 400 -750 N 44 | P 13 0 1 0 -850 -700 -700 -700 -700 -800 -850 -800 -850 -1450 800 -1450 800 -800 650 -800 650 -700 800 -700 800 1100 -850 1100 -850 -700 N 45 | X VCC/3.3v 3.3V 1000 700 200 L 50 50 1 1 B 46 | X VBUS(5V_RAW) 5V 1000 1000 200 L 50 50 1 1 B 47 | X PA0 A0 1000 400 200 L 50 50 1 1 B 48 | X PA1 A1 1000 500 200 L 50 50 1 1 B 49 | X PA10/RX A10 -1050 900 200 R 50 50 1 1 B 50 | X PA13/SWDIO A13 1000 -1300 200 L 50 50 1 1 B 51 | X PA14/SWCLK A14 1000 -1200 200 L 50 50 1 1 B 52 | X PA15 A15 -1050 -1400 200 R 50 50 1 1 B 53 | X PA2 A2 1000 600 200 L 50 50 1 1 B 54 | X PA3(3.3v) A3 1000 -400 200 L 50 50 1 1 B 55 | X A3(5v_shifted) A3|5v 150 1300 200 D 50 50 1 1 B 56 | X PA4/SPEAKER1 A4 -1050 -900 200 R 50 50 1 1 B 57 | X PA5/SPEAKER2 A5 -1050 -1000 200 R 50 50 1 1 B 58 | X PA6 A6 -1050 -1100 200 R 50 50 1 1 B 59 | X PA7 A7 -1050 -1200 200 R 50 50 1 1 B 60 | X PA8 A8 -1050 -1300 200 R 50 50 1 1 B 61 | X PA9/TX A9 -1050 1000 200 R 50 50 1 1 B 62 | X PB0 B0 -1050 -100 200 R 50 50 1 1 B 63 | X PB1 B1 -1050 0 200 R 50 50 1 1 B 64 | X PB10 B10 1000 -900 200 L 50 50 1 1 B 65 | X PB11 B11 1000 -1000 200 L 50 50 1 1 B 66 | X PB12 B12 1000 -1100 200 L 50 50 1 1 B 67 | X PB13/SCLK B13 1000 200 200 L 50 50 1 1 B 68 | X PB14/MISO B14 1000 100 200 L 50 50 1 1 B 69 | X PB15/MOSI B15 1000 0 200 L 50 50 1 1 B 70 | X PB2 B2 -1050 100 200 R 50 50 1 1 B 71 | X PB3 B3 -1050 200 200 R 50 50 1 1 B 72 | X PB4 B4 -1050 300 200 R 50 50 1 1 B 73 | X PB5 B5 -1050 400 200 R 50 50 1 1 B 74 | X PB6/SCL B6 -1050 500 200 R 50 50 1 1 B 75 | X PB7/SDA B7 -1050 600 200 R 50 50 1 1 B 76 | X PB8 B8 1000 300 200 L 50 50 1 1 B 77 | X PB9 B9 1000 -100 200 L 50 50 1 1 B 78 | X BOOT0 BT0 1000 -300 200 L 50 50 1 1 B 79 | X PC14 C14 1000 -600 200 L 50 50 1 1 B 80 | X PC15 C15 1000 -500 200 L 50 50 1 1 B 81 | X CHRG(5v) CHRG -200 1300 200 D 50 50 1 1 B 82 | X USB-DP D+ -400 1300 200 D 50 50 1 1 B 83 | X USB-DM D- -300 1300 200 D 50 50 1 1 B 84 | X DFU DFU 1000 800 200 L 50 50 1 1 B 85 | X GND GND -1050 700 200 R 50 50 1 1 B 86 | X GND GND -1050 800 200 R 50 50 1 1 B 87 | X GND GND 1000 900 200 L 50 50 1 1 B 88 | X LED LED -1050 -450 200 R 50 50 1 1 B 89 | X RESET RST 1000 -1400 200 L 50 50 1 1 B 90 | ENDDRAW 91 | ENDDEF 92 | # 93 | #End Library 94 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Hardware resources -------------------------------------------------------------------------------- /tools/png2kicad_mod.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # png2kicad_mod - converts one (or two) RGBA pngs to a .kicad_mod file 4 | # 5 | # Copyright 2017 Jack Humbert 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | from PIL import Image, ImageOps 22 | import numpy as np 23 | import potrace 24 | from shapely.geometry import Point, Polygon 25 | 26 | # Text for the file header, the parameter is the name of the module, ex "LOGO". 27 | header = """(module %(name)s (layer F.Cu) 28 | """ 29 | 30 | # Text for the file footer, the only parameter is the name of the module 31 | footer = """) 32 | """ 33 | 34 | def bezier_to_polyline(p1, p2, p3, p4): 35 | delta = 0.25 # accuacy in pixels 36 | 37 | dd0 = ( p1[0] - 2 * p2[0] + p3[0] )**2 + ( p1[1] - 2 * p2[1] + p3[1] )**2 38 | dd1 = ( p2[0] - 2 * p3[0] + p4[0] )**2 + ( p2[1] - 2 * p3[1] + p4[1] )**2 39 | dd = 6 * ( max( dd0, dd1 ) )**.5 40 | if ((8 * delta) <= dd): 41 | e2 = 8 * delta / dd 42 | else: 43 | e2 = 1 44 | epsilon = ( e2 )**.5; # necessary interval size 45 | 46 | points = list() 47 | t = epsilon 48 | while (t < 1): 49 | point = (p1[0] * ( 1 - t )**3 + \ 50 | 3* p2[0]* ( 1 - t )**2 * t + \ 51 | 3 * p3[0] * (1 - t) * ( t )**2 + \ 52 | p4[0]* ( t )**3, 53 | p1[1] * ( 1 - t )**3 + \ 54 | 3* p2[1]* ( 1 - t )**2 * t + \ 55 | 3 * p3[1] * (1 - t) * ( t )**2 + p4[1]* ( t )**3) 56 | points.append( point ) 57 | t += epsilon 58 | return points 59 | 60 | # def plot_curve(curve, scale_factor): 61 | 62 | 63 | # module += " (xy %f %f)" % (curve.start_point[0] * 25.4 / scale_factor, curve.start_point[1] * 25.4 / scale_factor) 64 | # for child in curve.children: 65 | # module += plot_curve(child, scale_factor) 66 | # i += 1 67 | # if (i > 6): 68 | # i = 0 69 | # module += "\n " 70 | # return module 71 | 72 | def curve_to_points(areas, curve, fp_type, process_children): 73 | points = list() 74 | points.append((curve.start_point[0], curve.start_point[1])) 75 | for segment in curve.segments: 76 | if segment.is_corner: 77 | points.append((segment.c[0], segment.c[1])) 78 | points.append((segment.end_point[0], segment.end_point[1])) 79 | # else: 80 | # points.extend(curve.tesselate()) 81 | # points.extend(bezier_to_polyline(curve.start_point, segment.c1, segment.c2, segment.end_point)) 82 | # points.append((segment.end_point[0], segment.end_point[1])) 83 | points.append((curve.start_point[0], curve.start_point[1])) 84 | 85 | if not process_children: 86 | return points 87 | 88 | for child in curve.children: 89 | for grandchild in child.children: 90 | curve_to_points(areas, grandchild, fp_type, True) 91 | child_points = curve_to_points(areas, child, fp_type, False) 92 | if fp_type == "fp_poly": 93 | closest = 10000 94 | closest_point = 0 95 | closest_child_point = 0 96 | for p, point in enumerate(points): 97 | for cp, child_point in enumerate(child_points): 98 | distance = ((point[0] - child_point[0])**2 + (point[1] - child_point[1])**2)**.5 99 | if distance < closest: 100 | closest = distance 101 | closest_point = p 102 | closest_child_point = cp 103 | points.insert(closest_point + 1, points[closest_point]) 104 | points.insert(closest_point + 1, child_points[closest_child_point]) 105 | for point in child_points[closest_child_point::-1]: 106 | points.insert(closest_point + 1, point) 107 | for point in child_points[:closest_child_point:-1]: 108 | points.insert(closest_point + 1, point) 109 | points.insert(closest_point + 1, child_points[closest_child_point]) 110 | else: 111 | areas.append(child_points) 112 | 113 | areas.append(points) 114 | 115 | 116 | def render_path_to_layer(path, fp_type, layer, scale_factor): 117 | module = "" 118 | areas = list() 119 | children = list() 120 | for curve in path.curves_tree: 121 | curve_to_points(areas, curve, fp_type, True) 122 | 123 | for poly in areas: 124 | if fp_type == "fp_poly": 125 | module += "\n (%s (pts" % fp_type 126 | i = 0 127 | for point in poly: 128 | module += " (xy %f %f)" % (point[0] * 25.4 / scale_factor, point[1] * 25.4 / scale_factor) 129 | i += 1 130 | if (i > 6): 131 | i = 0 132 | module += "\n" 133 | module += " (xy %f %f)" % (poly[0][0] * 25.4 / scale_factor, point[1] * 25.4 / scale_factor) 134 | 135 | module += """) 136 | (layer %s) 137 | (width 0.0001) 138 | ) 139 | """ % layer 140 | else: 141 | i = 0 142 | poly.append(poly[len(poly)-1]) 143 | for i, point in enumerate(poly): 144 | if i+2 < len(poly): 145 | module += "\n (%s" % fp_type 146 | module += " (start %f %f)" % (point[0] * 25.4 / scale_factor, point[1] * 25.4 / scale_factor) 147 | module += " (end %f %f)" % (poly[i+1][0] * 25.4 / scale_factor, poly[i+1][1] * 25.4 / scale_factor) 148 | module += """ (layer %s) 149 | (width 0.0001) 150 | ) 151 | """ % layer 152 | 153 | return module 154 | 155 | def conv_image_to_module(name, scale_factor): 156 | 157 | module = header % {"name": name} 158 | 159 | front_image = Image.open("%s_front.png" % name) 160 | print("Reading image from \"%s_front.png\"" % name) 161 | 162 | front_image_red, front_image_green, front_image_blue, front_image_alpha = front_image.split() 163 | 164 | front_image_red = front_image_red.point(lambda i: 0 if i < 127 else 1) 165 | red_array = np.array(front_image_red) 166 | bmp_red = potrace.Bitmap(red_array) 167 | path_red = bmp_red.trace(alphamax = 0.0, opttolerance = 50) 168 | 169 | # Soldermask needs to be inverted 170 | front_image_green = ImageOps.invert(front_image_green) 171 | front_image_green = Image.composite(front_image_green, front_image_alpha, front_image_alpha) 172 | front_image_green = front_image_green.point(lambda i: 0 if i < 127 else 1) 173 | green_array = np.array(front_image_green) 174 | bmp_green = potrace.Bitmap(green_array) 175 | path_green = bmp_green.trace(alphamax = 0.0, opttolerance = 50) 176 | 177 | front_image_blue = front_image_blue.point(lambda i: 0 if i < 127 else 1) 178 | blue_array = np.array(front_image_blue) 179 | bmp_blue = potrace.Bitmap(blue_array) 180 | path_blue = bmp_blue.trace(alphamax = 0.0, opttolerance = 50) 181 | 182 | front_image_alpha = front_image_alpha.point(lambda i: 0 if i < 127 else 1) 183 | front_image_alpha_array = np.array(front_image_alpha) 184 | bmp_alpha = potrace.Bitmap(front_image_alpha_array) 185 | path_alpha = bmp_alpha.trace(alphamax = 0.0, opttolerance = 50) 186 | 187 | w, h = front_image.size 188 | 189 | print("Generating Edge.Cuts layer from front alpha channel") 190 | module += render_path_to_layer(path_alpha, "fp_line", "Edge.Cuts", scale_factor) 191 | 192 | print("Generating F.Cu layer from front red channel") 193 | module += render_path_to_layer(path_red, "fp_poly", "F.Cu", scale_factor) 194 | print("Generating F.Mask layer from front green channel") 195 | module += render_path_to_layer(path_green, "fp_poly", "F.Mask", scale_factor) 196 | print("Generating F.SilkS layer from front blue channel") 197 | module += render_path_to_layer(path_blue, "fp_poly", "F.SilkS", scale_factor) 198 | 199 | try: 200 | back_image = Image.open("%s_back.png" % name) 201 | back_image = ImageOps.mirror(back_image) 202 | print("Reading image from \"%s_back.png\"" % name) 203 | 204 | back_image_red, back_image_green, back_image_blue, back_image_alpha = back_image.split() 205 | 206 | back_image_red = back_image_red.point(lambda i: 0 if i < 127 else 1) 207 | red_array = np.array(back_image_red) 208 | bmp_red = potrace.Bitmap(red_array) 209 | path_red = bmp_red.trace(alphamax = 0.0, opttolerance = 50) 210 | 211 | # Soldermask needs to be inverted 212 | back_image_green = ImageOps.invert(back_image_green) 213 | back_image_green = back_image_green.point(lambda i: 0 if i < 127 else 1) 214 | green_array = np.array(back_image_green) 215 | bmp_green = potrace.Bitmap(green_array) 216 | path_green = bmp_green.trace(alphamax = 0.0, opttolerance = 50) 217 | 218 | back_image_blue = back_image_blue.point(lambda i: 0 if i < 127 else 1) 219 | blue_array = np.array(back_image_blue) 220 | bmp_blue = potrace.Bitmap(blue_array) 221 | path_blue = bmp_blue.trace(alphamax = 0.0, opttolerance = 50) 222 | 223 | print("Generating B.Cu layer from back red channel") 224 | module += render_path_to_layer(path_red, "fp_poly", "B.Cu", scale_factor) 225 | print("Generating B.Mask layer from back green channel") 226 | module += render_path_to_layer(path_green, "fp_poly", "B.Mask", scale_factor) 227 | print("Generating B.SilkS layer from back blue channel") 228 | module += render_path_to_layer(path_blue, "fp_poly", "B.SilkS", scale_factor) 229 | except IOError: 230 | pass 231 | 232 | module += footer % {"name": name} 233 | return module, (w * 25.4 / scale_factor, h * 25.4 / scale_factor) 234 | 235 | 236 | def main(): 237 | import sys 238 | 239 | if len(sys.argv) < 3: 240 | print("Usage: %s input_name dpi" % sys.argv[0]) 241 | print(" input_name is added to \"_front.png\" (and \"_back.png\") ") 242 | print(" dpi is the dots per inch of the input file\"") 243 | sys.exit(1) 244 | 245 | input_name = sys.argv[1] 246 | dpi = int(sys.argv[2]) 247 | 248 | module, size = conv_image_to_module(input_name, dpi) 249 | print("Output image size: %f x %f mm" % (size[0], size[1])) 250 | print("Writing module file to \"%s.kicad_mod\"" % input_name) 251 | fid = open("%s.kicad_mod" % input_name, "w") 252 | fid.write(module) 253 | fid.close() 254 | 255 | if __name__ == "__main__": 256 | main() 257 | 258 | -------------------------------------------------------------------------------- /tools/png2kicad_pcb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # png2kicad_pcb - converts one (or two) RGBA pngs to a .kicad_pcb file 4 | # 5 | # Copyright 2017 Jack Humbert 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | from PIL import Image, ImageOps 22 | import numpy as np 23 | import potrace 24 | from shapely.geometry import Point, Polygon 25 | import png2kicad_mod 26 | 27 | # Text for the file header, the parameter is the name of the module, ex "LOGO". 28 | pcb_header = """(kicad_pcb (version 4) (host pcbnew 4.0.6) 29 | 30 | (general 31 | (links 0) 32 | (no_connects 0) 33 | (area 44.9 37.5582 278.552718 120.126051) 34 | (thickness 1.6) 35 | (drawings 0) 36 | (tracks 0) 37 | (zones 0) 38 | (modules 1) 39 | (nets 1) 40 | ) 41 | 42 | (page A4) 43 | (layers 44 | (0 F.Cu signal) 45 | (31 B.Cu signal) 46 | (32 B.Adhes user) 47 | (33 F.Adhes user) 48 | (34 B.Paste user) 49 | (35 F.Paste user) 50 | (36 B.SilkS user) 51 | (37 F.SilkS user) 52 | (38 B.Mask user) 53 | (39 F.Mask user) 54 | (40 Dwgs.User user) 55 | (41 Cmts.User user) 56 | (42 Eco1.User user) 57 | (43 Eco2.User user) 58 | (44 Edge.Cuts user) 59 | (45 Margin user) 60 | (46 B.CrtYd user) 61 | (47 F.CrtYd user) 62 | (48 B.Fab user) 63 | (49 F.Fab user) 64 | ) 65 | 66 | (setup 67 | (last_trace_width 0.25) 68 | (trace_clearance 0.2) 69 | (zone_clearance 0.508) 70 | (zone_45_only no) 71 | (trace_min 0.2) 72 | (segment_width 0.2) 73 | (edge_width 0.15) 74 | (via_size 0.6) 75 | (via_drill 0.4) 76 | (via_min_size 0.4) 77 | (via_min_drill 0.3) 78 | (uvia_size 0.3) 79 | (uvia_drill 0.1) 80 | (uvias_allowed no) 81 | (uvia_min_size 0.2) 82 | (uvia_min_drill 0.1) 83 | (pcb_text_width 0.3) 84 | (pcb_text_size 1.5 1.5) 85 | (mod_edge_width 0.15) 86 | (mod_text_size 1 1) 87 | (mod_text_width 0.15) 88 | (pad_size 1.524 1.524) 89 | (pad_drill 0.762) 90 | (pad_to_mask_clearance 0.2) 91 | (aux_axis_origin 38.25 36.75) 92 | (grid_origin 38.25 36.75) 93 | (visible_elements 7FFFFFFF) 94 | (pcbplotparams 95 | (layerselection 0x010fc_80000001) 96 | (usegerberextensions true) 97 | (excludeedgelayer true) 98 | (linewidth 0.100000) 99 | (plotframeref false) 100 | (viasonmask false) 101 | (mode 1) 102 | (useauxorigin false) 103 | (hpglpennumber 1) 104 | (hpglpenspeed 20) 105 | (hpglpendiameter 15) 106 | (hpglpenoverlay 2) 107 | (psnegative false) 108 | (psa4output false) 109 | (plotreference true) 110 | (plotvalue true) 111 | (plotinvisibletext false) 112 | (padsonsilk false) 113 | (subtractmaskfromsilk false) 114 | (outputformat 1) 115 | (mirror false) 116 | (drillshape 0) 117 | (scaleselection 1) 118 | (outputdirectory .)) 119 | ) 120 | 121 | (net 0 "") 122 | 123 | (net_class Default "This is the default net class." 124 | (clearance 0.2) 125 | (trace_width 0.25) 126 | (via_dia 0.6) 127 | (via_drill 0.4) 128 | (uvia_dia 0.3) 129 | (uvia_drill 0.1) 130 | ) 131 | """ 132 | 133 | pcb_footer = "\n)" 134 | 135 | def main(): 136 | import sys 137 | 138 | if len(sys.argv) < 3: 139 | print("Usage: %s input_name dpi" % sys.argv[0]) 140 | print(" input_name is added to \"_front.png\" (and \"_back.png\") ") 141 | print(" dpi is the dots per inch of the input file\"") 142 | sys.exit(1) 143 | 144 | input_name = sys.argv[1] 145 | dpi = int(sys.argv[2]) 146 | 147 | module, size = png2kicad_mod.conv_image_to_module(input_name, dpi) 148 | module = pcb_header + module + pcb_footer 149 | print("Output image size: %f x %f mm" % (size[0], size[1])) 150 | print("Writing module file to \"%s.kicad_pcb\"" % input_name) 151 | fid = open("%s.kicad_pcb" % input_name, "w") 152 | fid.write(module) 153 | fid.close() 154 | 155 | if __name__ == "__main__": 156 | main() 157 | 158 | -------------------------------------------------------------------------------- /tools/png2lbr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # png2lbr - converts one (or two) RGBA pngs to an Eagle .lbr file 4 | # 5 | # Copyright 2017 Jack Humbert 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, either version 2 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | # 20 | 21 | from PIL import Image, ImageOps 22 | import numpy as np 23 | import potrace 24 | from shapely.geometry import Point, Polygon 25 | 26 | # Text for the file header, the parameter is the name of the module, ex "LOGO". 27 | header = """ 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | """ 103 | 104 | # Text for the file footer, the only parameter is the name of the module 105 | footer = """ 106 | 107 | 108 | 109 | 110 | %(name)s 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | """ 135 | 136 | def bezier_to_polyline(p1, p2, p3, p4): 137 | delta = 0.25 # accuacy in pixels 138 | 139 | dd0 = ( p1[0] - 2 * p2[0] + p3[0] )**2 + ( p1[1] - 2 * p2[1] + p3[1] )**2 140 | dd1 = ( p2[0] - 2 * p3[0] + p4[0] )**2 + ( p2[1] - 2 * p3[1] + p4[1] )**2 141 | dd = 6 * ( max( dd0, dd1 ) )**.5 142 | if ((8 * delta) <= dd): 143 | e2 = 8 * delta / dd 144 | else: 145 | e2 = 1 146 | epsilon = ( e2 )**.5; # necessary interval size 147 | 148 | points = list() 149 | t = epsilon 150 | while (t < 1): 151 | point = (p1[0] * ( 1 - t )**3 + \ 152 | 3* p2[0]* ( 1 - t )**2 * t + \ 153 | 3 * p3[0] * (1 - t) * ( t )**2 + \ 154 | p4[0]* ( t )**3, 155 | p1[1] * ( 1 - t )**3 + \ 156 | 3* p2[1]* ( 1 - t )**2 * t + \ 157 | 3 * p3[1] * (1 - t) * ( t )**2 + p4[1]* ( t )**3) 158 | points.append( point ) 159 | t += epsilon 160 | return points 161 | 162 | def curve_to_points(areas, curve, fp_type, process_children): 163 | points = list() 164 | points.append((curve.start_point[0], curve.start_point[1])) 165 | for segment in curve.segments: 166 | if segment.is_corner: 167 | points.append((segment.c[0], segment.c[1])) 168 | points.append((segment.end_point[0], segment.end_point[1])) 169 | # else: 170 | # points.extend(curve.tesselate()) 171 | # points.extend(bezier_to_polyline(curve.start_point, segment.c1, segment.c2, segment.end_point)) 172 | # points.append((segment.end_point[0], segment.end_point[1])) 173 | points.append((curve.start_point[0], curve.start_point[1])) 174 | 175 | if not process_children: 176 | return points 177 | 178 | for child in curve.children: 179 | for grandchild in child.children: 180 | curve_to_points(areas, grandchild, fp_type, True) 181 | child_points = curve_to_points(areas, child, fp_type, False) 182 | if fp_type == "poly": 183 | closest = 10000 184 | closest_point = 0 185 | closest_child_point = 0 186 | for p, point in enumerate(points): 187 | for cp, child_point in enumerate(child_points): 188 | distance = ((point[0] - child_point[0])**2 + (point[1] - child_point[1])**2)**.5 189 | if distance < closest: 190 | closest = distance 191 | closest_point = p 192 | closest_child_point = cp 193 | points.insert(closest_point + 1, points[closest_point]) 194 | points.insert(closest_point + 1, child_points[closest_child_point]) 195 | for point in child_points[closest_child_point::-1]: 196 | points.insert(closest_point + 1, point) 197 | for point in child_points[:closest_child_point:-1]: 198 | points.insert(closest_point + 1, point) 199 | points.insert(closest_point + 1, child_points[closest_child_point]) 200 | else: 201 | areas.append(child_points) 202 | 203 | areas.append(points) 204 | 205 | def render_path_to_layer(path, fp_type, layer, scale_factor): 206 | module = "" 207 | areas = list() 208 | children = list() 209 | for curve in path.curves_tree: 210 | curve_to_points(areas, curve, fp_type, True) 211 | 212 | for poly in areas: 213 | if fp_type == "poly": 214 | module += "\n " % layer 215 | for point in poly: 216 | module += "\n " % (point[0] * 25.4 / scale_factor, point[1] * 25.4 / scale_factor) 217 | module += "\n " % (poly[0][0] * 25.4 / scale_factor, point[1] * 25.4 / scale_factor) 218 | 219 | module += "\n " 220 | else: 221 | i = 0 222 | poly.append(poly[len(poly)-1]) 223 | for i, point in enumerate(poly): 224 | if i+2 < len(poly): 225 | module += " " % (point[0] * 25.4 / scale_factor, point[1] * 25.4 / scale_factor, poly[i+1][0] * 25.4 / scale_factor, poly[i+1][1] * 25.4 / scale_factor, layer) 226 | 227 | return module 228 | 229 | def conv_image_to_module(name, scale_factor): 230 | 231 | module = header % {"name": name.upper()} 232 | 233 | front_image = Image.open("%s_front.png" % name).transpose(Image.FLIP_TOP_BOTTOM) 234 | print("Reading image from \"%s_front.png\"" % name) 235 | 236 | front_image_red, front_image_green, front_image_blue, front_image_alpha = front_image.split() 237 | 238 | # Soldermask needs to be inverted 239 | front_image_red = ImageOps.invert(front_image_red) 240 | front_image_red = Image.composite(front_image_red, front_image_alpha, front_image_alpha) 241 | front_image_red = front_image_red.point(lambda i: 0 if i < 127 else 1) 242 | red_array = np.array(front_image_red) 243 | bmp_red = potrace.Bitmap(red_array) 244 | path_red = bmp_red.trace(alphamax = 0.0, opttolerance = 50) 245 | 246 | # Soldermask needs to be inverted 247 | front_image_green = ImageOps.invert(front_image_green) 248 | front_image_green = Image.composite(front_image_green, front_image_alpha, front_image_alpha) 249 | front_image_green = front_image_green.point(lambda i: 0 if i < 127 else 1) 250 | green_array = np.array(front_image_green) 251 | bmp_green = potrace.Bitmap(green_array) 252 | path_green = bmp_green.trace(alphamax = 0.0, opttolerance = 50) 253 | 254 | front_image_blue = front_image_blue.point(lambda i: 0 if i < 127 else 1) 255 | blue_array = np.array(front_image_blue) 256 | bmp_blue = potrace.Bitmap(blue_array) 257 | path_blue = bmp_blue.trace(alphamax = 0.0, opttolerance = 50) 258 | 259 | front_image_alpha = front_image_alpha.point(lambda i: 0 if i < 127 else 1) 260 | front_image_alpha_array = np.array(front_image_alpha) 261 | bmp_alpha = potrace.Bitmap(front_image_alpha_array) 262 | path_alpha = bmp_alpha.trace(alphamax = 0.0, opttolerance = 50) 263 | 264 | w, h = front_image.size 265 | 266 | # print("Generating Outline layer from front alpha channel") 267 | # module += render_path_to_layer(path_alpha, "line", "20", scale_factor) 268 | 269 | print("Generating tKeepout layer from front red channel") 270 | module += render_path_to_layer(path_red, "poly", "39", scale_factor) 271 | print("Generating tStop layer from front green channel") 272 | module += render_path_to_layer(path_green, "poly", "29", scale_factor) 273 | print("Generating tPlace layer from front blue channel") 274 | module += render_path_to_layer(path_blue, "poly", "21", scale_factor) 275 | 276 | try: 277 | back_image = Image.open("%s_back.png" % name).transpose(Image.FLIP_TOP_BOTTOM) 278 | back_image = ImageOps.mirror(back_image) 279 | print("Reading image from \"%s_back.png\"" % name) 280 | 281 | back_image_red, back_image_green, back_image_blue, back_image_alpha = back_image.split() 282 | 283 | back_image_red = back_image_red.point(lambda i: 0 if i < 127 else 1) 284 | red_array = np.array(back_image_red) 285 | bmp_red = potrace.Bitmap(red_array) 286 | path_red = bmp_red.trace(alphamax = 0.0, opttolerance = 50) 287 | 288 | # Soldermask needs to be inverted 289 | back_image_green = ImageOps.invert(back_image_green) 290 | back_image_green = back_image_green.point(lambda i: 0 if i < 127 else 1) 291 | green_array = np.array(back_image_green) 292 | bmp_green = potrace.Bitmap(green_array) 293 | path_green = bmp_green.trace(alphamax = 0.0, opttolerance = 50) 294 | 295 | back_image_blue = back_image_blue.point(lambda i: 0 if i < 127 else 1) 296 | blue_array = np.array(back_image_blue) 297 | bmp_blue = potrace.Bitmap(blue_array) 298 | path_blue = bmp_blue.trace(alphamax = 0.0, opttolerance = 50) 299 | 300 | print("Generating bKeepout layer from back red channel") 301 | module += render_path_to_layer(path_red, "poly", "40", scale_factor) 302 | print("Generating bStop layer from back green channel") 303 | module += render_path_to_layer(path_green, "poly", "30", scale_factor) 304 | print("Generating bPlace layer from back blue channel") 305 | module += render_path_to_layer(path_blue, "poly", "22", scale_factor) 306 | except IOError: 307 | pass 308 | 309 | module += footer % {"name": name.upper()} 310 | return module, (w * 25.4 / scale_factor, h * 25.4 / scale_factor) 311 | 312 | 313 | def main(): 314 | import sys 315 | 316 | if len(sys.argv) < 3: 317 | print("Usage: %s input_name dpi" % sys.argv[0]) 318 | print(" input_name is added to \"_front.png\" (and \"_back.png\") ") 319 | print(" dpi is the dots per inch of the input file\"") 320 | sys.exit(1) 321 | 322 | input_name = sys.argv[1] 323 | dpi = int(sys.argv[2]) 324 | 325 | module, size = conv_image_to_module(input_name, dpi) 326 | print("Output image size: %f x %f mm" % (size[0], size[1])) 327 | print("Writing module file to \"%s.lbr\"" % input_name) 328 | fid = open("%s.lbr" % input_name, "w") 329 | fid.write(module) 330 | fid.close() 331 | 332 | if __name__ == "__main__": 333 | main() 334 | 335 | -------------------------------------------------------------------------------- /tools/requirements.txt: -------------------------------------------------------------------------------- 1 | # Requirements automatically generated by pigar. 2 | # https://github.com/Damnever/pigar 3 | 4 | # tools/png2kicad_mod.py: 21 5 | # tools/png2kicad_pcb.py: 21 6 | # tools/png2lbr.py: 21 7 | Pillow == 8.2.0 8 | 9 | # tools/png2kicad_mod.py: 24 10 | # tools/png2kicad_pcb.py: 24 11 | # tools/png2lbr.py: 24 12 | Shapely == 1.6.2.post1 13 | 14 | # tools/png2kicad_mod.py: 22 15 | # tools/png2kicad_pcb.py: 22 16 | # tools/png2lbr.py: 22 17 | numpy == 1.13.3 18 | 19 | # tools/png2kicad_mod.py: 23 20 | # tools/png2kicad_pcb.py: 23 21 | # tools/png2lbr.py: 23 22 | pypotrace == 0.1.3 23 | --------------------------------------------------------------------------------