├── .dockerignore ├── .github └── workflows │ └── dockerimage.yml ├── Dockerfile ├── Dockerfile.buildroot ├── Makefile ├── README.md ├── buildroot ├── .config ├── board │ ├── boot_overlay │ │ ├── cmdline.txt │ │ ├── config.txt │ │ └── overlays │ │ │ └── dwc2.dtbo │ ├── genimage-board.cfg │ ├── post-build.sh │ ├── post-image.sh │ └── rootfs_overlay │ │ ├── etc │ │ ├── init.d │ │ │ └── S00atime │ │ ├── mdev.conf │ │ └── ssh │ │ │ └── sshd_config │ │ └── root │ │ └── eth0.sh ├── configs │ └── passkeeper_defconfig └── linux-config ├── dist └── .keepme ├── firmware ├── Makefile ├── app │ ├── service │ │ ├── service.go │ │ └── support │ │ │ ├── controlPanel.go │ │ │ └── dashboard.go │ ├── splash │ │ ├── image │ │ │ └── splash.png │ │ └── splash.go │ └── util │ │ └── util.go ├── config │ ├── config.go │ └── config_test.go ├── controls │ ├── display │ │ └── display.go │ ├── input │ │ └── input.go │ ├── keyboard │ │ └── keyboard.go │ └── status │ │ └── status.go ├── device │ └── rpi │ │ ├── display │ │ ├── display.go │ │ ├── lcd │ │ │ └── display.go │ │ └── oled │ │ │ └── display.go │ │ ├── keyboard.go │ │ ├── keyboard_scancodes.go │ │ ├── keyboard_scancodes_test.go │ │ ├── network.go │ │ └── raspberrypi.go ├── dhcpsrv │ └── dhcpsrv.go ├── go.mod ├── package.go ├── pass │ ├── generator.go │ ├── pass.go │ └── rfid_password_provider.go ├── rest │ ├── backuprestore.go │ ├── cmd │ │ └── main.go │ ├── credentials.go │ ├── passwords.go │ └── rest.go └── storage │ ├── crypto.go │ ├── file_storage.go │ ├── file_storage_test.go │ └── storage.go ├── kicad ├── test-cad-cache.lib ├── test-cad.bak ├── test-cad.kicad_pcb ├── test-cad.pro ├── test-cad.sch └── test-cad │ ├── LCD.bak │ ├── LCD.bck │ ├── LCD.dcm │ ├── LCD.lib │ ├── MiFare.dcm │ ├── MiFare.lib │ ├── RPi.dcm │ ├── RPi.lib │ ├── test-cad-cache.lib │ ├── test-cad-rescue.lib │ ├── test-cad.bak │ ├── test-cad.pro │ └── test-cad.sch └── web ├── .env ├── .env.production ├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico ├── index.html └── style.css └── src ├── App.vue ├── components ├── Home.vue └── Settings.vue ├── js ├── models.js └── restapi.js └── main.js /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | .dockerignore 3 | kicad 4 | dist/ 5 | .gitignore 6 | buildroot/build/ 7 | buildroot/host/ 8 | buildroot/images/ 9 | buildroot/staging 10 | buildroot/target/ 11 | 12 | -------------------------------------------------------------------------------- /.github/workflows/dockerimage.yml: -------------------------------------------------------------------------------- 1 | name: Docker Image CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | 7 | build: 8 | 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - uses: actions/checkout@v1 13 | - name: Build the Docker image 14 | run: make all 15 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:13-alpine AS node 2 | COPY web/ /web 3 | WORKDIR /web 4 | RUN npm install && npm run build 5 | 6 | FROM golang:1.13-alpine AS builder 7 | COPY firmware/ /build 8 | COPY --from=node /web/dist/ /web/ 9 | RUN apk add make upx git 10 | WORKDIR /build 11 | RUN mkdir /dist && make clean all 12 | 13 | #FROM jdevelop/passkeeper:buildroot-2018.08.2-rpi-zero-w as buildroot 14 | FROM jdevelop/passkeeper:buildroot-2018.08.2-rpi-zero as buildroot 15 | COPY --from=builder /dist/ /build/board/rootfs_overlay/root/ 16 | COPY buildroot/.config /build/.config 17 | COPY buildroot/linux-config /build/linux-config 18 | WORKDIR /build 19 | RUN make O=/build PASSKEEPER=/build FORCE_UNSAFE_CONFIGURE=1 -C /buildroot/buildroot-2018.08.2 linux-rebuild 20 | RUN make O=/build PASSKEEPER=/build FORCE_UNSAFE_CONFIGURE=1 -C /buildroot/buildroot-2018.08.2 21 | 22 | FROM alpine:3.10 23 | COPY --from=buildroot /build/images/sdcard.img /dist/ 24 | WORKDIR /dist 25 | -------------------------------------------------------------------------------- /Dockerfile.buildroot: -------------------------------------------------------------------------------- 1 | FROM alpine:3.8 AS fetcher 2 | RUN apk add wget 3 | WORKDIR /buildroot 4 | RUN wget "https://buildroot.org/downloads/buildroot-2018.08.2.tar.gz" && tar -xvf buildroot-2018.08.2.tar.gz 5 | 6 | FROM ubuntu:bionic AS builder 7 | RUN apt-get update && apt-get -y install --no-install-recommends ca-certificates wget gcc make bash coreutils build-essential file perl python rsync bc g++ binutils patch gzip bzip2 tar cpio unzip linux-headers-generic 8 | RUN update-ca-certificates 9 | COPY --from=fetcher /buildroot /buildroot 10 | COPY buildroot/ /build 11 | WORKDIR /build 12 | RUN make O=/build PASSKEEPER=/build FORCE_UNSAFE_CONFIGURE=1 -C /buildroot/buildroot-2018.08.2 13 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | 3 | all: 4 | docker build . -t passkeeper:local 5 | docker run --rm -v `pwd`/dist:/hostfs passkeeper:local /bin/sh -c "cp -R /dist/* /hostfs/" 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DIY Hardware Password Keeper 2 | 3 | ## Contributors 4 | * [Eugene](https://github.com/jdevelop) 5 | * [Maxim](https://github.com/maximcamario) 6 | 7 | ## Objective 8 | The goal of the project is to create the easy to build and use device that allows to store virtually unlimited number of passwords on AES encrypted storage. The storage is encrypted with AES and uses the password that is stored on the RFID FOB key. 9 | 10 | ## Hardware 11 | Hardware part is built on [Raspberry Pi Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/) ([W](https://www.raspberrypi.org/products/raspberry-pi-zero-w/) - optional). 12 | 13 | ### Bill of material 14 | 15 | * [Raspberry Pi Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/) ([W](https://www.raspberrypi.org/products/raspberry-pi-zero-w/) - optional) 16 | * [OLED Display - 0.96" I2C IIC SPI Serial 128X64 OLED LCD Display SSD1306 for 51 STM32 Arduino](https://www.ebay.com/itm/0-96-I2C-IIC-SPI-Serial-128X64-OLED-LCD-Display-SSD1306-for-51-STM32-Arduino-/201688735605) 17 | * [MFRC-522 RC522 RFID Radiofrequency IC Card Inducing Sensor Reader for Arduino M5](https://www.ebay.com/itm/MFRC-522-RC522-RFID-Radiofrequency-IC-Card-Inducing-Sensor-Reader-for-Arduino-M5-/301723476083) 18 | * [Momentary Panel PCB Tactile Tact Push Button Switch 4Pin 6x6x4.5mm TS](https://www.ebay.com/itm/100Pcs-Momentary-Panel-PCB-Tactile-Tact-Push-Button-Switch-4Pin-6x6x4-5mm-TS-/172040053810?hash=item280e62e432) 19 | * [3mm LED Light White Yellow Red Green Assortment Kit for Arduino](https://www.ebay.com/itm/3mm-5mm-Assortment-LED-Diodes-Light-Emitting-Kit-Red-Green-Blue-Yellow-White-/153414025406) 20 | * [0.8mm 63/37 Tin Lead Rosin Core Solder Flux Soldering Welding Iron Wire Reel 14m](https://www.ebay.com/itm/0-8mm-63-37-Tin-Lead-Rosin-Core-Solder-Flux-Soldering-Welding-Iron-Wire-Reel-14m-/172519124561) 21 | * [AWG30 wrapping wire](https://www.ebay.com/itm/AWG30-Insulated-Wire-Wrapping-Wires-Reel-250M-White-P-N-B-30-1000-K4F8/263834804615) 22 | * [4 x M2x12 bolts/nuts](https://www.ebay.com/itm/480pcs-M2-M3-M4-Metric-Hex-Socket-Head-Cap-Screw-Bolts-Nuts-Assorted-Box-Kit-Set-/152695878844) 23 | * Soldering iron 24 | 25 | ## Firmware 26 | 27 | The OS is based on [Linux Kernel 4.14](https://github.com/torvalds/linux/commit/865ddc1393f558198e7e7ce70928ff2e49c4f7f6) for Raspberry Pi. 28 | 29 | The application is written in [Golang](https://golang.org/) with heavy use of [https://periph.io/](https://periph.io/) components for MFRC522 and OLED display. 30 | 31 | ### Building 32 | 33 | #### Requirements 34 | 35 | * [GNU Make](https://www.gnu.org/software/make/) 36 | * [Docker](https://www.docker.com/) 37 | 38 | #### Instructions 39 | 40 | The application consists of 2 components: 41 | 42 | * firmware 43 | * service 44 | * oled splash 45 | * web interface ( AngularJS ) 46 | 47 | 48 | ``` 49 | make all 50 | ``` 51 | will build the web interface, services and will invoke buildroot to produce the disk image in `dist/sdcard.img.gz` file. This file can be written onto a micro SD card as `dd if=dist/sdcard.img of=/dev/sda bs=1M` 52 | 53 | # Testing 54 | 55 | Plug PassKeeper into any USB port of the computer. PassKeeper will register itself and will be accessible at http://10.101.1.1/ -------------------------------------------------------------------------------- /buildroot/board/boot_overlay/cmdline.txt: -------------------------------------------------------------------------------- 1 | root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 elevator=noop 2 | -------------------------------------------------------------------------------- /buildroot/board/boot_overlay/config.txt: -------------------------------------------------------------------------------- 1 | # Please note that this is only a sample, we recommend you to change it to fit 2 | # your needs. 3 | # You should override this file using a post-build script. 4 | # See http://buildroot.org/manual.html#rootfs-custom 5 | # and http://elinux.org/RPiconfig for a description of config.txt syntax 6 | 7 | kernel=zImage 8 | 9 | # To use an external initramfs file 10 | #initramfs rootfs.cpio.gz 11 | 12 | # Disable overscan assuming the display supports displaying the full resolution 13 | # If the text shown on the screen disappears off the edge, comment this out 14 | disable_overscan=1 15 | 16 | # How much memory in MB to assign to the GPU on Pi models having 17 | # 256, 512 or 1024 MB total memory 18 | gpu_mem=64 19 | dtoverlay=dwc2,i2c-rtc,ds3231 20 | dtparam=i2c_arm=on 21 | dtparam=i2c_arm_baudrate=1000000 22 | dtparam=spi=on 23 | enable_uart=1 24 | -------------------------------------------------------------------------------- /buildroot/board/boot_overlay/overlays/dwc2.dtbo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdevelop/passkeeper/9f4f89d32d88c0b0e3dc074cbefc3204258801dd/buildroot/board/boot_overlay/overlays/dwc2.dtbo -------------------------------------------------------------------------------- /buildroot/board/genimage-board.cfg: -------------------------------------------------------------------------------- 1 | image boot.vfat { 2 | vfat { 3 | files = { 4 | "bcm2708-rpi-b-plus.dtb", 5 | "rpi-firmware/bootcode.bin", 6 | "../board/boot_overlay/cmdline.txt", 7 | "../board/boot_overlay/config.txt", 8 | "../board/boot_overlay/overlays", 9 | "rpi-firmware/fixup.dat", 10 | "rpi-firmware/start.elf", 11 | "zImage" 12 | } 13 | } 14 | size = 32M 15 | } 16 | 17 | image sdcard.img { 18 | hdimage { 19 | } 20 | 21 | partition boot { 22 | partition-type = 0xC 23 | bootable = "true" 24 | image = "boot.vfat" 25 | } 26 | 27 | partition rootfs { 28 | partition-type = 0x83 29 | image = "rootfs.ext4" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /buildroot/board/post-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -u 4 | set -e 5 | 6 | # Add a console on tty1 7 | if [ -e ${TARGET_DIR}/etc/inittab ]; then 8 | grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \ 9 | sed -i '/GENERIC_SERIAL/a\ 10 | tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console' ${TARGET_DIR}/etc/inittab 11 | fi 12 | -------------------------------------------------------------------------------- /buildroot/board/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | BOARD_DIR="$(dirname $0)" 6 | BOARD_NAME="$(basename ${BOARD_DIR})" 7 | GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg" 8 | GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" 9 | 10 | for arg in "$@" 11 | do 12 | case "${arg}" in 13 | --add-pi3-miniuart-bt-overlay) 14 | if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then 15 | echo "Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console)." 16 | cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" 17 | 18 | # fixes rpi3 ttyAMA0 serial console 19 | dtoverlay=pi3-miniuart-bt 20 | __EOF__ 21 | fi 22 | ;; 23 | --aarch64) 24 | # Run a 64bits kernel (armv8) 25 | sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt" 26 | if ! grep -qE '^arm_64bit=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then 27 | cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" 28 | 29 | # enable 64bits support 30 | arm_64bit=1 31 | __EOF__ 32 | fi 33 | 34 | # Enable uart console 35 | if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then 36 | cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt" 37 | 38 | # enable rpi3 ttyS0 serial console 39 | enable_uart=1 40 | __EOF__ 41 | fi 42 | ;; 43 | --gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*) 44 | # Set GPU memory 45 | gpu_mem="${arg:2}" 46 | sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt" 47 | ;; 48 | esac 49 | 50 | done 51 | 52 | rm -rf "${GENIMAGE_TMP}" 53 | 54 | genimage \ 55 | --rootpath "${TARGET_DIR}" \ 56 | --tmppath "${GENIMAGE_TMP}" \ 57 | --inputpath "${BINARIES_DIR}" \ 58 | --outputpath "${BINARIES_DIR}" \ 59 | --config "${GENIMAGE_CFG}" 60 | 61 | exit $? 62 | -------------------------------------------------------------------------------- /buildroot/board/rootfs_overlay/etc/init.d/S00atime: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device 4 | hwclock -s 5 | -------------------------------------------------------------------------------- /buildroot/board/rootfs_overlay/etc/mdev.conf: -------------------------------------------------------------------------------- 1 | # null may already exist; therefore ownership has to be changed with command 2 | null root:root 666 @chmod 666 $MDEV 3 | zero root:root 666 4 | full root:root 666 5 | random root:root 444 6 | urandom root:root 444 7 | hwrandom root:root 444 8 | grsec root:root 660 9 | 10 | kmem root:root 640 11 | mem root:root 640 12 | port root:root 640 13 | # console may already exist; therefore ownership has to be changed with command 14 | console root:tty 600 @chmod 600 $MDEV 15 | ptmx root:tty 666 16 | pty.* root:tty 660 17 | 18 | # Typical devices 19 | tty root:tty 666 20 | tty[0-9]* root:tty 660 21 | vcsa*[0-9]* root:tty 660 22 | ttyS[0-9]* root:root 660 23 | ttyUSB[0-9]* root:root 660 24 | 25 | # alsa sound devices 26 | snd/pcm.* root:audio 660 27 | snd/control.* root:audio 660 28 | snd/midi.* root:audio 660 29 | snd/seq root:audio 660 30 | snd/timer root:audio 660 31 | 32 | # Ethernet 33 | eth0 root:root 600 @/root/eth0.sh 34 | 35 | # input stuff 36 | input/event[0-9]+ root:root 640 37 | input/mice root:root 640 38 | input/mouse[0-9] root:root 640 39 | input/ts[0-9] root:root 600 40 | 41 | # load modules 42 | $MODALIAS=.* root:root 660 @modprobe "$MODALIAS" 43 | -------------------------------------------------------------------------------- /buildroot/board/rootfs_overlay/etc/ssh/sshd_config: -------------------------------------------------------------------------------- 1 | # $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ 2 | 3 | # This is the sshd server system-wide configuration file. See 4 | # sshd_config(5) for more information. 5 | 6 | # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin 7 | 8 | # The strategy used for options in the default sshd_config shipped with 9 | # OpenSSH is to specify options with their default value where 10 | # possible, but leave them commented. Uncommented options override the 11 | # default value. 12 | 13 | #Port 22 14 | #AddressFamily any 15 | #ListenAddress 0.0.0.0 16 | #ListenAddress :: 17 | 18 | #HostKey /etc/ssh/ssh_host_rsa_key 19 | #HostKey /etc/ssh/ssh_host_ecdsa_key 20 | #HostKey /etc/ssh/ssh_host_ed25519_key 21 | 22 | # Ciphers and keying 23 | #RekeyLimit default none 24 | 25 | # Logging 26 | #SyslogFacility AUTH 27 | #LogLevel INFO 28 | 29 | # Authentication: 30 | 31 | #LoginGraceTime 2m 32 | PermitRootLogin yes 33 | #StrictModes yes 34 | #MaxAuthTries 6 35 | #MaxSessions 10 36 | 37 | #PubkeyAuthentication yes 38 | 39 | # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 40 | # but this is overridden so installations will only check .ssh/authorized_keys 41 | AuthorizedKeysFile .ssh/authorized_keys 42 | 43 | #AuthorizedPrincipalsFile none 44 | 45 | #AuthorizedKeysCommand none 46 | #AuthorizedKeysCommandUser nobody 47 | 48 | # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts 49 | #HostbasedAuthentication no 50 | # Change to yes if you don't trust ~/.ssh/known_hosts for 51 | # HostbasedAuthentication 52 | #IgnoreUserKnownHosts no 53 | # Don't read the user's ~/.rhosts and ~/.shosts files 54 | #IgnoreRhosts yes 55 | 56 | # To disable tunneled clear text passwords, change to no here! 57 | #PasswordAuthentication yes 58 | #PermitEmptyPasswords no 59 | 60 | # Change to no to disable s/key passwords 61 | #ChallengeResponseAuthentication yes 62 | 63 | # Kerberos options 64 | #KerberosAuthentication no 65 | #KerberosOrLocalPasswd yes 66 | #KerberosTicketCleanup yes 67 | #KerberosGetAFSToken no 68 | 69 | # GSSAPI options 70 | #GSSAPIAuthentication no 71 | #GSSAPICleanupCredentials yes 72 | 73 | # Set this to 'yes' to enable PAM authentication, account processing, 74 | # and session processing. If this is enabled, PAM authentication will 75 | # be allowed through the ChallengeResponseAuthentication and 76 | # PasswordAuthentication. Depending on your PAM configuration, 77 | # PAM authentication via ChallengeResponseAuthentication may bypass 78 | # the setting of "PermitRootLogin without-password". 79 | # If you just want the PAM account and session checks to run without 80 | # PAM authentication, then enable this but set PasswordAuthentication 81 | # and ChallengeResponseAuthentication to 'no'. 82 | #UsePAM no 83 | 84 | #AllowAgentForwarding yes 85 | #AllowTcpForwarding yes 86 | #GatewayPorts no 87 | #X11Forwarding no 88 | #X11DisplayOffset 10 89 | #X11UseLocalhost yes 90 | #PermitTTY yes 91 | #PrintMotd yes 92 | #PrintLastLog yes 93 | #TCPKeepAlive yes 94 | #PermitUserEnvironment no 95 | #Compression delayed 96 | #ClientAliveInterval 0 97 | #ClientAliveCountMax 3 98 | #UseDNS no 99 | #PidFile /var/run/sshd.pid 100 | #MaxStartups 10:30:100 101 | #PermitTunnel no 102 | #ChrootDirectory none 103 | #VersionAddendum none 104 | 105 | # no default banner path 106 | #Banner none 107 | 108 | # override default of no subsystems 109 | Subsystem sftp /usr/libexec/sftp-server 110 | 111 | # Example of overriding settings on a per-user basis 112 | #Match User anoncvs 113 | # X11Forwarding no 114 | # AllowTcpForwarding no 115 | # PermitTTY no 116 | # ForceCommand cvs server 117 | -------------------------------------------------------------------------------- /buildroot/board/rootfs_overlay/root/eth0.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ifconfig eth0 up && udhcpc eth0 4 | -------------------------------------------------------------------------------- /buildroot/configs/passkeeper_defconfig: -------------------------------------------------------------------------------- 1 | BR2_arm=y 2 | BR2_arm1176jzf_s=y 3 | BR2_ARM_EABIHF=y 4 | 5 | # Linux headers same as kernel, a 4.14 series 6 | BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14=y 7 | 8 | BR2_TOOLCHAIN_BUILDROOT_CXX=y 9 | 10 | BR2_LINUX_KERNEL=y 11 | BR2_LINUX_KERNEL_CUSTOM_TARBALL=y 12 | BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,865ddc1393f558198e7e7ce70928ff2e49c4f7f6)/linux-865ddc1393f558198e7e7ce70928ff2e49c4f7f6.tar.gz" 13 | BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi" 14 | 15 | # Build the DTBs for A/B from the kernel sources: the zero is the same 16 | # as the A+ model, just in a different form-factor 17 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 18 | BR2_LINUX_KERNEL_INTREE_DTS_NAME="bcm2708-rpi-b-plus" 19 | 20 | BR2_PACKAGE_RPI_FIRMWARE=y 21 | BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS=y 22 | 23 | # Required tools to create the SD image 24 | BR2_PACKAGE_HOST_DOSFSTOOLS=y 25 | BR2_PACKAGE_HOST_GENIMAGE=y 26 | BR2_PACKAGE_HOST_MTOOLS=y 27 | 28 | # Filesystem / image 29 | BR2_TARGET_ROOTFS_EXT2=y 30 | BR2_TARGET_ROOTFS_EXT2_4=y 31 | # BR2_TARGET_ROOTFS_TAR is not set 32 | BR2_ROOTFS_POST_BUILD_SCRIPT="$(PASSKEEPER)/board/post-build.sh" 33 | BR2_ROOTFS_POST_IMAGE_SCRIPT="$(PASSKEEPER)/board/post-image.sh" 34 | -------------------------------------------------------------------------------- /dist/.keepme: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdevelop/passkeeper/9f4f89d32d88c0b0e3dc074cbefc3204258801dd/dist/.keepme -------------------------------------------------------------------------------- /firmware/Makefile: -------------------------------------------------------------------------------- 1 | STRIP=-ldflags '-s -w' 2 | TOS ?= linux 3 | TARCH ?= arm 4 | 5 | OSBUILD=GOOS=${TOS} GOARCH=${TARCH} CGOENABLED=0 6 | OUT=/dist 7 | EXECS=service util splash 8 | 9 | PHONY: packr packr-dep 10 | 11 | all: packr upx 12 | 13 | packr: packr-dep 14 | packr -v 15 | 16 | ${OUT}/service: 17 | ${OSBUILD} go build ${STRIP} -o ${OUT}/service app/service/*.go 18 | 19 | ${OUT}/util: 20 | ${OSBUILD} go build ${STRIP} -o ${OUT}/util app/util/*.go 21 | 22 | ${OUT}/splash: 23 | ${OSBUILD} go build ${STRIP} -o ${OUT}/splash app/splash/*.go 24 | 25 | packr-dep: 26 | go get -u github.com/gobuffalo/packr/packr 27 | go mod tidy 28 | 29 | upx: ${OUT}/service ${OUT}/util ${OUT}/splash 30 | upx ${OUT}/service 31 | upx ${OUT}/util 32 | upx ${OUT}/splash 33 | 34 | clean: packr-dep 35 | packr clean 36 | rm -f $(addprefix $(OUT)/, $(EXECS)) 37 | -------------------------------------------------------------------------------- /firmware/app/service/service.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | "log" 7 | "os" 8 | "time" 9 | 10 | "github.com/jdevelop/passkeeper/firmware" 11 | "github.com/jdevelop/passkeeper/firmware/app/service/support" 12 | "github.com/jdevelop/passkeeper/firmware/config" 13 | "github.com/jdevelop/passkeeper/firmware/controls/status" 14 | "github.com/jdevelop/passkeeper/firmware/device/rpi" 15 | "github.com/jdevelop/passkeeper/firmware/device/rpi/display" 16 | "github.com/jdevelop/passkeeper/firmware/device/rpi/display/lcd" 17 | "github.com/jdevelop/passkeeper/firmware/device/rpi/display/oled" 18 | "github.com/jdevelop/passkeeper/firmware/pass" 19 | "github.com/jdevelop/passkeeper/firmware/rest" 20 | "github.com/jdevelop/passkeeper/firmware/storage" 21 | kingpin "gopkg.in/alecthomas/kingpin.v2" 22 | "periph.io/x/periph/host" 23 | ) 24 | 25 | var ( 26 | cli = kingpin.New("service", "Passkeeper") 27 | configPath = cli.Flag("config", "Config path").Short('c').String() 28 | displayType = cli.Flag("display", "Display").Short('d').Default("oled").Enum("lcd", "oled") 29 | ) 30 | 31 | var currentSeedID = 0 32 | 33 | var currentSeeds []firmware.Credentials 34 | 35 | func main() { 36 | 37 | _, err := cli.Parse(os.Args[1:]) 38 | if err != nil { 39 | log.Fatal(err) 40 | } 41 | 42 | c, err := config.LoadConfig(*configPath) 43 | 44 | if err != nil { 45 | log.Fatal(err) 46 | } 47 | 48 | if _, err = host.Init(); err != nil { 49 | log.Fatal(err) 50 | } 51 | 52 | var hwDisplay display.HardwareDisplay 53 | var lines int 54 | 55 | switch *displayType { 56 | case "lcd": 57 | hwDisplay, err = lcd.MakeLCDDisplay(c.LCD.DataPins, c.LCD.EPin, c.LCD.RsPin) 58 | if err != nil { 59 | log.Fatal(err) 60 | } 61 | lines = 2 62 | case "oled": 63 | dsp, err := oled.NewOLED(c.OLED.BusId, c.OLED.DevId, c.OLED.Width, c.OLED.Height) 64 | hwDisplay = dsp 65 | if err != nil { 66 | log.Fatal(err) 67 | } 68 | lines = 5 69 | } 70 | 71 | db := support.MakeDashboard(hwDisplay, lines) 72 | 73 | db.Log("Init...") 74 | 75 | raspberry, err := rpi.CreateBoard(rpi.Board{ 76 | Led: rpi.LedSettings(c.Leds.Standby, c.Leds.Error, c.Leds.Ready), 77 | Control: rpi.ControlSettings(c.Keys.Send, c.Keys.Up, c.Keys.Down), 78 | }) 79 | 80 | if err != nil { 81 | db.Log("Can't create board") 82 | log.Fatal(err) 83 | } 84 | 85 | db.Log("Selfcheck") 86 | raspberry.SelfCheckInprogress() 87 | 88 | if err != nil { 89 | db.Log("Hardware failure") 90 | log.Fatal(err) 91 | } 92 | 93 | drv, err := rpi.InitLinuxStack(rpi.StackParams{HasSerial: true, HasEthernet: true}) 94 | if err != nil { 95 | log.Fatal(err) 96 | db.Log("Kbd/net failure") 97 | raspberry.SelfCheckFailure(err) 98 | } 99 | 100 | pinsConf := make([]pass.PinConfF, 0) 101 | if c.Rfid.RfidIRQPin != "" { 102 | db.Log("Using RFID IRQ pin " + c.Rfid.RfidIRQPin) 103 | pinsConf = append(pinsConf, pass.WithIRQPin(c.Rfid.RfidIRQPin)) 104 | } 105 | if c.Rfid.RfidResetPin != "" { 106 | db.Log("Using RFID reset pin " + c.Rfid.RfidResetPin) 107 | pinsConf = append(pinsConf, pass.WithResetPin(c.Rfid.RfidResetPin)) 108 | } 109 | 110 | rfid, err := pass.NewRFIDPass(c.Rfid.RfidAccessKey, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock, pinsConf...) 111 | if err != nil { 112 | db.Log("RFID failure") 113 | raspberry.SelfCheckFailure(err) 114 | log.Fatal(err) 115 | } 116 | 117 | var passwd []byte 118 | 119 | for { 120 | db.Log("Tap the RFID") 121 | passwd, err = GetCurrentPassword(rfid, raspberry) 122 | 123 | if err != nil { 124 | db.Log("Key failed, retry") 125 | raspberry.SelfCheckFailure(err) 126 | fmt.Println("Error reading card, retrying", err) 127 | time.Sleep(1 * time.Second) 128 | raspberry.SelfCheckInprogress() 129 | } else { 130 | break 131 | } 132 | } 133 | 134 | db.Log("Storage open") 135 | 136 | raspberry.ReadyToTransmit() 137 | 138 | seedStorage, err := getStorage(c.Passwords.PasswordFile, passwd) 139 | 140 | if err != nil { 141 | db.Log("Storage failed") 142 | log.Fatal(err) 143 | } 144 | 145 | currentSeeds, err = seedStorage.ListCredentials() 146 | if err != nil { 147 | db.Log("Seed failed") 148 | log.Fatal(err) 149 | } 150 | 151 | lastCall := time.Now() 152 | lastUp := time.Now() 153 | lastDown := time.Now() 154 | 155 | checkTime := func(timeVar *time.Time) bool { 156 | if time.Since(*timeVar) < 500*time.Millisecond { 157 | return false 158 | } 159 | *timeVar = time.Now() 160 | return true 161 | } 162 | 163 | textDisplay := display.MakeTextDisplay(hwDisplay, ¤tSeeds, lines) 164 | if err != nil { 165 | log.Fatal(err) 166 | } 167 | 168 | cf := support.ControlsStub{ 169 | SendFunc: func() { 170 | if !checkTime(&lastCall) { 171 | return 172 | } 173 | raspberry.ReadyToTransmit() 174 | seeds, err := seedStorage.ListCredentials() 175 | if err != nil { 176 | return 177 | } 178 | seedSize := len(seeds) 179 | if seedSize == 0 { 180 | err = errors.New("No seed") 181 | db.Log("No seed") 182 | raspberry.TransmissionFailure(err) 183 | return 184 | } 185 | if currentSeedID >= seedSize { 186 | currentSeedID = seedSize - 1 187 | } 188 | if currentSeedID < 0 { 189 | currentSeedID = 0 190 | } 191 | seed, err := seedStorage.ReadCredentials(seeds[currentSeedID].Id) 192 | if err != nil { 193 | db.Log("Storage failed") 194 | raspberry.TransmissionFailure(err) 195 | return 196 | } 197 | err = drv.WriteString(seed.Secret) 198 | if err != nil { 199 | db.Log("Keyboard failed") 200 | raspberry.TransmissionFailure(err) 201 | return 202 | } 203 | err = raspberry.TransmissionComplete() 204 | return 205 | }, 206 | UpFunc: func() { 207 | if !checkTime(&lastUp) { 208 | return 209 | } 210 | fmt.Println("Up") 211 | currentSeedID = currentSeedID - 1 212 | textDisplay.ScrollUp(1) 213 | }, 214 | DownFunc: func() { 215 | if !checkTime(&lastDown) { 216 | return 217 | } 218 | fmt.Println("Down") 219 | currentSeedID = currentSeedID + 1 220 | textDisplay.ScrollDown(1) 221 | }, 222 | } 223 | 224 | raspberry.InputControl = &cf 225 | 226 | db.Log("Web started") 227 | 228 | time.AfterFunc(2*time.Second, func() { 229 | textDisplay.Refresh() 230 | }) 231 | 232 | rest.Start("0.0.0.0", 80, seedStorage, pass.NewPasswordGenerator(12), 233 | func(newKey []byte) error { 234 | return rfid.ResetPassword(newKey, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 235 | }, 236 | func() { 237 | currentSeedID = 0 238 | currentSeeds, err = seedStorage.ListCredentials() 239 | textDisplay.Refresh() 240 | }) 241 | } 242 | 243 | func GetCurrentPassword(provider pass.PasswordProvider, board status.StatusControl) ([]byte, error) { 244 | pwd, err := provider.GetCurrentPassword() 245 | if err != nil { 246 | board.SelfCheckFailure(err) 247 | return nil, err 248 | } 249 | return pwd, nil 250 | } 251 | 252 | func getStorage(filename string, pwd []byte) (*storage.PlainText, error) { 253 | return storage.NewPlainText(filename, pwd) 254 | } 255 | -------------------------------------------------------------------------------- /firmware/app/service/support/controlPanel.go: -------------------------------------------------------------------------------- 1 | package support 2 | 3 | type ControlsStub struct { 4 | UpFunc func() 5 | DownFunc func() 6 | SendFunc func() 7 | } 8 | 9 | func (f *ControlsStub) OnClickUp() { 10 | if f.UpFunc != nil { 11 | f.UpFunc() 12 | } 13 | return 14 | } 15 | 16 | func (f *ControlsStub) OnClickDown() { 17 | if f.DownFunc != nil { 18 | f.DownFunc() 19 | } 20 | return 21 | } 22 | 23 | func (f *ControlsStub) OnClickOk() { 24 | if f.SendFunc != nil { 25 | f.SendFunc() 26 | } 27 | return 28 | } 29 | -------------------------------------------------------------------------------- /firmware/app/service/support/dashboard.go: -------------------------------------------------------------------------------- 1 | package support 2 | 3 | import ( 4 | "fmt" 5 | "github.com/jdevelop/passkeeper/firmware/device/rpi/display" 6 | ) 7 | 8 | type dashboard struct { 9 | d display.HardwareDisplay 10 | idx int 11 | data []string 12 | height int 13 | } 14 | 15 | func (d *dashboard) Log(msg string) { 16 | d.d.Cls() 17 | if d.idx == d.height { 18 | d.data = d.data[1:] 19 | d.data = append(d.data, msg) 20 | } else { 21 | d.data[d.idx] = msg 22 | d.idx = d.idx + 1 23 | } 24 | if d.d != nil { 25 | for i, m := range d.data { 26 | d.d.SetCursor(uint8(i), 0) 27 | d.d.Print(m) 28 | } 29 | } 30 | d.d.Draw() 31 | fmt.Println(msg) 32 | } 33 | 34 | func MakeDashboard(d display.HardwareDisplay, height int) (db *dashboard) { 35 | db = &dashboard{ 36 | d: d, 37 | data: make([]string, height), 38 | idx: 0, 39 | } 40 | return 41 | } 42 | -------------------------------------------------------------------------------- /firmware/app/splash/image/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdevelop/passkeeper/9f4f89d32d88c0b0e3dc074cbefc3204258801dd/firmware/app/splash/image/splash.png -------------------------------------------------------------------------------- /firmware/app/splash/splash.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "image" 6 | "image/draw" 7 | "image/png" 8 | "log" 9 | 10 | "github.com/gobuffalo/packr" 11 | "periph.io/x/periph/conn/i2c/i2creg" 12 | "periph.io/x/periph/devices/ssd1306" 13 | "periph.io/x/periph/devices/ssd1306/image1bit" 14 | "periph.io/x/periph/host" 15 | ) 16 | 17 | const ( 18 | w = 128 19 | h = 64 20 | ) 21 | 22 | var rect = image.Rect(0, 0, w, h) 23 | 24 | func main() { 25 | // Load all the drivers: 26 | if _, err := host.Init(); err != nil { 27 | log.Fatal(err) 28 | } 29 | 30 | // Open a handle to the first available I²C bus: 31 | bus, err := i2creg.Open("") 32 | if err != nil { 33 | log.Fatal(err) 34 | } 35 | 36 | // Open a handle to a ssd1306 connected on the I²C bus: 37 | dev, err := ssd1306.NewI2C(bus, &ssd1306.Opts{ 38 | W: w, 39 | H: h, 40 | Rotated: false, 41 | }) 42 | if err != nil { 43 | log.Fatal(err) 44 | } 45 | 46 | box := packr.NewBox("./image") 47 | 48 | data, err := box.Find("splash.png") 49 | if err != nil { 50 | log.Fatal(err) 51 | } 52 | 53 | img, err := png.Decode(bytes.NewReader(data)) 54 | if err != nil { 55 | log.Fatal(err) 56 | } 57 | 58 | imgbw := image1bit.NewVerticalLSB(rect) 59 | draw.Draw(imgbw, rect, img, image.Point{}, draw.Src) 60 | 61 | err = dev.Draw(rect, imgbw, image.Point{}) 62 | if err != nil { 63 | log.Fatal(err) 64 | } 65 | log.Println("Done") 66 | 67 | bus.Close() 68 | 69 | } 70 | -------------------------------------------------------------------------------- /firmware/app/util/util.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bufio" 5 | "fmt" 6 | "log" 7 | "os" 8 | "syscall" 9 | 10 | "github.com/google/uuid" 11 | "github.com/jdevelop/passkeeper/firmware" 12 | "github.com/jdevelop/passkeeper/firmware/config" 13 | "github.com/jdevelop/passkeeper/firmware/device/rpi" 14 | "github.com/jdevelop/passkeeper/firmware/pass" 15 | "github.com/jdevelop/passkeeper/firmware/storage" 16 | "golang.org/x/crypto/ssh/terminal" 17 | "gopkg.in/alecthomas/kingpin.v2" 18 | "periph.io/x/periph/host" 19 | ) 20 | 21 | var ( 22 | cli = kingpin.New("util", "The utility application for password management") 23 | 24 | mode = cli.Flag("mode", "Storage password source (card or manual entry)"). 25 | Default("card").Enum("term", "card") 26 | 27 | configPath = cli.Flag("config", "Path to the config file").String() 28 | 29 | listCmd = cli.Command("list", "List available passwords") 30 | 31 | addCmd = cli.Command("add", "Add new password") 32 | 33 | delCmd = cli.Command("remove", "Remove password by ID") 34 | passwordId = delCmd.Arg("id", "Password id").Required().String() 35 | 36 | echoCmd = cli.Command("echo", "Echo string to keyboard") 37 | echoString = echoCmd.Arg("text", "Text to echo").Required().String() 38 | 39 | resetCard = cli.Command("reset_card", "Resets the card access") 40 | resetPassword = cli.Command("reset_password", "Resets the storage password") 41 | showPassword = cli.Command("show_password", "Displays the current storage password") 42 | ) 43 | 44 | func main() { 45 | 46 | cmdAlias, err := cli.Parse(os.Args[1:]) 47 | 48 | if err != nil { 49 | log.Fatal(err) 50 | } 51 | 52 | var ( 53 | cardPassword []byte 54 | cardAccess [6]byte 55 | ) 56 | 57 | c, err := config.LoadConfig(*configPath) 58 | if err != nil { 59 | log.Fatal(err) 60 | } 61 | 62 | readTerminalPwd := func() (pwd []byte, err error) { 63 | fmt.Print("Password >: ") 64 | pwd, err = terminal.ReadPassword(syscall.Stdin) 65 | return 66 | } 67 | 68 | if _, err := host.Init(); err != nil { 69 | log.Fatal(err) 70 | } 71 | 72 | openStorage := func() *storage.PlainText { 73 | 74 | switch *mode { 75 | case "term": 76 | pwdRaw, err := readTerminalPwd() 77 | if err != nil { 78 | log.Fatal(err) 79 | } 80 | cardPassword = storage.BuildKey(pwdRaw) 81 | case "card": 82 | rfid, err := pass.NewRFIDPass(c.Rfid.RfidAccessKey, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 83 | if err != nil { 84 | log.Fatal(err) 85 | } 86 | fmt.Println("Tap the card") 87 | cardPassword, err = rfid.GetCurrentPassword() 88 | if err != nil { 89 | log.Fatal(err) 90 | } 91 | fmt.Println("Password read successfully") 92 | } 93 | 94 | strg, err := storage.NewPlainText(c.Passwords.PasswordFile, cardPassword) 95 | if err != nil { 96 | log.Fatal(err) 97 | } 98 | return strg 99 | } 100 | 101 | switch cmdAlias { 102 | case listCmd.FullCommand(): 103 | strg := openStorage() 104 | seeds, err := strg.ListCredentials() 105 | if err != nil { 106 | log.Fatal(err) 107 | } 108 | fmt.Println("Seeds:") 109 | for _, seed := range seeds { 110 | fmt.Println("\t", seed) 111 | } 112 | case addCmd.FullCommand(): 113 | strg := openStorage() 114 | fmt.Println("Seed name:") 115 | rdr := bufio.NewReader(os.Stdin) 116 | seedName, _, err := rdr.ReadLine() 117 | if err != nil { 118 | log.Fatal(err) 119 | } 120 | fmt.Println("Seed:") 121 | password, err := terminal.ReadPassword(syscall.Stdin) 122 | if err != nil { 123 | log.Fatal(err) 124 | } 125 | fmt.Println("Confirm seed:") 126 | confirm, err := terminal.ReadPassword(syscall.Stdin) 127 | if err != nil { 128 | log.Fatal(err) 129 | } 130 | if string(password) != string(confirm) { 131 | log.Fatalln("Seeds do not match, aborting") 132 | } 133 | err = strg.WriteCredentials(firmware.Credentials{ 134 | Id: uuid.New().String(), 135 | Service: string(seedName), 136 | Secret: string(password), 137 | }) 138 | if err != nil { 139 | log.Fatal(err) 140 | } 141 | err = strg.Close() 142 | if err != nil { 143 | log.Fatal(err) 144 | } 145 | 146 | case resetCard.FullCommand(): 147 | pwdRaw, err := readTerminalPwd() 148 | if err != nil { 149 | log.Fatal(err) 150 | } 151 | copy(cardAccess[:], storage.BuildKey(pwdRaw)[:6]) 152 | fmt.Println("Opening card") 153 | rfid, err := pass.NewRFIDPass(c.Rfid.RfidAccessKey, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 154 | if err != nil { 155 | log.Fatal(err) 156 | } 157 | 158 | fmt.Println("Tap the card to reset the card key") 159 | if err = rfid.ResetAccessKey(cardAccess, c.Rfid.RfidAccessSector); err != nil { 160 | log.Fatal(err) 161 | } 162 | copy(c.Rfid.RfidAccessKey[:], cardAccess[:]) 163 | err = config.SaveConfig(*configPath, &c) 164 | if err != nil { 165 | log.Fatal(err) 166 | } 167 | fmt.Printf("Access key updated successfully: %v\n", cardAccess) 168 | if err := rfid.Close(); err != nil { 169 | log.Fatal(err) 170 | } 171 | 172 | case resetPassword.FullCommand(): 173 | pwdRaw, err := readTerminalPwd() 174 | if err != nil { 175 | log.Fatal(err) 176 | } 177 | 178 | cardPassword = storage.BuildKey(pwdRaw) 179 | 180 | fmt.Println("Initializing card") 181 | 182 | rfid, err := pass.NewRFIDPass(c.Rfid.RfidAccessKey, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 183 | if err != nil { 184 | log.Fatal(err) 185 | } 186 | err = rfid.ResetPassword(cardPassword, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 187 | if err != nil { 188 | log.Fatal(err) 189 | } 190 | fmt.Println("Password updated successfully") 191 | if err := rfid.Close(); err != nil { 192 | log.Fatal(err) 193 | } 194 | 195 | case showPassword.FullCommand(): 196 | fmt.Printf("Initializing card: sector %d, block: %d\n", c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 197 | rfid, err := pass.NewRFIDPass(c.Rfid.RfidAccessKey, c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock) 198 | if err != nil { 199 | log.Fatal(err) 200 | } 201 | fmt.Printf("Reading current password using sector %d, block %d, keys: %v\n", c.Rfid.RfidAccessSector, c.Rfid.RfidAccessBlock, c.Rfid.RfidAccessKey) 202 | pwdBytes, err := rfid.GetCurrentPassword() 203 | if err != nil { 204 | log.Fatal(err) 205 | } 206 | fmt.Println("Current password bytes are ", pwdBytes) 207 | if err := rfid.Close(); err != nil { 208 | log.Fatal(err) 209 | } 210 | 211 | case delCmd.FullCommand(): 212 | strg := openStorage() 213 | if err := strg.RemoveCredentials(*passwordId); err != nil { 214 | log.Fatal(err) 215 | } 216 | 217 | case echoCmd.FullCommand(): 218 | board, err := rpi.InitLinuxStack(rpi.StackParams{HasEthernet: true, HasSerial: true}) 219 | if err != nil { 220 | log.Fatal(err) 221 | } 222 | if err := board.WriteString(*echoString); err != nil { 223 | log.Fatal(err) 224 | } 225 | default: 226 | cli.Usage(nil) 227 | return 228 | } 229 | 230 | fmt.Println("Done!") 231 | 232 | } 233 | -------------------------------------------------------------------------------- /firmware/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io/ioutil" 7 | "os/user" 8 | "time" 9 | 10 | "github.com/pkg/errors" 11 | ) 12 | 13 | type leds struct { 14 | Error int `json:"error"` 15 | Standby int `json:"standby"` 16 | Ready int `json:"ready"` 17 | } 18 | 19 | type keys struct { 20 | Send int `json:"key_send"` 21 | Up int `json:"key_up"` 22 | Down int `json:"key_down"` 23 | } 24 | 25 | type passwords struct { 26 | PasswordFile string `json:"file"` 27 | } 28 | 29 | type rfid struct { 30 | RfidIRQPin string `json:"irq_pin,omitempty"` 31 | RfidResetPin string `json:"reset_pin,omitempty"` 32 | RfidAccessKey [6]byte `json:"access_key,omitempty"` 33 | RfidAccessSector int `json:"access_sector,omitempty"` 34 | RfidAccessBlock int `json:"access_block,omitempty"` 35 | } 36 | 37 | type lcd struct { 38 | DataPins []int `json:"data,omitempty"` 39 | RsPin int `json:"rs_pin,omitempty"` 40 | EPin int `json:"e_pin,omitempty"` 41 | } 42 | 43 | type oled struct { 44 | BusId int `json:"bus_id,omitempty"` 45 | DevId int `json:"dev_id,omitempty"` 46 | Width int `json:"width,omitempty"` 47 | Height int `json:"height,omitempty"` 48 | } 49 | 50 | type Config struct { 51 | Leds leds `json:"leds"` 52 | Keys keys `json:"keys"` 53 | Passwords passwords `json:"passwords"` 54 | Rfid rfid `json:"rfid"` 55 | LCD lcd `json:"lcd"` 56 | OLED oled `json:"oled"` 57 | } 58 | 59 | var DefaultConfig = Config{ 60 | Leds: leds{ 61 | Error: 19, 62 | Standby: 20, 63 | Ready: 21, 64 | }, 65 | Keys: keys{ 66 | Send: 18, 67 | Down: 5, 68 | Up: 6, 69 | }, 70 | Passwords: passwords{ 71 | PasswordFile: "/root/passwordstorage.enc", 72 | }, 73 | Rfid: rfid{ 74 | RfidIRQPin: "17", 75 | RfidResetPin: "27", 76 | RfidAccessBlock: 1, 77 | RfidAccessSector: 1, 78 | RfidAccessKey: [...]byte{1, 2, 3, 4, 5, 6}, 79 | }, 80 | LCD: lcd{ 81 | DataPins: []int{25, 24, 23, 22}, 82 | EPin: 27, 83 | RsPin: 26, 84 | }, 85 | OLED: oled{ 86 | BusId: 1, 87 | DevId: 60, 88 | Width: 128, 89 | Height: 64, 90 | }, 91 | } 92 | 93 | func resolveConfig(path string) (confPath string, err error) { 94 | if path == "" { 95 | u, errU := user.Current() 96 | if errU != nil { 97 | err = errU 98 | return 99 | } 100 | confPath = fmt.Sprintf("%s/.seedkeeper", u.HomeDir) 101 | } else { 102 | confPath = path 103 | } 104 | return 105 | } 106 | 107 | func LoadConfig(cfg string) (c Config, err error) { 108 | var jsonData []byte 109 | path, err := resolveConfig(cfg) 110 | if err != nil { 111 | return 112 | } 113 | jsonData, err = ioutil.ReadFile(path) 114 | if err != nil { 115 | return 116 | } 117 | 118 | c = DefaultConfig 119 | 120 | err = json.Unmarshal(jsonData, &c) 121 | 122 | return 123 | } 124 | 125 | func SaveConfig(cfg string, c *Config) (err error) { 126 | jsonData, err := json.Marshal(&c) 127 | if err != nil { 128 | return 129 | } 130 | path, err := resolveConfig(cfg) 131 | if err != nil { 132 | return 133 | } 134 | newName := fmt.Sprintf("%s.%d", path, time.Now().Unix()) 135 | 136 | oldConf, err := ioutil.ReadFile(path) 137 | if err != nil { 138 | err = errors.Wrap(err, "Can't read the config file at "+path) 139 | return 140 | } 141 | err = ioutil.WriteFile(path, jsonData, 0600) 142 | if err != nil { 143 | err = errors.Wrap(err, "Can't write config file at "+path) 144 | return 145 | } 146 | 147 | err = ioutil.WriteFile(newName, oldConf, 0600) 148 | if err != nil { 149 | err = errors.Wrap(err, "Can't write backup config file at "+newName) 150 | return 151 | } 152 | return 153 | } 154 | -------------------------------------------------------------------------------- /firmware/config/config_test.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "os" 5 | "reflect" 6 | "testing" 7 | ) 8 | 9 | const confPath = "/tmp/goseed-test" 10 | 11 | var newKey = [...]byte{0, 1, 0, 1, 0, 1} 12 | 13 | func TestConfigLoad(t *testing.T) { 14 | f, err := os.Create(confPath) 15 | if err != nil { 16 | t.Error(err) 17 | } 18 | defer f.Close() 19 | if _, err := f.WriteString("{}"); err != nil { 20 | t.Error(err) 21 | } 22 | 23 | c, err := LoadConfig(confPath) 24 | if err != nil { 25 | t.Error(err) 26 | } 27 | 28 | c.Rfid.RfidAccessBlock = 100500 29 | c.Rfid.RfidAccessSector = 100501 30 | c.Rfid.RfidAccessKey = newKey 31 | if err = SaveConfig(confPath, &c); err != nil { 32 | t.Error(err) 33 | } 34 | 35 | c, err = LoadConfig(confPath) 36 | 37 | if c.Rfid.RfidAccessBlock != 100500 { 38 | t.Errorf("Expected access block 100500, was %d", c.Rfid.RfidAccessBlock) 39 | } 40 | 41 | if c.Rfid.RfidAccessSector != 100501 { 42 | t.Errorf("Expected access sector 100501, was %d", c.Rfid.RfidAccessSector) 43 | } 44 | 45 | if !reflect.DeepEqual(c.Rfid.RfidAccessKey, newKey) { 46 | t.Errorf("Keys are not equal: %v != %v", c.Rfid.RfidAccessKey, newKey) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /firmware/controls/display/display.go: -------------------------------------------------------------------------------- 1 | package display 2 | 3 | type DisplayControl interface { 4 | Refresh() 5 | ScrollUp(lines int) 6 | ScrollDown(lines int) 7 | } 8 | -------------------------------------------------------------------------------- /firmware/controls/input/input.go: -------------------------------------------------------------------------------- 1 | package input 2 | 3 | type InputControl interface { 4 | OnClickUp() 5 | OnClickDown() 6 | OnClickOk() 7 | } 8 | -------------------------------------------------------------------------------- /firmware/controls/keyboard/keyboard.go: -------------------------------------------------------------------------------- 1 | package keyboard 2 | 3 | // Keyboard defines the methods to use for writing the character to the keyboard. 4 | type Keyboard interface { 5 | WriteString(content string) (err error) 6 | } 7 | -------------------------------------------------------------------------------- /firmware/controls/status/status.go: -------------------------------------------------------------------------------- 1 | package status 2 | 3 | type StatusControl interface { 4 | SelfCheckInprogress() error 5 | SelfCheckComplete() error 6 | SelfCheckFailure(reason error) error 7 | ReadyToTransmit() error 8 | TransmissionComplete() error 9 | TransmissionFailure(reason error) error 10 | } 11 | -------------------------------------------------------------------------------- /firmware/device/rpi/display/display.go: -------------------------------------------------------------------------------- 1 | package display 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/jdevelop/passkeeper/firmware" 7 | ) 8 | 9 | type HardwareDisplay interface { 10 | Cls() 11 | SetCursor(column, row uint8) 12 | Print(message string) 13 | Draw() 14 | } 15 | 16 | type TextBlockDisplay struct { 17 | realDisplay HardwareDisplay 18 | content *[]firmware.Credentials 19 | offset int 20 | screenHeight int 21 | } 22 | 23 | func MakeTextDisplay(hw HardwareDisplay, content *[]firmware.Credentials, height int) *TextBlockDisplay { 24 | return &TextBlockDisplay{ 25 | realDisplay: hw, 26 | content: content, 27 | offset: 0, 28 | screenHeight: height, 29 | } 30 | } 31 | 32 | func (d *TextBlockDisplay) Refresh() { 33 | cLen := len(*d.content) 34 | d.realDisplay.Cls() 35 | if d.content == nil && cLen == 0 { 36 | fmt.Println("Content empty!") 37 | d.realDisplay.SetCursor(0, 0) 38 | d.realDisplay.Print("No keys found") 39 | return 40 | } 41 | 42 | windowTop := d.offset 43 | windowBottom := d.offset + d.screenHeight - 1 44 | 45 | if windowBottom >= cLen { 46 | windowBottom = cLen - 1 47 | windowTop = cLen - d.screenHeight 48 | } 49 | 50 | if windowTop < 0 { 51 | windowTop = 0 52 | } 53 | 54 | for i := 0; windowTop+i <= windowBottom; i++ { 55 | d.realDisplay.SetCursor(uint8(i), 0) 56 | d.realDisplay.Print(" " + (*d.content)[windowTop+i].Service) 57 | } 58 | d.realDisplay.SetCursor(uint8(d.offset-windowTop), 0) 59 | d.realDisplay.Print(">") 60 | d.realDisplay.Draw() 61 | } 62 | 63 | func (d *TextBlockDisplay) ScrollUp(lines int) { 64 | d.offset = d.offset - lines 65 | if d.offset < 0 { 66 | d.offset = 0 67 | } 68 | d.Refresh() 69 | } 70 | 71 | func (d *TextBlockDisplay) ScrollDown(lines int) { 72 | d.offset = d.offset + lines 73 | if d.content != nil && d.offset >= len(*d.content) { 74 | d.offset = len(*d.content) - 1 // last item selected 75 | } 76 | if d.offset < 0 { 77 | d.offset = 0 78 | } 79 | d.Refresh() 80 | } 81 | -------------------------------------------------------------------------------- /firmware/device/rpi/display/lcd/display.go: -------------------------------------------------------------------------------- 1 | package lcd 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/jdevelop/passkeeper/firmware/device/rpi/display" 7 | "periph.io/x/periph/conn/gpio" 8 | "periph.io/x/periph/conn/gpio/gpioreg" 9 | "periph.io/x/periph/experimental/devices/hd44780" 10 | ) 11 | 12 | type Display struct { 13 | dev *hd44780.Dev 14 | } 15 | 16 | func (d *Display) Cls() { 17 | d.dev.Reset() 18 | } 19 | 20 | func (d *Display) SetCursor(column uint8, row uint8) { 21 | d.dev.SetCursor(column, row) 22 | } 23 | 24 | func (d *Display) Print(message string) { 25 | d.dev.Print(message) 26 | } 27 | 28 | func (d *Display) Draw() { 29 | } 30 | 31 | func outPin(pin int) gpio.PinOut { 32 | return gpioreg.ByName(fmt.Sprintf("%d", pin)) 33 | } 34 | 35 | func MakeLCDDisplay(dataPins []int, ePin, rsPin int) (*Display, error) { 36 | data := make([]gpio.PinOut, len(dataPins)) 37 | for i := range dataPins { 38 | out := outPin(dataPins[i]) 39 | if out == nil { 40 | return nil, wrapf("can't create out pin %d") 41 | } 42 | } 43 | ePinOut := outPin(ePin) 44 | if ePinOut == nil { 45 | return nil, wrapf("can't create e-pin %d", ePin) 46 | } 47 | rsPinOut := outPin(rsPin) 48 | if rsPinOut == nil { 49 | return nil, wrapf("can't create rs-pin %d", ePin) 50 | } 51 | disp, err := hd44780.New(data, rsPinOut, ePinOut) 52 | if err != nil { 53 | return nil, err 54 | } 55 | fmt.Printf("Init display: data %v, e: %v, rs: %v\n", dataPins, ePin, rsPin) 56 | if err := disp.Reset(); err != nil { 57 | return nil, wrapf("can't init LCD display %v", err) 58 | } 59 | return &Display{ 60 | disp, 61 | }, nil 62 | } 63 | 64 | var _ display.HardwareDisplay = &Display{} 65 | 66 | func wrapf(msg string, args ...interface{}) error { 67 | return fmt.Errorf(msg, args...) 68 | } 69 | -------------------------------------------------------------------------------- /firmware/device/rpi/display/oled/display.go: -------------------------------------------------------------------------------- 1 | package oled 2 | 3 | import ( 4 | "image" 5 | "image/color" 6 | 7 | "github.com/fogleman/gg" 8 | "golang.org/x/image/font/basicfont" 9 | "periph.io/x/periph/conn/i2c/i2creg" 10 | "periph.io/x/periph/devices/ssd1306" 11 | ) 12 | 13 | var defaultFace = basicfont.Face7x13 14 | 15 | type OLED struct { 16 | *ssd1306.Dev 17 | textCol, textRow int 18 | ctx *gg.Context 19 | } 20 | 21 | var ( 22 | defaultRect = image.Rect(0, 0, 128, 64) 23 | upperLeft = image.Point{} 24 | ) 25 | 26 | func NewOLED(bus, device, width, height int) (o *OLED, err error) { 27 | 28 | dev, err := i2creg.Open("") 29 | if err != nil { 30 | return 31 | } 32 | 33 | oled, err := ssd1306.NewI2C(dev, &ssd1306.Opts{ 34 | W: width, 35 | H: height, 36 | Rotated: false, 37 | }) 38 | if err != nil { 39 | return 40 | } 41 | 42 | ctx := gg.NewContext(width, height) 43 | ctx.SetColor(color.Black) 44 | ctx.Clear() 45 | ctx.SetColor(color.White) 46 | 47 | oled.Draw(defaultRect, ctx.Image(), upperLeft) 48 | 49 | if err != nil { 50 | return 51 | } 52 | o = &OLED{ 53 | Dev: oled, 54 | textCol: 0, 55 | textRow: 0, 56 | ctx: ctx, 57 | } 58 | return 59 | } 60 | 61 | func (d *OLED) Cls() { 62 | d.ctx.Push() 63 | d.ctx.SetColor(color.Black) 64 | d.ctx.Clear() 65 | d.ctx.Pop() 66 | d.Dev.Draw(defaultRect, d.ctx.Image(), upperLeft) 67 | } 68 | 69 | func (d *OLED) SetCursor(row, column uint8) { 70 | d.textCol = int(column) 71 | d.textRow = int(row) 72 | } 73 | 74 | func (d *OLED) Print(message string) { 75 | newX := float64(defaultFace.Advance * d.textCol) 76 | newY := float64((defaultFace.Height - 1) * (d.textRow + 1)) 77 | d.ctx.DrawString(message, newX, newY) 78 | } 79 | 80 | func (d *OLED) Draw() { 81 | d.ctx.Stroke() 82 | d.Dev.Draw(defaultRect, d.ctx.Image(), upperLeft) 83 | } 84 | 85 | func (d *OLED) Close() { 86 | // Nothing to do here. 87 | } 88 | -------------------------------------------------------------------------------- /firmware/device/rpi/keyboard.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package rpi 4 | 5 | import ( 6 | "fmt" 7 | "io/ioutil" 8 | "os" 9 | ) 10 | 11 | const ( 12 | usbGadget = "/sys/kernel/config/usb_gadget/passkeeper" 13 | 14 | usbStrings = usbGadget + "/strings/0x409" 15 | usbConfig = usbGadget + "/configs/c.1" 16 | usbConfigStrings = usbConfig + "/strings/0x409" 17 | usbSerial = usbGadget + "/functions/acm.usb0" 18 | usbHid = usbGadget + "/functions/hid.usb0" 19 | name = "passkeeper" 20 | deviceName = "/dev/hidg0" 21 | 22 | filemode = 0600 23 | 24 | charOffset = 0 25 | digitOffset = 26 26 | 27 | shiftBitsOffset = 0 28 | symOffset = 2 29 | ) 30 | 31 | var report = [...]byte{0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x03, 0x95, 0x05, 0x75, 0x01, 0x05, 0x08, 0x19, 0x01, 0x29, 0x05, 0x91, 0x02, 0x95, 0x01, 0x75, 0x03, 0x91, 0x03, 0x95, 0x06, 0x75, 0x08, 0x15, 0x00, 0x25, 0x65, 0x05, 0x07, 0x19, 0x00, 0x29, 0x65, 0x81, 0x00, 0xc0} 32 | 33 | func writeFiles(base string, data [][]string) error { 34 | createAndWrite := func(path string, data string) error { 35 | return ioutil.WriteFile(base+"/"+path, []byte(data), filemode) 36 | } 37 | for _, p := range data { 38 | if err := createAndWrite(p[1], p[0]); err != nil { 39 | return err 40 | } 41 | } 42 | return nil 43 | } 44 | 45 | type VirtualKeyboard struct{} 46 | 47 | var localKbd = VirtualKeyboard{} 48 | 49 | var debug = false 50 | 51 | func log(msg string, params ...interface{}) { 52 | if debug { 53 | fmt.Printf(msg+"\n", params...) 54 | } 55 | } 56 | 57 | func (ci *VirtualKeyboard) WriteString(content string) error { 58 | f, err := os.OpenFile(deviceName, os.O_RDWR, 0600) 59 | if err != nil { 60 | return err 61 | } 62 | 63 | defer f.Close() 64 | 65 | stroke := make([]byte, 8) 66 | for _, ch := range content { 67 | key, err := ResolveScanKey(ch) 68 | if err != nil { 69 | continue 70 | } 71 | stroke[shiftBitsOffset] = key[1] 72 | stroke[symOffset] = key[0] 73 | if _, err := f.Write(stroke); err != nil { 74 | return err 75 | } 76 | stroke[shiftBitsOffset] = 0 77 | stroke[symOffset] = 0 78 | if _, err = f.Write(stroke); err != nil { 79 | return err 80 | } 81 | } 82 | return nil 83 | } 84 | -------------------------------------------------------------------------------- /firmware/device/rpi/keyboard_scancodes.go: -------------------------------------------------------------------------------- 1 | package rpi 2 | 3 | import "fmt" 4 | 5 | var scanKeyMap = make(map[rune][2]byte) 6 | 7 | func init() { 8 | 9 | for sym := 'A'; sym <= 'Z'; sym++ { 10 | symIdx := byte(sym-'A') + 4 11 | scanKeyMap[sym] = [...]byte{symIdx, 0x02} 12 | scanKeyMap[sym-'A'+'a'] = [...]byte{symIdx, 0x0} 13 | } 14 | 15 | var numShift = []rune{'!', '@', '#', '$', '%', '^', '&', '*', '('} 16 | for sym := '1'; sym <= '9'; sym++ { 17 | symIdx := byte(sym-'1') + 0x1e 18 | scanKeyMap[sym] = [...]byte{symIdx, 0x0} 19 | scanKeyMap[numShift[sym-'1']] = [...]byte{symIdx, 0x02} 20 | } 21 | 22 | scanKeyMap['0'] = [...]byte{0x27, 0x0} 23 | scanKeyMap[')'] = [...]byte{0x27, 0x02} 24 | 25 | var pairs = [...][]rune{ 26 | {'-', '_'}, 27 | {'=', '+'}, 28 | {'[', '{'}, 29 | {']', '}'}, 30 | {'\\', '|'}, 31 | nil, 32 | {';', ':'}, 33 | {'\'', '"'}, 34 | {'`', '~'}, 35 | {',', '<'}, 36 | {'.', '>'}, 37 | {'/', '?'}, 38 | } 39 | 40 | for sym := byte(0x2d); sym <= 0x38; sym++ { 41 | symIdx := sym - 0x2d 42 | if pairs[symIdx] == nil { 43 | continue 44 | } 45 | scanKeyMap[pairs[symIdx][0]] = [...]byte{sym, 0x0} 46 | scanKeyMap[pairs[symIdx][1]] = [...]byte{sym, 0x2} 47 | } 48 | 49 | scanKeyMap[' '] = [...]byte{0x2c, 0x0} 50 | 51 | } 52 | 53 | func ResolveScanKey(key rune) ([]byte, error) { 54 | if res, ok := scanKeyMap[key]; ok { 55 | return res[:], nil 56 | } 57 | return nil, fmt.Errorf("Can't resolve key %c", key) 58 | } 59 | -------------------------------------------------------------------------------- /firmware/device/rpi/keyboard_scancodes_test.go: -------------------------------------------------------------------------------- 1 | package rpi 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestScancodesInit(t *testing.T) { 8 | 9 | var tests = []struct { 10 | char rune 11 | code, mods byte 12 | }{ 13 | {'A', 0x04, 0x02}, 14 | {'a', 0x04, 0x00}, 15 | {'Z', 0x1d, 0x02}, 16 | {'z', 0x1d, 0x00}, 17 | {'1', 0x1e, 0x00}, 18 | {'!', 0x1e, 0x02}, 19 | {'2', 0x1f, 0x00}, 20 | {'@', 0x1f, 0x02}, 21 | {'9', 0x26, 0x00}, 22 | {'(', 0x26, 0x02}, 23 | {'0', 0x27, 0x00}, 24 | {')', 0x27, 0x02}, 25 | {' ', 0x2C, 0x00}, 26 | {'=', 0x2e, 0x00}, 27 | {'+', 0x2e, 0x02}, 28 | {'[', 0x2f, 0x00}, 29 | {'{', 0x2f, 0x02}, 30 | {']', 0x30, 0x00}, 31 | {'}', 0x30, 0x02}, 32 | {'/', 0x38, 0x00}, 33 | {'?', 0x38, 0x02}, 34 | } 35 | 36 | for _, test := range tests { 37 | m, err := ResolveScanKey(test.char) 38 | if err != nil { 39 | t.Error(err) 40 | } 41 | if m[0] != test.code { 42 | t.Errorf("Expected %x actual %d", test.code, m[0]) 43 | } 44 | if m[1] != test.mods { 45 | t.Errorf("Expected %x actual %d", test.mods, m[1]) 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /firmware/device/rpi/network.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package rpi 4 | 5 | import ( 6 | "errors" 7 | "io/ioutil" 8 | "net" 9 | "os" 10 | 11 | "github.com/docker/libcontainer/netlink" 12 | "github.com/jdevelop/passkeeper/firmware/dhcpsrv" 13 | ) 14 | 15 | const ( 16 | usbEthernet = usbGadget + "/functions/ecm.usb0" 17 | localIPStr = "10.101.1.1" 18 | leaseStartStr = "10.101.1.2" 19 | ) 20 | 21 | var localIP = net.ParseIP("10.101.1.1") 22 | 23 | func ethernetUp() (err error) { 24 | err = os.MkdirAll(usbEthernet, os.ModeDir) 25 | if err != nil { 26 | return 27 | } 28 | ioutil.WriteFile(usbEthernet+"/host_addr", []byte("48:6f:73:74:50:43"), 0600) 29 | ioutil.WriteFile(usbEthernet+"/self_addr", []byte("42:61:64:55:53:42"), 0600) 30 | os.Symlink(usbEthernet, usbConfig+"/ecm.usb0") 31 | return 32 | } 33 | 34 | func networkUp(name string) (err error) { 35 | ifaces, err := net.Interfaces() 36 | if err != nil { 37 | return 38 | } 39 | 40 | var iface net.Interface 41 | found := false 42 | 43 | for _, _iface := range ifaces { 44 | log("Checking net %d : %v", _iface.Index, _iface.Name) 45 | if _iface.Name == name { 46 | iface = _iface 47 | found = true 48 | break 49 | } 50 | } 51 | 52 | if !found { 53 | err = errors.New("Interface " + name + " not found") 54 | return 55 | } 56 | 57 | err = netlink.NetworkLinkAddIp(&iface, localIP, &net.IPNet{ 58 | IP: localIP, 59 | Mask: net.IPv4Mask(255, 255, 255, 0), 60 | }) 61 | 62 | if err != nil { 63 | return 64 | } 65 | 66 | err = netlink.NetworkLinkUp(&iface) 67 | 68 | return 69 | 70 | } 71 | 72 | func dhcpUp(iface, localIP, leaseStart string) error { 73 | dhcpsrv.StartDHCP(dhcpsrv.IFace(iface), dhcpsrv.IP(localIP), dhcpsrv.LeaseStart(leaseStart)) 74 | return nil 75 | } 76 | -------------------------------------------------------------------------------- /firmware/device/rpi/raspberrypi.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package rpi 4 | 5 | import ( 6 | "fmt" 7 | "io/ioutil" 8 | "os" 9 | "time" 10 | 11 | "github.com/jdevelop/passkeeper/firmware/controls/input" 12 | "periph.io/x/periph/conn/gpio" 13 | "periph.io/x/periph/conn/gpio/gpioreg" 14 | ) 15 | 16 | type ( 17 | led struct { 18 | standbyLedPin gpio.PinOut 19 | errorLedPin gpio.PinOut 20 | busyLedPin gpio.PinOut 21 | } 22 | 23 | RaspberryPi struct { 24 | Led led 25 | InputControl input.InputControl 26 | mainloop chan struct{} 27 | } 28 | 29 | StackParams struct { 30 | HasSerial bool 31 | HasEthernet bool 32 | } 33 | 34 | Led struct { 35 | standbyLedPin int 36 | errorLedPin int 37 | busyLedPin int 38 | } 39 | 40 | Control struct { 41 | echoPin int 42 | moveUpPin int 43 | moveDownPin int 44 | } 45 | 46 | Board struct { 47 | Led Led 48 | Control Control 49 | } 50 | ) 51 | 52 | func (rpi *RaspberryPi) String() string { 53 | return "BOARD" 54 | } 55 | 56 | func (rpi *RaspberryPi) Close() { 57 | rpi.Led.busyLedPin.Halt() 58 | rpi.Led.errorLedPin.Halt() 59 | rpi.Led.standbyLedPin.Halt() 60 | } 61 | 62 | func (rpi *RaspberryPi) Clear() { 63 | rpi.Led.busyLedPin.Out(gpio.Low) 64 | rpi.Led.errorLedPin.Out(gpio.Low) 65 | rpi.Led.standbyLedPin.Out(gpio.Low) 66 | } 67 | 68 | func (rpi *RaspberryPi) SelfCheckInprogress() error { 69 | rpi.Clear() 70 | rpi.Led.busyLedPin.Out(gpio.High) 71 | return nil 72 | } 73 | 74 | func (rpi *RaspberryPi) SelfCheckComplete() error { 75 | rpi.Clear() 76 | rpi.Led.standbyLedPin.Out(gpio.High) 77 | return nil 78 | } 79 | 80 | func (rpi *RaspberryPi) SelfCheckFailure(reason error) error { 81 | rpi.Clear() 82 | rpi.Led.errorLedPin.Out(gpio.High) 83 | return nil 84 | } 85 | 86 | func (rpi *RaspberryPi) ReadyToTransmit() error { 87 | rpi.Clear() 88 | rpi.Led.standbyLedPin.Out(gpio.High) 89 | return nil 90 | } 91 | 92 | func (rpi *RaspberryPi) TransmissionComplete() error { 93 | rpi.Clear() 94 | rpi.Led.standbyLedPin.Out(gpio.High) 95 | return nil 96 | } 97 | 98 | func (rpi *RaspberryPi) TransmissionFailure(reason error) error { 99 | log("Transmission failed: %v", reason) 100 | rpi.Clear() 101 | rpi.Led.errorLedPin.Out(gpio.High) 102 | return nil 103 | } 104 | 105 | func LedSettings(standbyLedPin, errorLedPin, busyPin int) Led { 106 | return Led{ 107 | standbyLedPin: standbyLedPin, 108 | errorLedPin: errorLedPin, 109 | busyLedPin: busyPin, 110 | } 111 | } 112 | 113 | func ControlSettings(echoPin, upPin, downPin int) Control { 114 | return Control{ 115 | echoPin: echoPin, 116 | moveDownPin: downPin, 117 | moveUpPin: upPin, 118 | } 119 | } 120 | 121 | func bcmpin(pin int) string { 122 | return fmt.Sprintf("%d", pin) 123 | } 124 | 125 | func CreateBoard(settings Board) (*RaspberryPi, error) { 126 | busyLedPin := gpioreg.ByName(bcmpin(settings.Led.busyLedPin)) 127 | if busyLedPin == nil { 128 | return nil, wrapf("can't find busy pin led") 129 | } 130 | errorLedPin := gpioreg.ByName(bcmpin(settings.Led.errorLedPin)) 131 | if errorLedPin == nil { 132 | return nil, wrapf("can't find error pin led") 133 | } 134 | standbyLedPin := gpioreg.ByName(bcmpin(settings.Led.standbyLedPin)) 135 | if standbyLedPin == nil { 136 | return nil, wrapf("can't find standby pin led") 137 | } 138 | 139 | preparePin := func(pinNum int) (gpio.PinIn, error) { 140 | log("Opening pin %d\n", pinNum) 141 | pin := gpioreg.ByName(bcmpin(pinNum)) 142 | if pin == nil { 143 | return nil, wrapf("can't find input pin %d", pinNum) 144 | } 145 | if err := pin.In(gpio.PullUp, gpio.FallingEdge); err != nil { 146 | return nil, err 147 | } 148 | return pin, nil 149 | } 150 | 151 | echoPin, err := preparePin(settings.Control.echoPin) 152 | if err != nil { 153 | return nil, err 154 | } 155 | upPin, err := preparePin(settings.Control.moveUpPin) 156 | if err != nil { 157 | return nil, err 158 | } 159 | downPin, err := preparePin(settings.Control.moveDownPin) 160 | if err != nil { 161 | return nil, err 162 | } 163 | 164 | rpi := &RaspberryPi{ 165 | Led: led{ 166 | standbyLedPin: standbyLedPin, 167 | errorLedPin: errorLedPin, 168 | busyLedPin: busyLedPin, 169 | }, 170 | } 171 | 172 | log("Board settings: %s", rpi.String()) 173 | 174 | mainloop := make(chan struct{}) 175 | 176 | watcher := func(p gpio.PinIn, f func()) { 177 | go func() { 178 | for { 179 | select { 180 | case _, open := <-mainloop: 181 | if !open { 182 | return 183 | } 184 | default: 185 | if p.WaitForEdge(time.Millisecond * 20) { 186 | if rpi.InputControl != nil { 187 | f() 188 | } 189 | } 190 | 191 | } 192 | } 193 | }() 194 | } 195 | 196 | watcher(echoPin, func() { rpi.InputControl.OnClickOk() }) 197 | watcher(upPin, func() { rpi.InputControl.OnClickUp() }) 198 | watcher(downPin, func() { rpi.InputControl.OnClickDown() }) 199 | 200 | return rpi, nil 201 | } 202 | 203 | func InitLinuxStack(params StackParams) (*VirtualKeyboard, error) { 204 | log("Init devices") 205 | _, err := os.Stat(deviceName) 206 | if err == nil || os.IsExist(err) { 207 | log("Keyboard exists, re-using descriptor") 208 | return &localKbd, nil 209 | } 210 | 211 | log("Create gadget %s", usbGadget) 212 | err = os.Mkdir(usbGadget, os.ModeDir) 213 | if err != nil { 214 | return nil, err 215 | } 216 | log("Set vendor data") 217 | if err = writeFiles(usbGadget, [][]string{ 218 | {"0x1d6b", "idVendor"}, 219 | {"0x0104", "idProduct"}, 220 | {"0x0100", "bcdDevice"}, 221 | {"0x0200", "bcdUSB"}, 222 | }); err != nil { 223 | return nil, err 224 | } 225 | log("Create %s", usbStrings) 226 | if err = os.MkdirAll(usbStrings, os.ModeDir); err != nil { 227 | return nil, err 228 | } 229 | log("Set %s data", usbStrings) 230 | if err = writeFiles(usbStrings, [][]string{ 231 | {"b65a0fe47231d98c", "serialnumber"}, 232 | {"PASSKEEPER", "manufacturer"}, 233 | {"PASSKEEPER HW", "product"}, 234 | }); err != nil { 235 | return nil, err 236 | } 237 | log("Create config %s", usbConfig+"/strings/0x409") 238 | if err = os.MkdirAll(usbConfig+"/strings/0x409", os.ModeDir); err != nil { 239 | return nil, err 240 | } 241 | log("Create config %s", usbConfigStrings+"/configuration") 242 | if err = ioutil.WriteFile(usbConfigStrings+"/configuration", []byte("Config 1: ECM network"), filemode); err != nil { 243 | return nil, err 244 | } 245 | log("Setup power %s", usbConfig+"/MaxPower") 246 | if err = ioutil.WriteFile(usbConfig+"/MaxPower", []byte("200"), filemode); err != nil { 247 | return nil, err 248 | } 249 | 250 | if params.HasSerial { 251 | log("Setup serial %s", usbSerial) 252 | if err = os.MkdirAll(usbSerial, os.ModeDir); err != nil { 253 | return nil, err 254 | } 255 | log("Setup link %s -> %s", usbSerial, usbConfig+"/acm.usb0") 256 | if err = os.Symlink(usbSerial, usbConfig+"/acm.usb0"); err != nil { 257 | return nil, err 258 | } 259 | } 260 | 261 | if params.HasEthernet { 262 | log("Setting up ethernet") 263 | if err = ethernetUp(); err != nil { 264 | return nil, err 265 | } 266 | } 267 | 268 | log("Setting up usbHid %s", usbHid) 269 | if err = os.MkdirAll(usbHid, os.ModeDir); err != nil { 270 | return nil, err 271 | } 272 | 273 | if err = writeFiles(usbHid, [][]string{ 274 | {"1", "protocol"}, 275 | {"1", "subclass"}, 276 | {"8", "report_length"}, 277 | }); err != nil { 278 | return nil, err 279 | } 280 | 281 | log("Setting up usbHid %s", usbHid+"/report_desc") 282 | if err = ioutil.WriteFile(usbHid+"/report_desc", report[:], filemode); err != nil { 283 | return nil, err 284 | } 285 | 286 | log("Setting up link %s -> %s", usbHid, usbConfig+"/hid.usb0") 287 | if err = os.Symlink(usbHid, usbConfig+"/hid.usb0"); err != nil { 288 | return nil, err 289 | } 290 | 291 | files, err := ioutil.ReadDir("/sys/class/udc") 292 | if err != nil { 293 | return nil, err 294 | } 295 | 296 | var buffer string 297 | 298 | for _, file := range files { 299 | buffer = buffer + file.Name() + "\n" 300 | } 301 | 302 | log("Create UDC gadget %s", usbGadget+"/UDC") 303 | if err = ioutil.WriteFile(usbGadget+"/UDC", []byte(buffer), filemode); err != nil { 304 | return nil, err 305 | } 306 | 307 | //time.Sleep(1 * time.Second) 308 | 309 | if params.HasEthernet { 310 | log("Setting up ethernet") 311 | if err = networkUp("usb0"); err != nil { 312 | return nil, err 313 | } 314 | 315 | log("Init DHCP") 316 | go func() { 317 | err := dhcpUp("usb0", localIPStr, leaseStartStr) 318 | if err != nil { 319 | log("Can't start DHCP server %v", err) 320 | } 321 | }() 322 | } 323 | 324 | return &localKbd, nil 325 | } 326 | 327 | func wrapf(err string, args ...interface{}) error { 328 | return fmt.Errorf(err, args...) 329 | } 330 | -------------------------------------------------------------------------------- /firmware/dhcpsrv/dhcpsrv.go: -------------------------------------------------------------------------------- 1 | package dhcpsrv 2 | 3 | import ( 4 | dhcp "github.com/krolaw/dhcp4" 5 | 6 | "math/rand" 7 | "net" 8 | "time" 9 | ) 10 | 11 | type ( 12 | IFace string 13 | IP string 14 | LeaseStart string 15 | ) 16 | 17 | // Example using DHCP with a single network interface device 18 | func StartDHCP(iface IFace, ip IP, start LeaseStart) error { 19 | serverIP := net.ParseIP(string(ip)).To4() 20 | handler := &DHCPHandler{ 21 | ip: serverIP, 22 | leaseDuration: 2 * time.Hour, 23 | start: net.ParseIP(string(start)).To4(), 24 | leaseRange: 2, 25 | leases: make(map[int]lease, 2), 26 | options: dhcp.Options{ 27 | dhcp.OptionSubnetMask: []byte{255, 255, 255, 0}, 28 | }, 29 | } 30 | return dhcp.ListenAndServeIf(string(iface), handler) 31 | } 32 | 33 | type lease struct { 34 | nic string // Client's CHAddr 35 | expiry time.Time // When the lease expires 36 | } 37 | 38 | type DHCPHandler struct { 39 | ip net.IP // Server IP to use 40 | options dhcp.Options // Options to send to DHCP Clients 41 | start net.IP // Start of IP range to distribute 42 | leaseRange int // Number of IPs to distribute (starting from start) 43 | leaseDuration time.Duration // Lease period 44 | leases map[int]lease // Map to keep track of leases 45 | } 46 | 47 | func (h *DHCPHandler) ServeDHCP(p dhcp.Packet, msgType dhcp.MessageType, options dhcp.Options) (d dhcp.Packet) { 48 | switch msgType { 49 | 50 | case dhcp.Discover: 51 | free, nic := -1, p.CHAddr().String() 52 | for i, v := range h.leases { // Find previous lease 53 | if v.nic == nic { 54 | free = i 55 | goto reply 56 | } 57 | } 58 | if free = h.freeLease(); free == -1 { 59 | return 60 | } 61 | reply: 62 | return dhcp.ReplyPacket(p, dhcp.Offer, h.ip, dhcp.IPAdd(h.start, free), h.leaseDuration, 63 | h.options.SelectOrderOrAll(options[dhcp.OptionParameterRequestList])) 64 | 65 | case dhcp.Request: 66 | if server, ok := options[dhcp.OptionServerIdentifier]; ok && !net.IP(server).Equal(h.ip) { 67 | return nil // Message not for this dhcp server 68 | } 69 | reqIP := net.IP(options[dhcp.OptionRequestedIPAddress]) 70 | if reqIP == nil { 71 | reqIP = net.IP(p.CIAddr()) 72 | } 73 | 74 | if len(reqIP) == 4 && !reqIP.Equal(net.IPv4zero) { 75 | if leaseNum := dhcp.IPRange(h.start, reqIP) - 1; leaseNum >= 0 && leaseNum < h.leaseRange { 76 | if l, exists := h.leases[leaseNum]; !exists || l.nic == p.CHAddr().String() { 77 | h.leases[leaseNum] = lease{nic: p.CHAddr().String(), expiry: time.Now().Add(h.leaseDuration)} 78 | return dhcp.ReplyPacket(p, dhcp.ACK, h.ip, reqIP, h.leaseDuration, 79 | h.options.SelectOrderOrAll(options[dhcp.OptionParameterRequestList])) 80 | } 81 | } 82 | } 83 | return dhcp.ReplyPacket(p, dhcp.NAK, h.ip, nil, 0, nil) 84 | 85 | case dhcp.Release, dhcp.Decline: 86 | nic := p.CHAddr().String() 87 | for i, v := range h.leases { 88 | if v.nic == nic { 89 | delete(h.leases, i) 90 | break 91 | } 92 | } 93 | } 94 | return nil 95 | } 96 | 97 | func (h *DHCPHandler) freeLease() int { 98 | now := time.Now() 99 | b := rand.Intn(h.leaseRange) // Try random first 100 | for _, v := range [][]int{[]int{b, h.leaseRange}, []int{0, b}} { 101 | for i := v[0]; i < v[1]; i++ { 102 | if l, ok := h.leases[i]; !ok || l.expiry.Before(now) { 103 | return i 104 | } 105 | } 106 | } 107 | return -1 108 | } 109 | -------------------------------------------------------------------------------- /firmware/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/jdevelop/passkeeper/firmware 2 | 3 | go 1.12 4 | 5 | require ( 6 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect 7 | github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 // indirect 8 | github.com/docker/libcontainer v2.2.1+incompatible 9 | github.com/fogleman/gg v1.3.0 10 | github.com/gobuffalo/packr v1.30.1 11 | github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect 12 | github.com/google/uuid v1.1.1 13 | github.com/gorilla/mux v1.7.0 14 | github.com/krolaw/dhcp4 v0.0.0-20180925202202-7cead472c414 15 | github.com/pkg/errors v0.8.1 16 | github.com/rogpeppe/go-internal v1.3.2 // indirect 17 | github.com/sethvargo/go-password v0.1.2 18 | github.com/stretchr/testify v1.4.0 19 | golang.org/x/crypto v0.0.0-20190909091759-094676da4a83 20 | golang.org/x/image v0.0.0-20190802002840-cff245a6509b 21 | golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect 22 | golang.org/x/sys v0.0.0-20190909082730-f460065e899a // indirect 23 | gopkg.in/alecthomas/kingpin.v2 v2.2.6 24 | periph.io/x/periph v3.4.0+incompatible 25 | ) 26 | -------------------------------------------------------------------------------- /firmware/package.go: -------------------------------------------------------------------------------- 1 | package firmware 2 | 3 | type Credentials struct { 4 | Id string `json:"id,omitempty"` 5 | Service string `json:"service,omitempty"` 6 | Secret string `json:"secret,omitempty"` 7 | Comment string `json:"comment,omitempty"` 8 | } 9 | -------------------------------------------------------------------------------- /firmware/pass/generator.go: -------------------------------------------------------------------------------- 1 | package pass 2 | 3 | import "github.com/sethvargo/go-password/password" 4 | 5 | type simpleProvider struct { 6 | passwordLength int 7 | } 8 | 9 | func (sp *simpleProvider) GeneratePassword(passwords int) ([]string, error) { 10 | pswds := make([]string, 0, passwords) 11 | for i := 0; i < passwords; i++ { 12 | if pwd, err := password.Generate(sp.passwordLength, 2, 2, false, true); err != nil { 13 | return nil, err 14 | } else { 15 | pswds = append(pswds, pwd) 16 | } 17 | } 18 | return pswds, nil 19 | } 20 | 21 | func NewPasswordGenerator(pwdLen int) *simpleProvider { 22 | return &simpleProvider{ 23 | passwordLength: pwdLen, 24 | } 25 | } 26 | 27 | var _ PasswordGenerator = &simpleProvider{} 28 | -------------------------------------------------------------------------------- /firmware/pass/pass.go: -------------------------------------------------------------------------------- 1 | package pass 2 | 3 | type PasswordProvider interface { 4 | GetCurrentPassword() ([]byte, error) 5 | } 6 | 7 | type PasswordGenerator interface { 8 | GeneratePassword(int) ([]string, error) 9 | } 10 | -------------------------------------------------------------------------------- /firmware/pass/rfid_password_provider.go: -------------------------------------------------------------------------------- 1 | package pass 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | 7 | "periph.io/x/periph/conn/gpio/gpioreg" 8 | "periph.io/x/periph/conn/spi/spireg" 9 | "periph.io/x/periph/experimental/devices/mfrc522" 10 | "periph.io/x/periph/experimental/devices/mfrc522/commands" 11 | ) 12 | 13 | type RFID struct { 14 | rfid *mfrc522.Dev 15 | currentPass string 16 | cardKey [6]byte 17 | pwdSector, pwdBlock int 18 | currentPassOk bool 19 | } 20 | 21 | var ZeroKey = [...]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff} 22 | 23 | var defaultKey = [...]byte{0xca, 0xfe, 0xba, 0xbe, 0, 0} 24 | 25 | const ( 26 | //resetPinStr = "13" 27 | //irqPinStr = "12" 28 | resetPinStr = "27" 29 | irqPinStr = "17" 30 | ) 31 | 32 | type config struct { 33 | resetPin, irqPin string 34 | } 35 | 36 | var defaultConfig = config{ 37 | resetPin: "27", 38 | irqPin: "17", 39 | } 40 | 41 | type PinConfF func(*config) *config 42 | 43 | func WithResetPin(pin string) PinConfF { 44 | return func(c *config) *config { 45 | c.resetPin = pin 46 | return c 47 | } 48 | } 49 | 50 | func WithIRQPin(pin string) PinConfF { 51 | return func(c *config) *config { 52 | c.irqPin = pin 53 | return c 54 | } 55 | } 56 | 57 | func NewRFIDPass(cardKey [6]byte, pwdSector, pwdBlock int, confs ...PinConfF) (*RFID, error) { 58 | dev, err := spireg.Open("") 59 | if err != nil { 60 | return nil, err 61 | } 62 | 63 | c := defaultConfig 64 | { 65 | cc := &c 66 | for _, f := range confs { 67 | cc = f(cc) 68 | } 69 | c = *cc 70 | } 71 | 72 | resetPin := gpioreg.ByName(c.resetPin) 73 | if resetPin == nil { 74 | return nil, fmt.Errorf("can't open reset pin") 75 | } 76 | irqPin := gpioreg.ByName(c.irqPin) 77 | if irqPin == nil { 78 | return nil, fmt.Errorf("can't open irq pin") 79 | } 80 | 81 | nr, err := mfrc522.NewSPI(dev, resetPin, irqPin) 82 | if err != nil { 83 | return nil, err 84 | } 85 | 86 | return &RFID{ 87 | rfid: nr, 88 | cardKey: cardKey, 89 | pwdBlock: pwdBlock, 90 | pwdSector: pwdSector, 91 | }, nil 92 | } 93 | 94 | var ( 95 | cardIRQTimeout = 30 * time.Second 96 | ) 97 | 98 | func (r *RFID) GetCurrentPassword() ([]byte, error) { 99 | if err := r.rfid.LowLevel.WaitForEdge(cardIRQTimeout); err != nil { 100 | return nil, err 101 | } 102 | pwd, err := r.rfid.ReadCard(cardIRQTimeout, commands.PICC_AUTHENT1A, r.pwdSector, r.pwdBlock, r.cardKey) 103 | if err != nil { 104 | return nil, err 105 | } 106 | return pwd, nil 107 | } 108 | 109 | func (r *RFID) ResetAccessKey(newKeyArr [6]byte, sector int) error { 110 | if err := r.rfid.LowLevel.WaitForEdge(cardIRQTimeout); err != nil { 111 | return err 112 | } 113 | fmt.Printf("Card key %v => %v\n", r.cardKey, newKeyArr) 114 | return r.rfid.WriteSectorTrail(cardIRQTimeout, commands.PICC_AUTHENT1A, sector, newKeyArr, newKeyArr, 115 | &mfrc522.BlocksAccess{ 116 | B0: mfrc522.AnyKeyRWID, 117 | B1: mfrc522.AnyKeyRWID, 118 | B2: mfrc522.AnyKeyRWID, 119 | B3: mfrc522.KeyA_RN_WA_BITS_RA_WA_KeyB_RA_WA, 120 | }, r.cardKey) 121 | } 122 | 123 | func (r *RFID) ResetPassword(newPassword []byte, sector, block int) error { 124 | if len(newPassword) != 16 { 125 | return fmt.Errorf("Password length must be of size 16 - found %d", len(newPassword)) 126 | } 127 | 128 | var pwdArr [16]byte 129 | 130 | for i, v := range newPassword { 131 | pwdArr[i] = v 132 | } 133 | 134 | if err := r.rfid.LowLevel.WaitForEdge(cardIRQTimeout); err != nil { 135 | return err 136 | } 137 | return r.rfid.WriteCard(cardIRQTimeout, commands.PICC_AUTHENT1A, sector, block, pwdArr, r.cardKey) 138 | } 139 | 140 | func (r *RFID) GetCardKey() [6]byte { 141 | return r.cardKey 142 | } 143 | 144 | func (r *RFID) Close() error { 145 | return r.rfid.LowLevel.StopCrypto() 146 | } 147 | -------------------------------------------------------------------------------- /firmware/rest/backuprestore.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import ( 4 | "io" 5 | "net/http" 6 | ) 7 | 8 | func (r *RESTServer) backupCredentials(w http.ResponseWriter, req *http.Request) { 9 | reader, err := r.credStorage.BackupStorage() 10 | if err != nil { 11 | errorResp(w, "Can't read credentials", &err) 12 | } 13 | w.Header().Set("Content-Type", "application/json") 14 | io.Copy(jsonHeaders(corsHeaders(w)), reader) 15 | } 16 | 17 | func (r *RESTServer) restoreCredentials(w http.ResponseWriter, req *http.Request) { 18 | if err := req.ParseMultipartForm(10000); err != nil { 19 | errorResp(w, "can't parse multipart request", &err) 20 | return 21 | } 22 | file, _, err := req.FormFile("file") 23 | if err != nil { 24 | errorResp(w, "no file content", &err) 25 | return 26 | } 27 | defer file.Close() 28 | if err := r.credStorage.RestoreStorage(file); err != nil { 29 | errorResp(w, "can't restore storage", &err) 30 | return 31 | } 32 | corsHeaders(jsonHeaders(w)).Write(restored) 33 | } 34 | -------------------------------------------------------------------------------- /firmware/rest/cmd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "log" 7 | 8 | "github.com/jdevelop/passkeeper/firmware/pass" 9 | "github.com/jdevelop/passkeeper/firmware/rest" 10 | "github.com/jdevelop/passkeeper/firmware/storage" 11 | ) 12 | 13 | var ( 14 | host = flag.String("host", "localhost", "host to listen on") 15 | port = flag.Int("port", 8081, "port to listen on") 16 | passfile = flag.String("passfile", "/tmp/encrypted.storage", "path to the passwords file") 17 | ) 18 | 19 | func main() { 20 | flag.Parse() 21 | 22 | s, err := storage.NewPlainText(*passfile, []byte("passw0rd12345678")) 23 | if err != nil { 24 | log.Fatal(err) 25 | } 26 | 27 | fmt.Printf("Starting REST service at http://%s:%d\n", *host, *port) 28 | 29 | rest.Start(*host, *port, s, pass.NewPasswordGenerator(8), 30 | func(newKey []byte) error { 31 | log.Printf("Updating card key to %v\n", newKey) 32 | return nil 33 | }, func() {}) 34 | } 35 | -------------------------------------------------------------------------------- /firmware/rest/credentials.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import ( 4 | "encoding/json" 5 | "io/ioutil" 6 | "net/http" 7 | 8 | "github.com/google/uuid" 9 | "github.com/gorilla/mux" 10 | "github.com/jdevelop/passkeeper/firmware" 11 | ) 12 | 13 | func (r *RESTServer) listCredentials(w http.ResponseWriter, _ *http.Request) { 14 | services, err := r.credStorage.ListCredentials() 15 | if err != nil { 16 | errorResp(w, "Can't load seeds", &err) 17 | return 18 | } 19 | data, err := json.Marshal(services) 20 | if err != nil { 21 | errorResp(w, "Can't marshal seeds", &err) 22 | return 23 | } 24 | _, err = jsonHeaders(corsHeaders(w)).Write(data) 25 | if err != nil { 26 | errorResp(w, "Response failure", &err) 27 | return 28 | } 29 | return 30 | } 31 | 32 | func (r *RESTServer) loadCredentials(w http.ResponseWriter, req *http.Request) { 33 | data := mux.Vars(req) 34 | if v, ok := data["id"]; !ok { 35 | if !ok { 36 | errorResp(w, "No required parameter", nil) 37 | return 38 | } 39 | } else { 40 | seed, err := r.credStorage.ReadCredentials(v) 41 | if err != nil { 42 | errorResp(w, "Can't find seed", &err) 43 | return 44 | } 45 | data, err := json.Marshal(&seed) 46 | if err != nil { 47 | errorResp(w, "Can't marshal seed", &err) 48 | return 49 | } 50 | jsonHeaders(corsHeaders(w)).Write(data) 51 | } 52 | } 53 | 54 | func (r *RESTServer) saveCredentials(w http.ResponseWriter, req *http.Request) { 55 | 56 | data, err := ioutil.ReadAll(req.Body) 57 | 58 | if err != nil { 59 | errorResp(w, "Can't read seed object", &err) 60 | return 61 | } 62 | 63 | var s firmware.Credentials 64 | 65 | if err = json.Unmarshal(data, &s); err != nil { 66 | errorResp(w, "Can't unmarshal seed object", &err) 67 | return 68 | } 69 | 70 | if s.Id == "" { 71 | s.Id = uuid.New().String() 72 | } 73 | 74 | if err = r.credStorage.WriteCredentials(s); err != nil { 75 | errorResp(w, "Can't save seed", &err) 76 | return 77 | } 78 | 79 | corsHeaders(jsonHeaders(w)).Write(saved) 80 | return 81 | } 82 | 83 | func (r *RESTServer) removeCredentials(w http.ResponseWriter, req *http.Request) { 84 | data := mux.Vars(req) 85 | if v, ok := data["id"]; !ok { 86 | errorResp(w, "No required parameter", nil) 87 | return 88 | } else { 89 | if err := r.credStorage.RemoveCredentials(v); err != nil { 90 | errorResp(w, "Can't remove seed", &err) 91 | return 92 | } 93 | } 94 | corsHeaders(jsonHeaders(w)).Write(removed) 95 | } 96 | -------------------------------------------------------------------------------- /firmware/rest/passwords.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "github.com/jdevelop/passkeeper/firmware/storage" 7 | "io/ioutil" 8 | "net/http" 9 | "strings" 10 | ) 11 | 12 | func (r *RESTServer) generatePasswords(w http.ResponseWriter, req *http.Request) { 13 | pwds, err := r.passwordGen.GeneratePassword(5) 14 | if err != nil { 15 | errorResp(w, "can't generate passwords", &err) 16 | return 17 | } 18 | respJson, err := json.Marshal(pwds) 19 | if err != nil { 20 | errorResp(w, "can't restore stora", &err) 21 | return 22 | } 23 | corsHeaders(jsonHeaders(w)).Write(respJson) 24 | } 25 | 26 | type CardPasswordUpdate struct { 27 | Password string `json:"password"` 28 | Confirm string `json:"confirm"` 29 | } 30 | 31 | const blockSize = 32 32 | 33 | func (r *RESTServer) setPassword(w http.ResponseWriter, req *http.Request) { 34 | var passUpdate CardPasswordUpdate 35 | if err := json.NewDecoder(req.Body).Decode(&passUpdate); err != nil { 36 | errorResp(w, "can't unmarshal password update", &err) 37 | return 38 | } 39 | defer req.Body.Close() 40 | if strings.TrimSpace(passUpdate.Password) == "" || passUpdate.Password != passUpdate.Confirm { 41 | errorResp(w, "password can't be empty or mismatch", nil) 42 | return 43 | } 44 | 45 | block := storage.BuildKey([]byte(passUpdate.Password)) 46 | 47 | rdr, err := r.credStorage.BackupStorage() 48 | if err != nil { 49 | errorResp(w, "can't read the storage content, aborting", &err) 50 | return 51 | } 52 | data, err := ioutil.ReadAll(rdr) 53 | if err != nil { 54 | errorResp(w, "can't read the storage stream, aborting", &err) 55 | return 56 | } 57 | if err := r.cardPasswordChange(block); err != nil { 58 | errorResp(w, "can't update password, please try again", &err) 59 | return 60 | } 61 | if err := r.credStorage.UpdateKey(block); err != nil { 62 | errorResp(w, "can't set crypto storage password, aborting", &err) 63 | return 64 | } 65 | if err := r.credStorage.RestoreStorage(bytes.NewReader(data)); err != nil { 66 | if err != storage.ZeroLengthPasswordList { 67 | errorResp(w, "can't restore password, aborting", &err) 68 | return 69 | } 70 | } 71 | 72 | corsHeaders(jsonHeaders(w)).Write(saved) 73 | } 74 | -------------------------------------------------------------------------------- /firmware/rest/rest.go: -------------------------------------------------------------------------------- 1 | package rest 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/gobuffalo/packr" 8 | "github.com/gorilla/mux" 9 | "github.com/jdevelop/passkeeper/firmware/pass" 10 | "github.com/jdevelop/passkeeper/firmware/storage" 11 | ) 12 | 13 | type storageCombined interface { 14 | storage.CredentialsStorageList 15 | storage.CredentialsStorageRead 16 | storage.CredentialsStorageRemove 17 | storage.CredentialsStorageWrite 18 | storage.CredentialsStorageBackup 19 | storage.CredentialsStorageRestore 20 | storage.MutableKey 21 | } 22 | 23 | type RESTServer struct { 24 | credStorage storageCombined 25 | passwordGen pass.PasswordGenerator 26 | cardPasswordChange func([]byte) error 27 | } 28 | 29 | func corsHeaders(w http.ResponseWriter) http.ResponseWriter { 30 | hdr := w.Header() 31 | hdr.Set("Access-Control-Allow-Origin", "*") 32 | hdr.Set("Access-Control-Allow-Methods", "OPTIONS,GET,PUT,DELETE,POST") 33 | hdr.Set("Access-Control-Allow-Headers", "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range") 34 | return w 35 | } 36 | 37 | var ( 38 | removed = []byte(`{ "message" : "removed" }`) 39 | saved = []byte(`{ "message" : "saved" }`) 40 | restored = []byte(`{ "message" : "restored" }`) 41 | ) 42 | 43 | func jsonHeaders(w http.ResponseWriter) http.ResponseWriter { 44 | hdr := w.Header() 45 | hdr.Set("Content-Type", "application/json") 46 | return w 47 | } 48 | 49 | func textHeaders(w http.ResponseWriter) http.ResponseWriter { 50 | hdr := w.Header() 51 | hdr.Set("Content-Type", "text/plain") 52 | return w 53 | } 54 | 55 | func errorResp(w http.ResponseWriter, msg string, err *error) { 56 | fmt.Println("Error loading seeds", msg) 57 | if err != nil { 58 | fmt.Println(*err) 59 | } 60 | http.Error(w, msg, 400) 61 | } 62 | 63 | func Start(host string, port int, s storageCombined, pwdGen pass.PasswordGenerator, 64 | cardAccess func([]byte) error, 65 | changeCallback func()) { 66 | srv := RESTServer{ 67 | credStorage: s, 68 | passwordGen: pwdGen, 69 | cardPasswordChange: cardAccess, 70 | } 71 | 72 | rtr := mux.NewRouter() 73 | 74 | type x = func(w http.ResponseWriter, req *http.Request) 75 | 76 | wrapper := func(f x) x { 77 | return func(w http.ResponseWriter, req *http.Request) { 78 | f(w, req) 79 | changeCallback() 80 | } 81 | } 82 | 83 | // handle CORS OPTIONS 84 | rtr.Methods(http.MethodOptions).HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 85 | corsHeaders(w) 86 | }) 87 | 88 | rtr.HandleFunc("/backup", srv.backupCredentials).Methods(http.MethodGet) 89 | rtr.HandleFunc("/restore", wrapper(srv.restoreCredentials)).Methods(http.MethodPost) 90 | rtr.HandleFunc("/cardpassword", wrapper(srv.setPassword)).Methods(http.MethodPut) 91 | rtr.HandleFunc("/list", srv.listCredentials).Methods(http.MethodGet) 92 | rtr.HandleFunc("/add", wrapper(srv.saveCredentials)).Methods(http.MethodPut) 93 | rtr.HandleFunc("/generate", wrapper(srv.generatePasswords)).Methods(http.MethodGet) 94 | rtr.HandleFunc("/{id}", wrapper(srv.loadCredentials)).Methods(http.MethodGet) 95 | rtr.HandleFunc("/{id}", wrapper(srv.removeCredentials)).Methods(http.MethodDelete) 96 | 97 | box := packr.NewBox("../../web/") 98 | 99 | fs := http.FileServer(box) 100 | rtr.PathPrefix("/").Handler(fs) 101 | 102 | http.ListenAndServe(fmt.Sprintf("%s:%d", host, port), rtr) 103 | 104 | } 105 | -------------------------------------------------------------------------------- /firmware/storage/crypto.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "crypto/aes" 5 | "crypto/cipher" 6 | "crypto/rand" 7 | "crypto/sha1" 8 | "encoding/base64" 9 | "errors" 10 | "io" 11 | 12 | "golang.org/x/crypto/pbkdf2" 13 | ) 14 | 15 | const salt = "nadFojSi" 16 | 17 | func BuildKey(pwd []byte) []byte { 18 | return pbkdf2.Key(pwd, []byte(salt), 7, 16, sha1.New) 19 | } 20 | 21 | func encrypt(key, text []byte) ([]byte, error) { 22 | block, err := aes.NewCipher(key) 23 | if err != nil { 24 | return nil, err 25 | } 26 | b := base64.StdEncoding.EncodeToString(text) 27 | ciphertext := make([]byte, aes.BlockSize+len(b)) 28 | iv := ciphertext[:aes.BlockSize] 29 | if _, err := io.ReadFull(rand.Reader, iv); err != nil { 30 | return nil, err 31 | } 32 | cfb := cipher.NewCFBEncrypter(block, iv) 33 | cfb.XORKeyStream(ciphertext[aes.BlockSize:], []byte(b)) 34 | return ciphertext, nil 35 | } 36 | 37 | func decrypt(key, text []byte) ([]byte, error) { 38 | block, err := aes.NewCipher(key) 39 | if err != nil { 40 | return nil, err 41 | } 42 | if len(text) < aes.BlockSize { 43 | return nil, errors.New("ciphertext too short") 44 | } 45 | iv := text[:aes.BlockSize] 46 | text = text[aes.BlockSize:] 47 | cfb := cipher.NewCFBDecrypter(block, iv) 48 | cfb.XORKeyStream(text, text) 49 | data, err := base64.StdEncoding.DecodeString(string(text)) 50 | if err != nil { 51 | return nil, err 52 | } 53 | return data, nil 54 | } 55 | -------------------------------------------------------------------------------- /firmware/storage/file_storage.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "fmt" 7 | "io" 8 | "io/ioutil" 9 | "os" 10 | "path/filepath" 11 | "strings" 12 | "time" 13 | 14 | "github.com/jdevelop/passkeeper/firmware" 15 | ) 16 | 17 | type PlainText struct { 18 | filePath string 19 | key []byte 20 | } 21 | 22 | func NewPlainText(filename string, key []byte) (*PlainText, error) { 23 | _, err := os.Stat(filename) 24 | if err != nil && !os.IsNotExist(err) { 25 | return nil, err 26 | } 27 | keyData := make([]byte, len(key)) 28 | copy(keyData, key) 29 | return &PlainText{ 30 | filePath: filename, 31 | key: keyData, 32 | }, nil 33 | } 34 | 35 | func readCredentials(s *PlainText) ([]firmware.Credentials, error) { 36 | bytes, err := ioutil.ReadFile(s.filePath) 37 | if err != nil { 38 | if os.IsNotExist(err) { 39 | return make([]firmware.Credentials, 0), nil 40 | } 41 | return nil, err 42 | } 43 | if len(bytes) == 0 { 44 | return make([]firmware.Credentials, 0), nil 45 | } 46 | pt, err := decrypt([]byte(s.key), bytes) 47 | 48 | if err != nil { 49 | return nil, err 50 | } 51 | var seeds []firmware.Credentials 52 | err = json.Unmarshal(pt, &seeds) 53 | if err != nil { 54 | return nil, err 55 | } 56 | return seeds, nil 57 | } 58 | 59 | func (s *PlainText) UpdateKey(newKey []byte) error { 60 | copy(s.key, newKey) 61 | return nil 62 | } 63 | 64 | func (s *PlainText) ReadCredentials(id string) (*firmware.Credentials, error) { 65 | passwords, err := readCredentials(s) 66 | if err != nil { 67 | return nil, err 68 | } 69 | var password firmware.Credentials 70 | for _, s := range passwords { 71 | if s.Id == id { 72 | password = s 73 | break 74 | } 75 | } 76 | return &password, nil 77 | } 78 | 79 | func (s *PlainText) RemoveCredentials(id string) error { 80 | passwords, err := readCredentials(s) 81 | if err != nil { 82 | return err 83 | } 84 | var pos = -1 85 | for i, password := range passwords { 86 | if password.Id == id { 87 | pos = i 88 | break 89 | } 90 | } 91 | if pos > -1 { 92 | last := len(passwords) - 1 93 | passwords[pos] = passwords[last] 94 | return s.writeCredentialsToFile(passwords[:last]) 95 | } 96 | return fmt.Errorf("cant find seed for %s", id) 97 | } 98 | 99 | func backupFile(src string) (string, error) { 100 | _, err := os.Stat(src) 101 | if err != nil && os.IsNotExist(err) { 102 | return "", nil 103 | } 104 | parentDir := filepath.Dir(src) 105 | currentFile := filepath.Base(src) 106 | newFile := fmt.Sprintf("%s.%d", filepath.Join(parentDir, currentFile), time.Now().Unix()) 107 | dst, err := os.OpenFile(newFile, os.O_CREATE|os.O_RDWR, 0600) 108 | if err != nil { 109 | return "", err 110 | } 111 | srcF, err := os.Open(src) 112 | if err != nil { 113 | return "", err 114 | } 115 | _, err = io.Copy(dst, srcF) 116 | return newFile, err 117 | } 118 | 119 | func (s *PlainText) writeCredentialsToFile(seeds []firmware.Credentials) error { 120 | bytes, err := json.Marshal(seeds) 121 | if err != nil { 122 | return err 123 | } 124 | 125 | enc, err := encrypt([]byte(s.key), bytes) 126 | if err != nil { 127 | return err 128 | } 129 | 130 | if name, err := backupFile(s.filePath); err != nil { 131 | return fmt.Errorf("Can't backup file '%s' : %v", name, err) 132 | } 133 | 134 | return ioutil.WriteFile(s.filePath, enc, 0600) 135 | } 136 | 137 | func (s *PlainText) WriteCredentials(seed firmware.Credentials) error { 138 | 139 | seeds, err := readCredentials(s) 140 | 141 | if err != nil { 142 | return err 143 | } 144 | 145 | exI := -1 146 | 147 | for i, s := range seeds { 148 | if s.Id == seed.Id { 149 | exI = i 150 | break 151 | } 152 | } 153 | 154 | if exI == -1 { 155 | seeds = append(seeds, seed) 156 | } else { 157 | seeds[exI] = seed 158 | } 159 | 160 | return s.writeCredentialsToFile(seeds) 161 | 162 | } 163 | 164 | func (s *PlainText) ListCredentials() ([]firmware.Credentials, error) { 165 | seeds, err := readCredentials(s) 166 | if err != nil { 167 | return nil, err 168 | } 169 | 170 | return seeds, nil 171 | } 172 | 173 | func (s *PlainText) Close() error { 174 | return nil 175 | } 176 | 177 | func (s *PlainText) BackupStorage() (io.Reader, error) { 178 | data, err := ioutil.ReadFile(s.filePath) 179 | if err != nil { 180 | switch { 181 | case os.IsNotExist(err): 182 | return strings.NewReader("[]"), nil 183 | default: 184 | return nil, err 185 | } 186 | } 187 | pt, err := decrypt([]byte(s.key), data) 188 | if err != nil { 189 | return nil, err 190 | } 191 | return bytes.NewReader(pt), nil 192 | } 193 | 194 | func (s *PlainText) RestoreStorage(src io.Reader) error { 195 | data, err := ioutil.ReadAll(src) 196 | if err != nil { 197 | return err 198 | } 199 | var sample []firmware.Credentials 200 | if err := json.Unmarshal(data, &sample); err != nil { 201 | return err 202 | } 203 | if len(sample) == 0 { 204 | return ZeroLengthPasswordList 205 | } 206 | enc, err := encrypt(s.key, data) 207 | if err != nil { 208 | return err 209 | } 210 | _, err = backupFile(s.filePath) 211 | if err != nil { 212 | return err 213 | } 214 | return ioutil.WriteFile(s.filePath, enc, 0600) 215 | } 216 | 217 | var ( 218 | p PlainText 219 | _ CredentialsStorageRead = &p 220 | _ CredentialsStorageWrite = &p 221 | _ CredentialsStorageList = &p 222 | _ CredentialsStorageRemove = &p 223 | _ CredentialsStorageBackup = &p 224 | _ CredentialsStorageBackup = &p 225 | _ MutableKey = &p 226 | ) 227 | -------------------------------------------------------------------------------- /firmware/storage/file_storage_test.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "fmt" 5 | "io/ioutil" 6 | "os" 7 | "testing" 8 | 9 | "github.com/jdevelop/passkeeper/firmware" 10 | "github.com/stretchr/testify/assert" 11 | ) 12 | 13 | func TestCredsGeneration(t *testing.T) { 14 | os.Remove("/tmp/passkeeperseed_plain_text.txt") 15 | txt, err := NewPlainText("/tmp/passkeeperseed_plain_text.txt", []byte("a very very very very secret key")) 16 | assert.Nil(t, err, "Error creating plaintext storage") 17 | data, err := txt.LoadCredentials("HELLO") 18 | assert.Nil(t, err) 19 | err = txt.SaveCredentials(firmware.Credentials{Service: "HELLO", Secret: "WORLD"}) 20 | assert.Nil(t, err) 21 | data, err = txt.LoadCredentials("HELLO") 22 | assert.Nil(t, err) 23 | assert.Equal(t, firmware.Credentials{Service: "HELLO", Secret: "WORLD"}, *data) 24 | 25 | err = txt.SaveCredentials(firmware.Credentials{Service: "HELLO", Secret: "pas"}) 26 | assert.Nil(t, err) 27 | 28 | data, err = txt.LoadCredentials("HELLO") 29 | fmt.Println(err) 30 | assert.Nil(t, err) 31 | assert.Equal(t, firmware.Credentials{Service: "HELLO", Secret: "pas"}, *data) 32 | 33 | data, err = txt.LoadCredentials("HELLOW") 34 | assert.Nil(t, err) 35 | assert.Equal(t, firmware.Credentials{}, *data) 36 | 37 | creds, err := txt.ListCredentialss() 38 | assert.Nil(t, err) 39 | assert.EqualValues(t, creds, []string{"HELLO"}) 40 | txt.Close() 41 | } 42 | 43 | func TestBackupFile(t *testing.T) { 44 | const ( 45 | filename = "/tmp/passkeeper.test" 46 | content = "Oh my password" 47 | ) 48 | testDataFile, err := os.Create(filename) 49 | if err != nil { 50 | t.Fatal(err) 51 | } 52 | if _, err := testDataFile.Write([]byte(content)); err != nil { 53 | t.Fatal(err) 54 | } 55 | name, err := backupFile(testDataFile) 56 | if err != nil { 57 | t.Fatal(err) 58 | } 59 | data, err := ioutil.ReadFile(name) 60 | if err != nil { 61 | t.Fatal(err) 62 | } 63 | if string(data) != content { 64 | t.Fatalf("Expected '%s', got '%s' from %s", content, string(data), name) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /firmware/storage/storage.go: -------------------------------------------------------------------------------- 1 | package storage 2 | 3 | import ( 4 | "errors" 5 | "io" 6 | 7 | "github.com/jdevelop/passkeeper/firmware" 8 | ) 9 | 10 | var ZeroLengthPasswordList = errors.New("can't restore zero-length passwords") 11 | 12 | type CredentialsStorageRead interface { 13 | ReadCredentials(string) (*firmware.Credentials, error) 14 | } 15 | 16 | type CredentialsStorageWrite interface { 17 | WriteCredentials(firmware.Credentials) error 18 | } 19 | 20 | type CredentialsStorageList interface { 21 | ListCredentials() ([]firmware.Credentials, error) 22 | } 23 | 24 | type CredentialsStorageRemove interface { 25 | RemoveCredentials(string) error 26 | } 27 | 28 | type CredentialsStorageBackup interface { 29 | BackupStorage() (io.Reader, error) 30 | } 31 | 32 | type CredentialsStorageRestore interface { 33 | RestoreStorage(io.Reader) error 34 | } 35 | 36 | type MutableKey interface { 37 | UpdateKey([]byte) error 38 | } 39 | -------------------------------------------------------------------------------- /kicad/test-cad-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # GND 5 | # 6 | DEF GND #PWR 0 0 Y Y 1 F P 7 | F0 "#PWR" 0 -250 50 H I C CNN 8 | F1 "GND" 0 -150 50 H V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | DRAW 12 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 13 | X GND 1 0 0 0 D 50 50 1 1 W N 14 | ENDDRAW 15 | ENDDEF 16 | # 17 | # LCD16X2 18 | # 19 | DEF LCD16X2 DS 0 40 Y Y 1 F N 20 | F0 "DS" -800 400 50 H V C CNN 21 | F1 "LCD16X2" 700 400 50 H V C CNN 22 | F2 "WC1602A" 0 -50 50 H I C CIN 23 | F3 "" 0 0 50 H I C CNN 24 | ALIAS LCD-016N002L 25 | DRAW 26 | T 0 0 100 80 0 0 0 16x2 Normal 1 C C 27 | S -850 350 850 -350 0 1 0 f 28 | S -750 250 750 -100 0 1 20 N 29 | X VSS 1 -750 -500 150 U 40 40 1 1 W 30 | X VDD 2 -650 -500 150 U 40 40 1 1 W 31 | X VO 3 -550 -500 150 U 40 40 1 1 I 32 | X RS 4 -450 -500 150 U 40 40 1 1 I 33 | X R/W 5 -350 -500 150 U 40 40 1 1 I 34 | X E 6 -250 -500 150 U 40 40 1 1 I 35 | X D0 7 -150 -500 150 U 40 40 1 1 I 36 | X D1 8 -50 -500 150 U 40 40 1 1 I 37 | X D2 9 50 -500 150 U 40 40 1 1 I 38 | X D3 10 150 -500 150 U 40 40 1 1 I 39 | X D4 11 250 -500 150 U 40 40 1 1 I 40 | X D5 12 350 -500 150 U 40 40 1 1 I 41 | X D6 13 450 -500 150 U 40 40 1 1 I 42 | X D7 14 550 -500 150 U 40 40 1 1 I 43 | X LED+ 15 650 -500 150 U 40 40 1 1 P 44 | X LED- 16 750 -500 150 U 40 40 1 1 P 45 | ENDDRAW 46 | ENDDEF 47 | # 48 | # LED 49 | # 50 | DEF LED D 0 40 Y N 1 F N 51 | F0 "D" 0 100 50 H V C CNN 52 | F1 "LED" 0 -100 50 H V C CNN 53 | F2 "" 0 0 50 H I C CNN 54 | F3 "" 0 0 50 H I C CNN 55 | $FPLIST 56 | LED* 57 | $ENDFPLIST 58 | DRAW 59 | P 2 0 1 8 -50 -50 -50 50 N 60 | P 2 0 1 0 -50 0 50 0 N 61 | P 4 0 1 8 50 -50 50 50 -50 0 50 -50 N 62 | P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N 63 | P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N 64 | X K 1 -150 0 100 R 50 50 1 1 P 65 | X A 2 150 0 100 L 50 50 1 1 P 66 | ENDDRAW 67 | ENDDEF 68 | # 69 | # R 70 | # 71 | DEF R R 0 0 N Y 1 F N 72 | F0 "R" 80 0 50 V V C CNN 73 | F1 "R" 0 0 50 V V C CNN 74 | F2 "" -70 0 50 V I C CNN 75 | F3 "" 0 0 50 H I C CNN 76 | $FPLIST 77 | R_* 78 | R_* 79 | $ENDFPLIST 80 | DRAW 81 | S -40 -100 40 100 0 1 10 N 82 | X ~ 1 0 150 50 D 50 50 1 1 P 83 | X ~ 2 0 -150 50 U 50 50 1 1 P 84 | ENDDRAW 85 | ENDDEF 86 | # 87 | #End Library 88 | -------------------------------------------------------------------------------- /kicad/test-cad.bak: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:test-cad-cache 32 | EELAYER 25 0 33 | EELAYER END 34 | $Descr A4 11693 8268 35 | encoding utf-8 36 | Sheet 1 1 37 | Title "" 38 | Date "2017-05-06" 39 | Rev "" 40 | Comp "" 41 | Comment1 "" 42 | Comment2 "" 43 | Comment3 "" 44 | Comment4 "" 45 | $EndDescr 46 | $Comp 47 | L LCD16X2 DS? 48 | U 1 1 590E7D4B 49 | P 2650 1100 50 | F 0 "DS?" H 1850 1500 50 0000 C CNN 51 | F 1 "LCD16X2" H 3350 1500 50 0000 C CNN 52 | F 2 "WC1602A" H 2650 1050 50 0001 C CIN 53 | F 3 "" H 2650 1100 50 0001 C CNN 54 | 1 2650 1100 55 | 1 0 0 -1 56 | $EndComp 57 | $Comp 58 | L CONN_02X11 J? 59 | U 1 1 590E7E8B 60 | P 2400 2350 61 | F 0 "J?" H 2400 2950 50 0000 C CNN 62 | F 1 "CONN_02X11" V 2400 2350 50 0000 C CNN 63 | F 2 "" H 2400 1150 50 0001 C CNN 64 | F 3 "" H 2400 1150 50 0001 C CNN 65 | 1 2400 2350 66 | 0 1 1 0 67 | $EndComp 68 | Wire Wire Line 69 | 3400 1950 3400 1600 70 | Wire Wire Line 71 | 1900 1950 3400 1950 72 | Wire Wire Line 73 | 1900 1600 1900 1950 74 | Wire Wire Line 75 | 1900 1950 1900 2100 76 | Wire Wire Line 77 | 2300 1950 2300 1600 78 | Connection ~ 1900 1950 79 | Wire Wire Line 80 | 2000 1600 2000 2000 81 | Wire Wire Line 82 | 2000 2000 2000 2100 83 | Wire Wire Line 84 | 2200 1600 2200 2100 85 | Wire Wire Line 86 | 2400 1600 2400 2100 87 | Wire Wire Line 88 | 3300 2000 3300 1600 89 | Wire Wire Line 90 | 1600 2000 2000 2000 91 | Wire Wire Line 92 | 2000 2000 3300 2000 93 | Connection ~ 2000 2000 94 | Wire Wire Line 95 | 3200 1600 3200 2100 96 | Wire Wire Line 97 | 3200 2100 2900 2100 98 | Wire Wire Line 99 | 3100 1600 3100 2050 100 | Wire Wire Line 101 | 3100 2050 2800 2050 102 | Wire Wire Line 103 | 2800 2050 2800 2100 104 | Wire Wire Line 105 | 3000 1600 3000 1900 106 | Wire Wire Line 107 | 3000 1900 2700 1900 108 | Wire Wire Line 109 | 2700 1900 2700 2100 110 | Wire Wire Line 111 | 2900 1600 2900 1850 112 | Wire Wire Line 113 | 2900 1850 2600 1850 114 | Wire Wire Line 115 | 2600 1850 2600 2100 116 | $Comp 117 | L R R? 118 | U 1 1 5910552A 119 | P 1600 1850 120 | F 0 "R?" V 1680 1850 50 0000 C CNN 121 | F 1 "R" V 1600 1850 50 0000 C CNN 122 | F 2 "" V 1530 1850 50 0001 C CNN 123 | F 3 "" H 1600 1850 50 0001 C CNN 124 | 1 1600 1850 125 | 1 0 0 -1 126 | $EndComp 127 | Wire Wire Line 128 | 2100 1600 2100 1700 129 | Wire Wire Line 130 | 2100 1700 1600 1700 131 | $EndSCHEMATC 132 | -------------------------------------------------------------------------------- /kicad/test-cad.kicad_pcb: -------------------------------------------------------------------------------- 1 | (kicad_pcb (version 4) (host kicad "dummy file") ) 2 | -------------------------------------------------------------------------------- /kicad/test-cad.pro: -------------------------------------------------------------------------------- 1 | update=Tue 02 May 2017 10:13:18 PM EDT 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [eeschema] 27 | version=1 28 | LibDir= 29 | [eeschema/libraries] 30 | LibName1=power 31 | LibName2=device 32 | LibName3=transistors 33 | LibName4=conn 34 | LibName5=linear 35 | LibName6=regul 36 | LibName7=74xx 37 | LibName8=cmos4000 38 | LibName9=adc-dac 39 | LibName10=memory 40 | LibName11=xilinx 41 | LibName12=microcontrollers 42 | LibName13=dsp 43 | LibName14=microchip 44 | LibName15=analog_switches 45 | LibName16=motorola 46 | LibName17=texas 47 | LibName18=intel 48 | LibName19=audio 49 | LibName20=interface 50 | LibName21=digital-audio 51 | LibName22=philips 52 | LibName23=display 53 | LibName24=cypress 54 | LibName25=siliconi 55 | LibName26=opto 56 | LibName27=atmel 57 | LibName28=contrib 58 | LibName29=valves 59 | [general] 60 | version=1 61 | [schematic_editor] 62 | version=1 63 | PageLayoutDescrFile= 64 | PlotDirectoryName= 65 | SubpartIdSeparator=0 66 | SubpartFirstId=65 67 | NetFmtName= 68 | SpiceForceRefPrefix=0 69 | SpiceUseNetNumbers=0 70 | LabSize=60 71 | -------------------------------------------------------------------------------- /kicad/test-cad.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:test-cad-cache 32 | EELAYER 25 0 33 | EELAYER END 34 | $Descr A4 11693 8268 35 | encoding utf-8 36 | Sheet 1 1 37 | Title "" 38 | Date "2017-05-06" 39 | Rev "" 40 | Comp "" 41 | Comment1 "" 42 | Comment2 "" 43 | Comment3 "" 44 | Comment4 "" 45 | $EndDescr 46 | $Comp 47 | L LCD16X2 DS? 48 | U 1 1 590E7D4B 49 | P 2650 1100 50 | F 0 "DS?" H 1850 1500 50 0000 C CNN 51 | F 1 "LCD16X2" H 3350 1500 50 0000 C CNN 52 | F 2 "WC1602A" H 2650 1050 50 0001 C CIN 53 | F 3 "" H 2650 1100 50 0001 C CNN 54 | 1 2650 1100 55 | 1 0 0 -1 56 | $EndComp 57 | Wire Wire Line 58 | 3400 1950 3400 1600 59 | Wire Wire Line 60 | 1900 1950 3400 1950 61 | Wire Wire Line 62 | 1900 1600 1900 2100 63 | Connection ~ 1900 1950 64 | Wire Wire Line 65 | 2000 1600 2000 2100 66 | Wire Wire Line 67 | 2200 1600 2200 2100 68 | Wire Wire Line 69 | 2400 1600 2400 2100 70 | Wire Wire Line 71 | 3300 2000 3300 1600 72 | Wire Wire Line 73 | 1600 2000 3300 2000 74 | Connection ~ 2000 2000 75 | Wire Wire Line 76 | 3200 1600 3200 2100 77 | Wire Wire Line 78 | 3200 2100 2900 2100 79 | Wire Wire Line 80 | 3100 1600 3100 2050 81 | Wire Wire Line 82 | 3100 2050 2800 2050 83 | Wire Wire Line 84 | 2800 2050 2800 2100 85 | Wire Wire Line 86 | 3000 1600 3000 1900 87 | Wire Wire Line 88 | 3000 1900 2700 1900 89 | Wire Wire Line 90 | 2700 1900 2700 2100 91 | Wire Wire Line 92 | 2900 1600 2900 1850 93 | Wire Wire Line 94 | 2900 1850 2600 1850 95 | Wire Wire Line 96 | 2600 1850 2600 2100 97 | $Comp 98 | L R 2.2KOm 99 | U 1 1 5910552A 100 | P 1600 1850 101 | F 0 "2.2KOm" V 1680 1850 50 0000 C CNN 102 | F 1 "R" V 1600 1850 50 0000 C CNN 103 | F 2 "" V 1530 1850 50 0001 C CNN 104 | F 3 "" H 1600 1850 50 0001 C CNN 105 | 1 1600 1850 106 | 1 0 0 -1 107 | $EndComp 108 | Wire Wire Line 109 | 2100 1600 2100 1700 110 | Wire Wire Line 111 | 2100 1700 1600 1700 112 | $Comp 113 | L LED D? 114 | U 1 1 59152D0F 115 | P 1700 2700 116 | F 0 "D?" H 1700 2800 50 0000 C CNN 117 | F 1 "LED" H 1700 2600 50 0000 C CNN 118 | F 2 "" H 1700 2700 50 0001 C CNN 119 | F 3 "" H 1700 2700 50 0001 C CNN 120 | 1 1700 2700 121 | 1 0 0 -1 122 | $EndComp 123 | $Comp 124 | L LED D? 125 | U 1 1 59152D62 126 | P 2300 2700 127 | F 0 "D?" H 2300 2800 50 0000 C CNN 128 | F 1 "LED" H 2300 2600 50 0000 C CNN 129 | F 2 "" H 2300 2700 50 0001 C CNN 130 | F 3 "" H 2300 2700 50 0001 C CNN 131 | 1 2300 2700 132 | 1 0 0 -1 133 | $EndComp 134 | $Comp 135 | L LED D? 136 | U 1 1 59152D9B 137 | P 2850 2700 138 | F 0 "D?" H 2850 2800 50 0000 C CNN 139 | F 1 "LED" H 2850 2600 50 0000 C CNN 140 | F 2 "" H 2850 2700 50 0001 C CNN 141 | F 3 "" H 2850 2700 50 0001 C CNN 142 | 1 2850 2700 143 | 1 0 0 -1 144 | $EndComp 145 | $Comp 146 | L LED D? 147 | U 1 1 59152DC0 148 | P 3500 2700 149 | F 0 "D?" H 3500 2800 50 0000 C CNN 150 | F 1 "LED" H 3500 2600 50 0000 C CNN 151 | F 2 "" H 3500 2700 50 0001 C CNN 152 | F 3 "" H 3500 2700 50 0001 C CNN 153 | 1 3500 2700 154 | 1 0 0 -1 155 | $EndComp 156 | $Comp 157 | L GND #PWR? 158 | U 1 1 59152E59 159 | P 1150 2600 160 | F 0 "#PWR?" H 1150 2350 50 0001 C CNN 161 | F 1 "GND" H 1150 2450 50 0000 C CNN 162 | F 2 "" H 1150 2600 50 0001 C CNN 163 | F 3 "" H 1150 2600 50 0001 C CNN 164 | 1 1150 2600 165 | 1 0 0 -1 166 | $EndComp 167 | Wire Wire Line 168 | 1550 2700 1150 2700 169 | Wire Wire Line 170 | 1150 2600 1150 2900 171 | Wire Wire Line 172 | 2150 2700 2050 2700 173 | Wire Wire Line 174 | 2050 2700 2050 2900 175 | Wire Wire Line 176 | 1150 2900 3350 2900 177 | Wire Wire Line 178 | 2700 2900 2700 2700 179 | Connection ~ 2050 2900 180 | Wire Wire Line 181 | 3350 2900 3350 2700 182 | Connection ~ 2700 2900 183 | Wire Wire Line 184 | 1900 2100 1150 2100 185 | Wire Wire Line 186 | 1150 2100 1150 2650 187 | Connection ~ 1150 2650 188 | Wire Wire Line 189 | 2300 1600 2300 1950 190 | Connection ~ 2300 1950 191 | $EndSCHEMATC 192 | -------------------------------------------------------------------------------- /kicad/test-cad/LCD.bck: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | $CMP 7SEGMENT_CA 4 | D Generic 7 segment display, common anode 5 | K LED 6 | $ENDCMP 7 | # 8 | $CMP 7SEGMENT_CC 9 | D Generic 7 segment display, common cathode 10 | K LED 11 | $ENDCMP 12 | # 13 | $CMP AG12864E 14 | D Graphics Display 128x64px, 8b parallel, 1/64 Duty, 3.3V or 5V VDD 15 | K LCD STN Graphics 128x64 16 | F https://www.digchip.com/datasheets/parts/datasheet/1121/AG-12864E-pdf.php 17 | $ENDCMP 18 | # 19 | $CMP CA56-12CGKWA 20 | D 4 digit 7 segment Green LED, common anode 21 | K 4 digit 7 segment Green LED, common anode 22 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12CGKWA(Ver.9A).pdf 23 | $ENDCMP 24 | # 25 | $CMP CA56-12EWA 26 | D 4 digit 7 segment high efficiency red LED, common anode 27 | K 4 digit 7 segment high efficiency red LED, common anode 28 | F http://www.kingbrightusa.com/images/catalog/SPEC/CA56-12EWA.pdf 29 | $ENDCMP 30 | # 31 | $CMP CA56-12SEKWA 32 | D 4 digit 7 segment super bright orange LED, common anode 33 | K 4 digit 7 segment super bright orange LED, common anode 34 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12SEKWA(Ver.7A).pdf 35 | $ENDCMP 36 | # 37 | $CMP CA56-12SRWA 38 | D 4 digit 7 segment super bright red LED, common anode 39 | K 4 digit 7 segment super bright red LED, common anode 40 | F http://www.kingbrightusa.com/images/catalog/SPEC/CA56-12SRWA.pdf 41 | $ENDCMP 42 | # 43 | $CMP CA56-12SURKWA 44 | D 4 digit 7 segment hyper red LED, common anode 45 | K 4 digit 7 segment hyper red LED, common anode 46 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12SURKWA(Ver.8A).pdf 47 | $ENDCMP 48 | # 49 | $CMP CA56-12SYKWA 50 | D 4 digit 7 segment super bright yellow LED, common anode 51 | K 4 digit 7 segment super bright yellow LED, common anode 52 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12SYKWA(Ver.6A).pdf 53 | $ENDCMP 54 | # 55 | $CMP CC56-12CGKWA 56 | D 4 digit 7 segment green LED, common cathode 57 | K 4 digit 7 segment green LED, common cathode 58 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12CGKWA(Ver.8A).pdf 59 | $ENDCMP 60 | # 61 | $CMP CC56-12EWA 62 | D 4 digit 7 segment high efficiency red LED, common cathode 63 | K 4 digit 7 segment high efficiency red LED, common cathode 64 | F http://www.kingbrightusa.com/images/catalog/SPEC/CA56-12EWA.pdf 65 | $ENDCMP 66 | # 67 | $CMP CC56-12GWA 68 | D 4 digit 7 segment green LED, common cathode 69 | K 4 digit 7 segment green LED, common cathode 70 | F http://www.kingbrightusa.com/images/catalog/SPEC/CC56-12GWA.pdf 71 | $ENDCMP 72 | # 73 | $CMP CC56-12SEKWA 74 | D 4 digit 7 segment super bright orange LED, common cathode 75 | K 4 digit 7 segment super bright orange LED, common cathode 76 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12SEKWA(Ver.7A).pdf 77 | $ENDCMP 78 | # 79 | $CMP CC56-12SRWA 80 | D 4 digit 7 segment super bright red LED, common cathode 81 | K 4 digit 7 segment super bright red LED, common cathode 82 | F http://www.kingbrightusa.com/images/catalog/SPEC/CC56-12SRWA.pdf 83 | $ENDCMP 84 | # 85 | $CMP CC56-12SURKWA 86 | D 4 digit 7 segment hyper red LED, common cathode 87 | K 4 digit 7 segment hyper red LED, common cathode 88 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12SURKWA(Ver.7A).pdf 89 | $ENDCMP 90 | # 91 | $CMP CC56-12SYKWA 92 | D 4 digit 7 segment super bright yellow LED, common cathode 93 | K 4 digit 7 segment super bright yellow LED, common cathode 94 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12SYKWA(Ver.6A).pdf 95 | $ENDCMP 96 | # 97 | $CMP CC56-12YWA 98 | D 4 digit 7 segment yellow LED, common cathode 99 | K 4 digit 7 segment yellow LED, common cathode 100 | F http://www.kingbrightusa.com/images/catalog/SPEC/CC56-12YWA.pdf 101 | $ENDCMP 102 | # 103 | $CMP DA04-11 104 | D 2 x 7 Segments common A. 105 | K 7 SEGMENTS 106 | F Display/display-DA04-11GWA.pdf 107 | $ENDCMP 108 | # 109 | $CMP DC04-11 110 | D 2 x 7 Segments common K. 111 | K 7 SEGMENTS 112 | F Display/display-DC04-11GWA.pdf 113 | $ENDCMP 114 | # 115 | $CMP DE113-XX-XX 116 | D 3 and half digit 7 segment transmissive standard LCD with LO BAT, pin length 7.5mm, -20°C to +70°C, 3V-5V VDD 117 | K 3 and half digit 7 segment transmissive LCD with LO BAT 118 | F http://www.display-elektronik.de/filter/DE113-MS-20_75.pdf 119 | $ENDCMP 120 | # 121 | $CMP DE114-RS-20 122 | D 3 and half digit 7 segment reflective standard LCD with ~~ and BAT, pin length 6.35mm, -20°C to +70°C, 3V-5V VDD 123 | K 3 and half digit 7 segment reflective LCD with ~~ and BAT 124 | F http://www.display-elektronik.de/filter/DE114-RS-20_635.pdf 125 | $ENDCMP 126 | # 127 | $CMP DE170-XX-XX 128 | D 3 and half digit 7 segment reflective standard LCD with arrow, pin length 7.5mm, -20°C to +70°C, 3V-5V VDD 129 | K 3 and half digit 7 segment reflective LCD with arrow 130 | F http://www.display-elektronik.de/filter/DE170-RS-20_75.pdf 131 | $ENDCMP 132 | # 133 | $CMP DISPLAY 134 | D Afficheur LCD nLignes 135 | K DEV 136 | $ENDCMP 137 | # 138 | $CMP DOT-BAR 139 | D GRAPH unit 140 | K BAR DOT 141 | F Display/HDSP-48xx.pdf 142 | $ENDCMP 143 | # 144 | $CMP DOT-BAR2 145 | D BAR GRAPH Block 146 | K BAR DOT 147 | F Display/HDSP-48xx.pdf 148 | $ENDCMP 149 | # 150 | $CMP EA_DOGS104B-A 151 | D LCD 4x10 character display blue transmissive background, +3.3V VDD, I2C or SPI 152 | K LCD 4x10 character display blue transmissive background, +3.3V VDD, I2C or SPI 153 | F http://www.lcd-module.com/fileadmin/eng/pdf/doma/dogs104e.pdf 154 | $ENDCMP 155 | # 156 | $CMP EA_DOGXL160-7 157 | D EA DOGXL160-7 Graphical Display 160x104 no back light I2C SPI 2.7-3.3V 158 | K Graphic display EA DOGXL160-7 159 | F http://www.lcd-module.com/eng/pdf/grafik/dogxl160-7e.pdf 160 | $ENDCMP 161 | # 162 | $CMP EA_T123X-I2C 163 | D 3 Lines, 12 character alpha numeric LCD, transreflective STN and FSTN Gray, I2C, single or dual power 164 | K 3 Lines, 12 character alpha numeric LCD, transreflective STN and FSTN Gray, I2C, single or dual power 165 | F http://www.lcd-module.de/pdf/doma/t123-i2c.pdf 166 | $ENDCMP 167 | # 168 | $CMP ELD-426SYGWA 169 | D Double 7 segment brilliant yellow green LED common anode 170 | K Double 7 segment brilliant yellow green LED common anode 171 | F http://www.everlight.com/file/ProductFile/D426SYGWA-S530-E2.pdf 172 | $ENDCMP 173 | # 174 | $CMP HDSM-441B 175 | D Double 7 segment Blue LED common anode SMD mount 176 | K Double 7 segment Blue LED common anode SMD mount 177 | F https://docs.broadcom.com/docs/AV02-1589EN 178 | $ENDCMP 179 | # 180 | $CMP HDSM-443B 181 | D Double 7 segment Blue LED common cathode SMD mount 182 | K Double 7 segment Blue LED common cathode SMD mount 183 | F https://docs.broadcom.com/docs/AV02-1589EN 184 | $ENDCMP 185 | # 186 | $CMP HDSM-541B 187 | D Double 7 segment Blue LED common anode SMD mount 188 | K Double 7 segment Blue LED common anode SMD mount 189 | F https://docs.broadcom.com/docs/AV02-1588EN 190 | $ENDCMP 191 | # 192 | $CMP HDSM-543B 193 | D Double 7 segment Blue LED common cathode SMD mount 194 | K Double 7 segment Blue LED common cathode SMD mount 195 | F https://docs.broadcom.com/docs/AV02-1588EN 196 | $ENDCMP 197 | # 198 | $CMP HY1602E 199 | D LCD 16x2 Alphanumeric 16pin Blue/Yellow/Green Backlight, 8bit parallel, 5V VDD 200 | K LCD 16x2 Alphanumeric 16pin Blue/Yellow/Green Backlight 201 | F http://www.icbank.com/data/ICBShop/board/HY1602E.pdf 202 | $ENDCMP 203 | # 204 | $CMP ILI9341_LCD_Breakout 205 | D ILI9341 controller, SPI TFT LCD Display, 9-pin breakout PCB, 4-pin SD card interface, 5V/3.3V 206 | K GLCD TFT ILI9341 320x240 207 | F www.newhavendisplay.com/app_notes/ILI9341.pdf 208 | $ENDCMP 209 | # 210 | $CMP KCSA02-105 211 | D One digit 7 segment hyper red LED, common anode 212 | K One digit 7 segment hyper red LED, common anode 213 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-105(Ver.10A).pdf 214 | $ENDCMP 215 | # 216 | $CMP KCSA02-106 217 | D One digit 7 segment super bright orange LED, common anode 218 | K One digit 7 segment super bright orange LED, common anode 219 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-106(Ver.11A).pdf 220 | $ENDCMP 221 | # 222 | $CMP KCSA02-107 223 | D One digit 7 segment super bright orange LED, common anode 224 | K One digit 7 segment super bright orange LED, common anode 225 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-107(Ver.10A).pdf 226 | $ENDCMP 227 | # 228 | $CMP KCSA02-123 229 | D One digit 7 segment green LED, common anode 230 | K One digit 7 segment green LED, common anode 231 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-123(Ver.9A).pdf 232 | $ENDCMP 233 | # 234 | $CMP KCSA02-136 235 | D One digit 7 segment blue LED, common anode 236 | K One digit 7 segment blue LED, common anode 237 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-136(Ver.7B).pdf 238 | $ENDCMP 239 | # 240 | $CMP KCSC02-105 241 | D One digit 7 segment hyper red LED, common cathode 242 | K One digit 7 segment hyper red LED, common cathode 243 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-105(Ver.9A).pdf 244 | $ENDCMP 245 | # 246 | $CMP KCSC02-106 247 | D One digit 7 segment super bright orange LED, common cathode 248 | K One digit 7 segment super bright orange LED, common cathode 249 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-106(Ver.10A).pdf 250 | $ENDCMP 251 | # 252 | $CMP KCSC02-107 253 | D One digit 7 segment super bright orange LED, common cathode 254 | K One digit 7 segment super bright orange LED, common cathode 255 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-106(Ver.10A).pdf 256 | $ENDCMP 257 | # 258 | $CMP KCSC02-123 259 | D One digit 7 segment green LED, common cathode 260 | K One digit 7 segment green LED, common cathode 261 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-123(Ver.10A).pdf 262 | $ENDCMP 263 | # 264 | $CMP KCSC02-136 265 | D One digit 7 segment blue LED, common cathode 266 | K One digit 7 segment blue LED, common cathode 267 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-136(Ver.6B).pdf 268 | $ENDCMP 269 | # 270 | $CMP LCD-016N002L 271 | D LCD 12x2, 8 bit parallel bus, 3V or 5V VDD 272 | K LCD 12x2 273 | F http://www.vishay.com/docs/37299/37299.pdf 274 | $ENDCMP 275 | # 276 | $CMP LM16255K 277 | D 2 Lines, 12 character reflective LCD 278 | K 2 Lines, 12 character reflective LCD 279 | F http://pdf.datasheetcatalog.com/datasheet/Sharp/mXvtrzw.pdf 280 | $ENDCMP 281 | # 282 | $CMP LTS-6960HR 283 | D DISPLAY 7 SEGMENTS common A. 284 | K 7 SEGMENTS 285 | F Display/LTC-6960HR.pdf 286 | $ENDCMP 287 | # 288 | $CMP LTS-6980HR 289 | D DISPLAY 7 SEGMENTS common K 290 | K 7 SEGMENTS 291 | F Display/LTC-6980HR.pdf 292 | $ENDCMP 293 | # 294 | $CMP MAN3410A 295 | D Single digit 7 segment high efficient green LED common anode right hand decimal 296 | K 7 segemnt LED common anode 297 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 298 | $ENDCMP 299 | # 300 | $CMP MAN3420A 301 | D Single digit 7 segment high efficient green LED common anode left hand decimal 302 | K 7 segemnt LED common anode 303 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 304 | $ENDCMP 305 | # 306 | $CMP MAN3440A 307 | D Single digit 7 segment high efficient green LED common anode right hand decimal 308 | K 7 segemnt LED common anode 309 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 310 | $ENDCMP 311 | # 312 | $CMP MAN3610A 313 | D Single digit 7 segment orange LED common anode right hand decimal 314 | K Orange 7 segemnt LED common anode 315 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 316 | $ENDCMP 317 | # 318 | $CMP MAN3620A 319 | D Single digit 7 segment orange LED common anode left hand decimal 320 | K Orange 7 segemnt LED common anode 321 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 322 | $ENDCMP 323 | # 324 | $CMP MAN3630A 325 | D Overflow 7 segment orange LED common anode 326 | K Orange 7 segemnt LED common anode 327 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 328 | $ENDCMP 329 | # 330 | $CMP MAN3640A 331 | D Single digit 7 segment orange LED common anode right hand decimal 332 | K Orange 7 segemnt LED common anode 333 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 334 | $ENDCMP 335 | # 336 | $CMP MAN3810A 337 | D Single digit 7 segment yellow LED common anode right hand decimal 338 | K Yellow 7 segemnt LED common anode 339 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 340 | $ENDCMP 341 | # 342 | $CMP MAN3820A 343 | D Single digit 7 segment yellow LED common anode left hand decimal 344 | K Yellow 7 segemnt LED common anode 345 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 346 | $ENDCMP 347 | # 348 | $CMP MAN3840A 349 | D Single digit 7 segment yellow LED common anode right hand decimal 350 | K Yellow 7 segemnt LED common anode 351 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 352 | $ENDCMP 353 | # 354 | $CMP MAN71A 355 | D Single digit 7 segment red LED common anode right hand decimal 356 | K Red 7 segemnt LED common anode 357 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 358 | $ENDCMP 359 | # 360 | $CMP MAN72A 361 | D Single digit 7 segment red LED common anode left hand decimal 362 | K Red 7 segemnt LED common anode 363 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 364 | $ENDCMP 365 | # 366 | $CMP MAN73A 367 | D Overflow 7 segment red LED common anode 368 | K Red Overflow 7 segemnt LED common anode 369 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 370 | $ENDCMP 371 | # 372 | $CMP MAN74A 373 | D Single digit 7 segment red LED common anode right hand decimal 374 | K Red 7 segemnt LED common anode 375 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 376 | $ENDCMP 377 | # 378 | $CMP RC1602A 379 | D LCD 16x2 Alphanumeric gray backlight, 3 or 5 V VDD 380 | K LCD 16x2 Alphanumeric gray backlight, 3 or 5 V VDD 381 | F http://www.raystar-optronics.com/down.php?ProID=18 382 | $ENDCMP 383 | # 384 | $CMP RC1602A-GHW-ESX 385 | D RC1602A-GHW-ESX 386 | K LCD 16x2 Alphanumeric 16pin Gray Backlight 387 | F http://www.raystar-optronics.com/down.php?ProID=18 388 | $ENDCMP 389 | # 390 | $CMP SBC18-11EGWA 391 | D Single digit 7 segment hyper red and green LED display, common cathode 392 | K 7 segment LED display common cathode 393 | F http://www.kingbrightusa.com/images/catalog/SPEC/SBC18-11EGWA.pdf 394 | $ENDCMP 395 | # 396 | $CMP SBC18-11SURKCGKWA 397 | D Single digit 7 segment hyper red and green LED display, common cathode 398 | K 7 segment LED display common cathode 399 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/SBC18-11SURKCGKWA(Ver.6A).pdf 400 | $ENDCMP 401 | # 402 | $CMP WC1602A 403 | D LCD 16x2 Alphanumeric , 8 bit parallel bus, 5V VDD 404 | K LCD 16x2 Alphanumeric Green Backlight 405 | F http://www.wincomlcd.com/pdf/WC1602A-SFYLYHTC06.pdf 406 | $ENDCMP 407 | # 408 | #End Doc Library 409 | -------------------------------------------------------------------------------- /kicad/test-cad/LCD.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | $CMP 7SEGMENT_CA 4 | D Generic 7 segment display, common anode 5 | K LED 6 | $ENDCMP 7 | # 8 | $CMP 7SEGMENT_CC 9 | D Generic 7 segment display, common cathode 10 | K LED 11 | $ENDCMP 12 | # 13 | $CMP AG12864E 14 | D Graphics Display 128x64px, 8b parallel, 1/64 Duty, 3.3V or 5V VDD 15 | K LCD STN Graphics 128x64 16 | F https://www.digchip.com/datasheets/parts/datasheet/1121/AG-12864E-pdf.php 17 | $ENDCMP 18 | # 19 | $CMP CA56-12CGKWA 20 | D 4 digit 7 segment Green LED, common anode 21 | K 4 digit 7 segment Green LED, common anode 22 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12CGKWA(Ver.9A).pdf 23 | $ENDCMP 24 | # 25 | $CMP CA56-12EWA 26 | D 4 digit 7 segment high efficiency red LED, common anode 27 | K 4 digit 7 segment high efficiency red LED, common anode 28 | F http://www.kingbrightusa.com/images/catalog/SPEC/CA56-12EWA.pdf 29 | $ENDCMP 30 | # 31 | $CMP CA56-12SEKWA 32 | D 4 digit 7 segment super bright orange LED, common anode 33 | K 4 digit 7 segment super bright orange LED, common anode 34 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12SEKWA(Ver.7A).pdf 35 | $ENDCMP 36 | # 37 | $CMP CA56-12SRWA 38 | D 4 digit 7 segment super bright red LED, common anode 39 | K 4 digit 7 segment super bright red LED, common anode 40 | F http://www.kingbrightusa.com/images/catalog/SPEC/CA56-12SRWA.pdf 41 | $ENDCMP 42 | # 43 | $CMP CA56-12SURKWA 44 | D 4 digit 7 segment hyper red LED, common anode 45 | K 4 digit 7 segment hyper red LED, common anode 46 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12SURKWA(Ver.8A).pdf 47 | $ENDCMP 48 | # 49 | $CMP CA56-12SYKWA 50 | D 4 digit 7 segment super bright yellow LED, common anode 51 | K 4 digit 7 segment super bright yellow LED, common anode 52 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CA56-12SYKWA(Ver.6A).pdf 53 | $ENDCMP 54 | # 55 | $CMP CC56-12CGKWA 56 | D 4 digit 7 segment green LED, common cathode 57 | K 4 digit 7 segment green LED, common cathode 58 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12CGKWA(Ver.8A).pdf 59 | $ENDCMP 60 | # 61 | $CMP CC56-12EWA 62 | D 4 digit 7 segment high efficiency red LED, common cathode 63 | K 4 digit 7 segment high efficiency red LED, common cathode 64 | F http://www.kingbrightusa.com/images/catalog/SPEC/CA56-12EWA.pdf 65 | $ENDCMP 66 | # 67 | $CMP CC56-12GWA 68 | D 4 digit 7 segment green LED, common cathode 69 | K 4 digit 7 segment green LED, common cathode 70 | F http://www.kingbrightusa.com/images/catalog/SPEC/CC56-12GWA.pdf 71 | $ENDCMP 72 | # 73 | $CMP CC56-12SEKWA 74 | D 4 digit 7 segment super bright orange LED, common cathode 75 | K 4 digit 7 segment super bright orange LED, common cathode 76 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12SEKWA(Ver.7A).pdf 77 | $ENDCMP 78 | # 79 | $CMP CC56-12SRWA 80 | D 4 digit 7 segment super bright red LED, common cathode 81 | K 4 digit 7 segment super bright red LED, common cathode 82 | F http://www.kingbrightusa.com/images/catalog/SPEC/CC56-12SRWA.pdf 83 | $ENDCMP 84 | # 85 | $CMP CC56-12SURKWA 86 | D 4 digit 7 segment hyper red LED, common cathode 87 | K 4 digit 7 segment hyper red LED, common cathode 88 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12SURKWA(Ver.7A).pdf 89 | $ENDCMP 90 | # 91 | $CMP CC56-12SYKWA 92 | D 4 digit 7 segment super bright yellow LED, common cathode 93 | K 4 digit 7 segment super bright yellow LED, common cathode 94 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/CC56-12SYKWA(Ver.6A).pdf 95 | $ENDCMP 96 | # 97 | $CMP CC56-12YWA 98 | D 4 digit 7 segment yellow LED, common cathode 99 | K 4 digit 7 segment yellow LED, common cathode 100 | F http://www.kingbrightusa.com/images/catalog/SPEC/CC56-12YWA.pdf 101 | $ENDCMP 102 | # 103 | $CMP DA04-11 104 | D 2 x 7 Segments common A. 105 | K 7 SEGMENTS 106 | F Display/display-DA04-11GWA.pdf 107 | $ENDCMP 108 | # 109 | $CMP DC04-11 110 | D 2 x 7 Segments common K. 111 | K 7 SEGMENTS 112 | F Display/display-DC04-11GWA.pdf 113 | $ENDCMP 114 | # 115 | $CMP DE113-XX-XX 116 | D 3 and half digit 7 segment transmissive standard LCD with LO BAT, pin length 7.5mm, -20°C to +70°C, 3V-5V VDD 117 | K 3 and half digit 7 segment transmissive LCD with LO BAT 118 | F http://www.display-elektronik.de/filter/DE113-MS-20_75.pdf 119 | $ENDCMP 120 | # 121 | $CMP DE114-RS-20 122 | D 3 and half digit 7 segment reflective standard LCD with ~~ and BAT, pin length 6.35mm, -20°C to +70°C, 3V-5V VDD 123 | K 3 and half digit 7 segment reflective LCD with ~~ and BAT 124 | F http://www.display-elektronik.de/filter/DE114-RS-20_635.pdf 125 | $ENDCMP 126 | # 127 | $CMP DE170-XX-XX 128 | D 3 and half digit 7 segment reflective standard LCD with arrow, pin length 7.5mm, -20°C to +70°C, 3V-5V VDD 129 | K 3 and half digit 7 segment reflective LCD with arrow 130 | F http://www.display-elektronik.de/filter/DE170-RS-20_75.pdf 131 | $ENDCMP 132 | # 133 | $CMP DISPLAY 134 | D Afficheur LCD nLignes 135 | K DEV 136 | $ENDCMP 137 | # 138 | $CMP DOT-BAR 139 | D GRAPH unit 140 | K BAR DOT 141 | F Display/HDSP-48xx.pdf 142 | $ENDCMP 143 | # 144 | $CMP DOT-BAR2 145 | D BAR GRAPH Block 146 | K BAR DOT 147 | F Display/HDSP-48xx.pdf 148 | $ENDCMP 149 | # 150 | $CMP EA_DOGS104B-A 151 | D LCD 4x10 character display blue transmissive background, +3.3V VDD, I2C or SPI 152 | K LCD 4x10 character display blue transmissive background, +3.3V VDD, I2C or SPI 153 | F http://www.lcd-module.com/fileadmin/eng/pdf/doma/dogs104e.pdf 154 | $ENDCMP 155 | # 156 | $CMP EA_DOGXL160-7 157 | D EA DOGXL160-7 Graphical Display 160x104 no back light I2C SPI 2.7-3.3V 158 | K Graphic display EA DOGXL160-7 159 | F http://www.lcd-module.com/eng/pdf/grafik/dogxl160-7e.pdf 160 | $ENDCMP 161 | # 162 | $CMP EA_T123X-I2C 163 | D 3 Lines, 12 character alpha numeric LCD, transreflective STN and FSTN Gray, I2C, single or dual power 164 | K 3 Lines, 12 character alpha numeric LCD, transreflective STN and FSTN Gray, I2C, single or dual power 165 | F http://www.lcd-module.de/pdf/doma/t123-i2c.pdf 166 | $ENDCMP 167 | # 168 | $CMP ELD-426SYGWA 169 | D Double 7 segment brilliant yellow green LED common anode 170 | K Double 7 segment brilliant yellow green LED common anode 171 | F http://www.everlight.com/file/ProductFile/D426SYGWA-S530-E2.pdf 172 | $ENDCMP 173 | # 174 | $CMP HDSM-441B 175 | D Double 7 segment Blue LED common anode SMD mount 176 | K Double 7 segment Blue LED common anode SMD mount 177 | F https://docs.broadcom.com/docs/AV02-1589EN 178 | $ENDCMP 179 | # 180 | $CMP HDSM-443B 181 | D Double 7 segment Blue LED common cathode SMD mount 182 | K Double 7 segment Blue LED common cathode SMD mount 183 | F https://docs.broadcom.com/docs/AV02-1589EN 184 | $ENDCMP 185 | # 186 | $CMP HDSM-541B 187 | D Double 7 segment Blue LED common anode SMD mount 188 | K Double 7 segment Blue LED common anode SMD mount 189 | F https://docs.broadcom.com/docs/AV02-1588EN 190 | $ENDCMP 191 | # 192 | $CMP HDSM-543B 193 | D Double 7 segment Blue LED common cathode SMD mount 194 | K Double 7 segment Blue LED common cathode SMD mount 195 | F https://docs.broadcom.com/docs/AV02-1588EN 196 | $ENDCMP 197 | # 198 | $CMP HY1602E 199 | D LCD 16x2 Alphanumeric 16pin Blue/Yellow/Green Backlight, 8bit parallel, 5V VDD 200 | K LCD 16x2 Alphanumeric 16pin Blue/Yellow/Green Backlight 201 | F http://www.icbank.com/data/ICBShop/board/HY1602E.pdf 202 | $ENDCMP 203 | # 204 | $CMP ILI9341_LCD_Breakout 205 | D ILI9341 controller, SPI TFT LCD Display, 9-pin breakout PCB, 4-pin SD card interface, 5V/3.3V 206 | K GLCD TFT ILI9341 320x240 207 | F www.newhavendisplay.com/app_notes/ILI9341.pdf 208 | $ENDCMP 209 | # 210 | $CMP KCSA02-105 211 | D One digit 7 segment hyper red LED, common anode 212 | K One digit 7 segment hyper red LED, common anode 213 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-105(Ver.10A).pdf 214 | $ENDCMP 215 | # 216 | $CMP KCSA02-106 217 | D One digit 7 segment super bright orange LED, common anode 218 | K One digit 7 segment super bright orange LED, common anode 219 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-106(Ver.11A).pdf 220 | $ENDCMP 221 | # 222 | $CMP KCSA02-107 223 | D One digit 7 segment super bright orange LED, common anode 224 | K One digit 7 segment super bright orange LED, common anode 225 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-107(Ver.10A).pdf 226 | $ENDCMP 227 | # 228 | $CMP KCSA02-123 229 | D One digit 7 segment green LED, common anode 230 | K One digit 7 segment green LED, common anode 231 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-123(Ver.9A).pdf 232 | $ENDCMP 233 | # 234 | $CMP KCSA02-136 235 | D One digit 7 segment blue LED, common anode 236 | K One digit 7 segment blue LED, common anode 237 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSA02-136(Ver.7B).pdf 238 | $ENDCMP 239 | # 240 | $CMP KCSC02-105 241 | D One digit 7 segment hyper red LED, common cathode 242 | K One digit 7 segment hyper red LED, common cathode 243 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-105(Ver.9A).pdf 244 | $ENDCMP 245 | # 246 | $CMP KCSC02-106 247 | D One digit 7 segment super bright orange LED, common cathode 248 | K One digit 7 segment super bright orange LED, common cathode 249 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-106(Ver.10A).pdf 250 | $ENDCMP 251 | # 252 | $CMP KCSC02-107 253 | D One digit 7 segment super bright orange LED, common cathode 254 | K One digit 7 segment super bright orange LED, common cathode 255 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-106(Ver.10A).pdf 256 | $ENDCMP 257 | # 258 | $CMP KCSC02-123 259 | D One digit 7 segment green LED, common cathode 260 | K One digit 7 segment green LED, common cathode 261 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-123(Ver.10A).pdf 262 | $ENDCMP 263 | # 264 | $CMP KCSC02-136 265 | D One digit 7 segment blue LED, common cathode 266 | K One digit 7 segment blue LED, common cathode 267 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/KCSC02-136(Ver.6B).pdf 268 | $ENDCMP 269 | # 270 | $CMP LCD-016N002L 271 | D LCD 12x2, 8 bit parallel bus, 3V or 5V VDD 272 | K LCD 12x2 273 | F http://www.vishay.com/docs/37299/37299.pdf 274 | $ENDCMP 275 | # 276 | $CMP LM16255K 277 | D 2 Lines, 12 character reflective LCD 278 | K 2 Lines, 12 character reflective LCD 279 | F http://pdf.datasheetcatalog.com/datasheet/Sharp/mXvtrzw.pdf 280 | $ENDCMP 281 | # 282 | $CMP LTS-6960HR 283 | D DISPLAY 7 SEGMENTS common A. 284 | K 7 SEGMENTS 285 | F Display/LTC-6960HR.pdf 286 | $ENDCMP 287 | # 288 | $CMP LTS-6980HR 289 | D DISPLAY 7 SEGMENTS common K 290 | K 7 SEGMENTS 291 | F Display/LTC-6980HR.pdf 292 | $ENDCMP 293 | # 294 | $CMP MAN3410A 295 | D Single digit 7 segment high efficient green LED common anode right hand decimal 296 | K 7 segemnt LED common anode 297 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 298 | $ENDCMP 299 | # 300 | $CMP MAN3420A 301 | D Single digit 7 segment high efficient green LED common anode left hand decimal 302 | K 7 segemnt LED common anode 303 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 304 | $ENDCMP 305 | # 306 | $CMP MAN3440A 307 | D Single digit 7 segment high efficient green LED common anode right hand decimal 308 | K 7 segemnt LED common anode 309 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 310 | $ENDCMP 311 | # 312 | $CMP MAN3610A 313 | D Single digit 7 segment orange LED common anode right hand decimal 314 | K Orange 7 segemnt LED common anode 315 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 316 | $ENDCMP 317 | # 318 | $CMP MAN3620A 319 | D Single digit 7 segment orange LED common anode left hand decimal 320 | K Orange 7 segemnt LED common anode 321 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 322 | $ENDCMP 323 | # 324 | $CMP MAN3630A 325 | D Overflow 7 segment orange LED common anode 326 | K Orange 7 segemnt LED common anode 327 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 328 | $ENDCMP 329 | # 330 | $CMP MAN3640A 331 | D Single digit 7 segment orange LED common anode right hand decimal 332 | K Orange 7 segemnt LED common anode 333 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 334 | $ENDCMP 335 | # 336 | $CMP MAN3810A 337 | D Single digit 7 segment yellow LED common anode right hand decimal 338 | K Yellow 7 segemnt LED common anode 339 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 340 | $ENDCMP 341 | # 342 | $CMP MAN3820A 343 | D Single digit 7 segment yellow LED common anode left hand decimal 344 | K Yellow 7 segemnt LED common anode 345 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 346 | $ENDCMP 347 | # 348 | $CMP MAN3840A 349 | D Single digit 7 segment yellow LED common anode right hand decimal 350 | K Yellow 7 segemnt LED common anode 351 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 352 | $ENDCMP 353 | # 354 | $CMP MAN71A 355 | D Single digit 7 segment red LED common anode right hand decimal 356 | K Red 7 segemnt LED common anode 357 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 358 | $ENDCMP 359 | # 360 | $CMP MAN72A 361 | D Single digit 7 segment red LED common anode left hand decimal 362 | K Red 7 segemnt LED common anode 363 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 364 | $ENDCMP 365 | # 366 | $CMP MAN73A 367 | D Overflow 7 segment red LED common anode 368 | K Red Overflow 7 segemnt LED common anode 369 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 370 | $ENDCMP 371 | # 372 | $CMP MAN74A 373 | D Single digit 7 segment red LED common anode right hand decimal 374 | K Red 7 segemnt LED common anode 375 | F https://www.digchip.com/datasheets/parts/datasheet/161/MAN3640A-pdf.php 376 | $ENDCMP 377 | # 378 | $CMP RC1602A 379 | D LCD 16x2 Alphanumeric gray backlight, 3 or 5 V VDD 380 | K LCD 16x2 Alphanumeric gray backlight, 3 or 5 V VDD 381 | F http://www.raystar-optronics.com/down.php?ProID=18 382 | $ENDCMP 383 | # 384 | $CMP RC1602A-GHW-ESX 385 | D RC1602A-GHW-ESX 386 | K LCD 16x2 Alphanumeric 16pin Gray Backlight 387 | F http://www.raystar-optronics.com/down.php?ProID=18 388 | $ENDCMP 389 | # 390 | $CMP SBC18-11EGWA 391 | D Single digit 7 segment hyper red and green LED display, common cathode 392 | K 7 segment LED display common cathode 393 | F http://www.kingbrightusa.com/images/catalog/SPEC/SBC18-11EGWA.pdf 394 | $ENDCMP 395 | # 396 | $CMP SBC18-11SURKCGKWA 397 | D Single digit 7 segment hyper red and green LED display, common cathode 398 | K 7 segment LED display common cathode 399 | F http://www.kingbright.com/attachments/file/psearch/000/00/00/SBC18-11SURKCGKWA(Ver.6A).pdf 400 | $ENDCMP 401 | # 402 | $CMP WC1602A 403 | D LCD 16x2 Alphanumeric , 8 bit parallel bus, 5V VDD 404 | K LCD 16x2 Alphanumeric Green Backlight 405 | F http://www.wincomlcd.com/pdf/WC1602A-SFYLYHTC06.pdf 406 | $ENDCMP 407 | # 408 | #End Doc Library 409 | -------------------------------------------------------------------------------- /kicad/test-cad/MiFare.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | $CMP ADUC816 4 | D 8KB Flash, 256B SRAM, 640B EEPROM, 16-bit ADC, 12-bit DAC, MQFP-52 5 | K 8051 CORE MCU ADC DAC 6 | F http://www.analog.com/static/imported-files/data_sheets/ADUC816.pdf 7 | $ENDCMP 8 | # 9 | $CMP Mifare 10 | D Mifare RFID 11 | K Mifare 12 | $ENDCMP 13 | # 14 | $CMP P89LPC832A1FA 15 | D P89LPC932A1FA, 8kB Flash, 256 SRAM, 8bit MCS51 2-cycle Core Microcontroller, PLCC-28 16 | K Philips 8051 Turbo Core 17 | F http://www.nxp.com/documents/data_sheet/P89LPC932A1.pdf 18 | $ENDCMP 19 | # 20 | $CMP SAB80C515-M 21 | D 8KB ROM, 256B RAM, 8-bit CMOS High Performace Single-Chip Microcontroller, PMQFP-80 22 | K CMOS MCU 8-bit 23 | F http://pdf.datasheetcatalog.com/datasheet/infineon/1-d80515.pdf 24 | $ENDCMP 25 | # 26 | $CMP SAB80C515-N 27 | D 8KB ROM, 256B RAM, 8-bit CMOS High Performace Single-Chip Microcontroller, PLCC-68 28 | K CMOS MCU 8-bit 29 | F http://pdf.datasheetcatalog.com/datasheet/infineon/1-d80515.pdf 30 | $ENDCMP 31 | # 32 | $CMP SAB80C515-XX-N 33 | D 8KB ROM, 256B RAM, 8-bit CMOS High Performace Single-Chip Microcontroller, PLCC-68 34 | K CMOS MCU 8-bit 35 | F http://pdf.datasheetcatalog.com/datasheet/infineon/1-d80515.pdf 36 | $ENDCMP 37 | # 38 | $CMP SAB80C535-M 39 | D 8KB ROM, 256B RAM, 8-bit CMOS High Performace Single-Chip Microcontroller, PMQFP-80 40 | K CMOS MCU 8-bit 41 | F http://pdf.datasheetcatalog.com/datasheet/infineon/1-d80515.pdf 42 | $ENDCMP 43 | # 44 | $CMP SAB80C535-N 45 | D 8KB ROM, 256B RAM, 8-bit CMOS High Performace Single-Chip Microcontroller, PLCC-68 46 | K CMOS MCU 8-bit 47 | F http://pdf.datasheetcatalog.com/datasheet/infineon/1-d80515.pdf 48 | $ENDCMP 49 | # 50 | $CMP SAB80C535-XX-N 51 | D SAB80C515-XX-N, 8KB ROM, 256B RAM, 8-bit CMOS High Performace Single-Chip Microcontroller, PLCC-68 52 | K CMOS MCU 8-bit 53 | F http://pdf.datasheetcatalog.com/datasheet/infineon/1-d80515.pdf 54 | $ENDCMP 55 | # 56 | #End Doc Library 57 | -------------------------------------------------------------------------------- /kicad/test-cad/MiFare.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # ADUC816 5 | # 6 | DEF ADUC816 U 0 30 Y Y 1 F N 7 | F0 "U" -950 1800 50 H V L CNN 8 | F1 "ADUC816" -950 1700 50 H V L CNN 9 | F2 "" 0 -200 50 H I C CNN 10 | F3 "" 0 -200 50 H I C CNN 11 | $FPLIST 12 | MQFP* 13 | $ENDFPLIST 14 | DRAW 15 | S 950 -1650 -950 1650 0 1 10 f 16 | X P1.0(T2) 1 -1100 1300 150 R 50 50 1 1 B 17 | X P1.1(T2EX) 2 -1100 1200 150 R 50 50 1 1 B 18 | X P1.2(DAC/IEXC1) 3 -1100 1100 150 R 50 50 1 1 B 19 | X P1.3(AIN5/IEXC2) 4 -1100 1000 150 R 50 50 1 1 B 20 | X AVDD 5 -200 1800 150 D 50 50 1 1 W 21 | X AGND 6 -200 -1800 150 U 50 50 1 1 W 22 | X REF- 7 -1100 200 150 R 50 50 1 1 P 23 | X REF+ 8 -1100 400 150 R 50 50 1 1 P 24 | X P1.4(AIN1) 9 -1100 900 150 R 50 50 1 1 I 25 | X P1.5(AIN2) 10 -1100 800 150 R 50 50 1 1 I 26 | X DVDD 20 0 1800 150 D 50 50 1 1 W 27 | X (A10)P2.2 30 1100 400 150 L 50 50 1 1 B 28 | X ~EA~ 40 1100 -1400 150 L 50 50 1 1 B 29 | X (AD5)P0.5 50 1100 1000 150 L 50 50 1 1 T 30 | X P1.6(AIN3) 11 -1100 700 150 R 50 50 1 1 I 31 | X DGND 21 0 -1800 150 U 50 50 1 1 W 32 | X (A11)P2.3 31 1100 300 150 L 50 50 1 1 B 33 | X ~PSEN~ 41 1100 -1300 150 L 50 50 1 1 O 34 | X (AD6)P0.6 51 1100 900 150 L 50 50 1 1 T 35 | X P1.7(AIN4) 12 -1100 600 150 R 50 50 1 1 B 36 | X (T0)P3.4 22 1100 -700 150 L 50 50 1 1 B 37 | X XTAL1 32 -1100 -1300 150 R 50 50 1 1 I 38 | X ALE 42 1100 -1500 150 L 50 50 1 1 O 39 | X (AD7)P0.7 52 1100 800 150 L 50 50 1 1 T 40 | X ~SS~ 13 -1100 -600 150 R 50 50 1 1 I 41 | X (T1)P3.5 23 1100 -800 150 L 50 50 1 1 B 42 | X XTAL2 33 -1100 -1500 150 R 50 50 1 1 O 43 | X (AD0)P0.0 43 1100 1500 150 L 50 50 1 1 T 44 | X MISO 14 -1100 -500 150 R 50 50 1 1 I 45 | X (~WR~)P3.6 24 1100 -900 150 L 50 50 1 1 B 46 | X DVDD 34 100 1800 150 D 50 50 1 1 W 47 | X (AD1)P0.1 44 1100 1400 150 L 50 50 1 1 T 48 | X RESET 15 -1100 1500 150 R 50 50 1 1 I 49 | X (~RD~)P3.7 25 1100 -1000 150 L 50 50 1 1 B 50 | X DGND 35 100 -1800 150 U 50 50 1 1 W 51 | X (AD2)P0.2 45 1100 1300 150 L 50 50 1 1 T 52 | X (RxD)P3.0 16 1100 -300 150 L 50 50 1 1 B 53 | X SCLOCK 26 -1100 -400 150 R 50 50 1 1 B 54 | X (A12)P2.4 36 1100 200 150 L 50 50 1 1 B 55 | X (AD3)P0.3 46 1100 1200 150 L 50 50 1 1 T 56 | X (TxD)P3.1 17 1100 -400 150 L 50 50 1 1 B 57 | X SDATA/MOSI 27 -1100 -300 150 R 50 50 1 1 B 58 | X (A13)P2.5 37 1100 100 150 L 50 50 1 1 B 59 | X DGND 47 200 -1800 150 U 50 50 1 1 W 60 | X (~INT0~)P3.2 18 1100 -500 150 L 50 50 1 1 B 61 | X (A8)P2.0 28 1100 600 150 L 50 50 1 1 B 62 | X (A14)P2.6 38 1100 0 150 L 50 50 1 1 B 63 | X DVDD 48 200 1800 150 D 50 50 1 1 W 64 | X (~INT1~)P3.3 19 1100 -600 150 L 50 50 1 1 B 65 | X (A9)P2.1 29 1100 500 150 L 50 50 1 1 B 66 | X (A15)P2.7 39 1100 -100 150 L 50 50 1 1 B 67 | X (AD4)P0.4 49 1100 1100 150 L 50 50 1 1 T 68 | ENDDRAW 69 | ENDDEF 70 | # 71 | # Mifare 72 | # 73 | DEF Mifare MiF 0 40 Y Y 1 F N 74 | F0 "MiF" 0 0 60 H V C BNN 75 | F1 "Mifare" 0 0 60 H V C TNN 76 | F2 "" 0 0 60 H I C CNN 77 | F3 "" 0 0 60 H I C CNN 78 | DRAW 79 | S -400 450 400 -450 0 1 0 N 80 | X SDA 1 -350 -450 200 D 50 50 1 1 I 81 | X SCK 2 -250 -450 200 D 50 50 1 1 I 82 | X MOSI 3 -150 -450 200 D 50 50 1 1 I 83 | X MISO 4 -50 -450 200 D 50 50 1 1 I 84 | X IRQ 5 50 -450 200 D 50 50 1 1 I 85 | X GND 6 150 -450 200 D 50 50 1 1 O 86 | X RST 7 250 -450 200 D 50 50 1 1 I 87 | X PWR_3.3V 8 350 -450 200 D 50 50 1 1 W 88 | ENDDRAW 89 | ENDDEF 90 | # 91 | # P89LPC832A1FA 92 | # 93 | DEF P89LPC832A1FA U 0 40 Y Y 1 F N 94 | F0 "U" -750 1100 50 H V L CNN 95 | F1 "P89LPC832A1FA" -750 1000 50 H V L CNN 96 | F2 "PLCC-28" 0 0 50 H I C CIN 97 | F3 "" 0 0 50 H I C CNN 98 | $FPLIST 99 | PLCC* 100 | $ENDFPLIST 101 | DRAW 102 | S -750 950 750 -950 0 1 10 f 103 | X ICB/P2.0 1 900 800 150 L 50 50 1 1 B 104 | X OCD/P2.1 2 900 700 150 L 50 50 1 1 B 105 | X P0.0/CMP2/KBI0 3 -900 800 150 R 50 50 1 1 B 106 | X P1.7/OCC 4 -900 -800 150 R 50 50 1 1 B 107 | X P1.6/OCB 5 -900 -700 150 R 50 50 1 1 B 108 | X P1.5/~RST 6 -900 -600 150 R 50 50 1 1 B 109 | X VSS 7 0 -1100 150 U 50 50 1 1 W 110 | X XTAL1/P3.1 8 900 -200 150 L 50 50 1 1 B 111 | X CLKOUT/XTAL2/P3.0 9 900 -100 150 L 50 50 1 1 B 112 | X P1.4/~INT1 10 -900 -500 150 R 50 50 1 1 B 113 | X P0.6/CMP1/KBI6 20 -900 200 150 R 50 50 1 1 B 114 | X P1.3/~INT0~/SDA 11 -900 -400 150 R 50 50 1 1 B 115 | X VDD 21 0 1100 150 D 50 50 1 1 W 116 | X P1.2/T0/SCL 12 -900 -300 150 R 50 50 1 1 B 117 | X P0.5/CMPREF/KBI5 22 -900 300 150 R 50 50 1 1 B 118 | X MOSI/P2.2 13 900 600 150 L 50 50 1 1 B 119 | X P0.4/CIN1A/KBI4 23 -900 400 150 R 50 50 1 1 B 120 | X MISO/P2.3 14 900 500 150 L 50 50 1 1 B 121 | X P0.3/CIN1B/KBI3 24 -900 500 150 R 50 50 1 1 B 122 | X ~SS~/P2.4 15 900 400 150 L 50 50 1 1 B 123 | X P0.2/CIN2A/KBI2 25 -900 600 150 R 50 50 1 1 B 124 | X SPICLK/P2.5 16 900 300 150 L 50 50 1 1 B 125 | X P0.1/CIN2B/KBI1 26 -900 700 150 R 50 50 1 1 B 126 | X P1.1/RXD 17 -900 -200 150 R 50 50 1 1 B 127 | X OCA/P2.6 27 900 200 150 L 50 50 1 1 B 128 | X P1.0/TXD 18 -900 -100 150 R 50 50 1 1 B 129 | X ICA/P2.7 28 900 100 150 L 50 50 1 1 B 130 | X P0.7/T1/KB7 19 -900 100 150 R 50 50 1 1 B 131 | ENDDRAW 132 | ENDDEF 133 | # 134 | # SAB80C515-M 135 | # 136 | DEF SAB80C515-M U 0 40 Y Y 1 F N 137 | F0 "U" -1100 2050 50 H V L CNN 138 | F1 "SAB80C515-M" 550 2050 50 H V L CNN 139 | F2 "PMQFP-80" 0 0 50 H I C CIN 140 | F3 "" 0 -200 50 H I C CNN 141 | ALIAS SAB80C535-M 142 | $FPLIST 143 | PLCC* 144 | $ENDFPLIST 145 | DRAW 146 | S -1100 -2100 1100 2000 0 1 10 f 147 | X ~RESET~ 1 -1300 1900 200 R 50 50 1 1 I I 148 | X VAREF 3 1300 -1000 200 L 50 50 1 1 P 149 | X VAGND 4 1300 -1200 200 L 50 50 1 1 W 150 | X AN7/P6.7 5 1300 -800 200 L 50 50 1 1 I 151 | X AN6/P6.6 6 1300 -700 200 L 50 50 1 1 I 152 | X AN5/P6.5 7 1300 -600 200 L 50 50 1 1 I 153 | X AN4/P6.4 8 1300 -500 200 L 50 50 1 1 I 154 | X AN3/P6.3 9 1300 -400 200 L 50 50 1 1 I 155 | X AN2/P6.2 10 1300 -300 200 L 50 50 1 1 I 156 | X P3.5/T1 20 -1300 -1500 200 R 50 50 1 1 B 157 | X P1.1/INT4/CC1 30 -1300 700 200 R 50 50 1 1 B 158 | X P2.2 40 -1300 -300 200 R 50 50 1 1 B 159 | X P5.7 60 1300 100 200 L 50 50 1 1 B 160 | X P4.7 80 1300 1000 200 L 50 50 1 1 B 161 | X AN1/P6.1 11 1300 -200 200 L 50 50 1 1 I 162 | X P3.6/~WR~ 21 -1300 -1600 200 R 50 50 1 1 B 163 | X P1.0/~INT3~/CC0 31 -1300 800 200 R 50 50 1 1 B 164 | X P2.3 41 -1300 -400 200 R 50 50 1 1 B 165 | X P5.6 61 1300 200 200 L 50 50 1 1 B 166 | X AN0/P6.0 12 1300 -100 200 L 50 50 1 1 I 167 | X P3.7/~RD~ 22 -1300 -1700 200 R 50 50 1 1 B 168 | X P2.4 42 -1300 -500 200 R 50 50 1 1 B 169 | X P0.0 52 -1300 1700 200 R 50 50 1 1 B 170 | X P5.5 62 1300 300 200 L 50 50 1 1 B 171 | X P4.0 72 1300 1700 200 L 50 50 1 1 B 172 | X VCC 33 100 2200 200 D 50 50 1 1 W 173 | X P2.5 43 -1300 -600 200 R 50 50 1 1 B 174 | X P0.1 53 -1300 1600 200 R 50 50 1 1 B 175 | X P5.4 63 1300 400 200 L 50 50 1 1 B 176 | X P4.1 73 1300 1600 200 L 50 50 1 1 B 177 | X P1.7/T2 24 -1300 100 200 R 50 50 1 1 B 178 | X VSS 34 0 -2300 200 U 50 50 1 1 W 179 | X P2.6 44 -1300 -700 200 R 50 50 1 1 B 180 | X P0.2 54 -1300 1500 200 R 50 50 1 1 B 181 | X P5.3 64 1300 500 200 L 50 50 1 1 B 182 | X P4.2 74 1300 1500 200 L 50 50 1 1 B 183 | X P3.0/RXD 15 -1300 -1000 200 R 50 50 1 1 B 184 | X P1.6/CLKOUT 25 -1300 200 200 R 50 50 1 1 B 185 | X P2.7 45 -1300 -800 200 R 50 50 1 1 B 186 | X P0.3 55 -1300 1400 200 R 50 50 1 1 B 187 | X P5.2 65 1300 600 200 L 50 50 1 1 B 188 | X ~PE~ 75 1300 -2000 200 L 50 50 1 1 I I 189 | X P3.1/TXD 16 -1300 -1100 200 R 50 50 1 1 B 190 | X P1.5/T2EX 26 -1300 300 200 R 50 50 1 1 B 191 | X XTAL2 36 1300 -1700 200 L 50 50 1 1 O 192 | X P0.4 56 -1300 1300 200 R 50 50 1 1 B 193 | X P5.1 66 1300 700 200 L 50 50 1 1 B 194 | X P4.3 76 1300 1400 200 L 50 50 1 1 B 195 | X P3.2/~INT0~ 17 -1300 -1200 200 R 50 50 1 1 B 196 | X P1.4/~INT2~ 27 -1300 400 200 R 50 50 1 1 B 197 | X XTAL1 37 1300 -1500 200 L 50 50 1 1 I 198 | X ~PSEN~ 47 -1300 -2000 200 R 50 50 1 1 O I 199 | X P0.5 57 -1300 1200 200 R 50 50 1 1 B 200 | X P5.0 67 1300 800 200 L 50 50 1 1 B 201 | X P4.4 77 1300 1300 200 L 50 50 1 1 B 202 | X P3.3/~INT1~ 18 -1300 -1300 200 R 50 50 1 1 B 203 | X P1.3/INT6/CC3 28 -1300 500 200 R 50 50 1 1 B 204 | X P2.0 38 -1300 -100 200 R 50 50 1 1 B 205 | X ALE 48 -1300 -1900 200 R 50 50 1 1 O 206 | X P0.6 58 -1300 1100 200 R 50 50 1 1 B 207 | X P4.5 78 1300 1200 200 L 50 50 1 1 B 208 | X P3.4/T0 19 -1300 -1400 200 R 50 50 1 1 B 209 | X P1.2/INT5/CC2 29 -1300 600 200 R 50 50 1 1 B 210 | X P2.1 39 -1300 -200 200 R 50 50 1 1 B 211 | X ~EA~ 49 1300 1900 200 L 50 50 1 1 I I 212 | X P0.7 59 -1300 1000 200 R 50 50 1 1 B 213 | X VCC 69 -100 2200 200 D 50 50 1 1 W 214 | X P4.6 79 1300 1100 200 L 50 50 1 1 B 215 | ENDDRAW 216 | ENDDEF 217 | # 218 | # SAB80C515-N 219 | # 220 | DEF SAB80C515-N U 0 40 Y Y 1 F N 221 | F0 "U" -1100 2050 50 H V L CNN 222 | F1 "SAB80C515-N" 550 2050 50 H V L CNN 223 | F2 "PLCC-68" 0 0 50 H I C CIN 224 | F3 "" 0 -200 50 H I C CNN 225 | ALIAS SAB80C535-N SAB80C515-XX-N SAB80C535-XX-N 226 | $FPLIST 227 | PLCC* 228 | $ENDFPLIST 229 | DRAW 230 | S -1100 -2100 1100 2000 0 1 10 f 231 | X P4.0 1 1300 1700 200 L 50 50 1 1 B 232 | X P4.1 2 1300 1600 200 L 50 50 1 1 B 233 | X P4.2 3 1300 1500 200 L 50 50 1 1 B 234 | X ~PE~ 4 1300 -2000 200 L 50 50 1 1 I I 235 | X P4.3 5 1300 1400 200 L 50 50 1 1 B 236 | X P4.4 6 1300 1300 200 L 50 50 1 1 B 237 | X P4.5 7 1300 1200 200 L 50 50 1 1 B 238 | X P4.6 8 1300 1100 200 L 50 50 1 1 B 239 | X P4.7 9 1300 1000 200 L 50 50 1 1 B 240 | X ~RESET~ 10 -1300 1900 200 R 50 50 1 1 I I 241 | X AN0/P6.0 20 1300 -100 200 L 50 50 1 1 I 242 | X P1.6/CLKOUT 30 -1300 200 200 R 50 50 1 1 B 243 | X XTAL1 40 1300 -1500 200 L 50 50 1 1 I 244 | X ALE 50 -1300 -1900 200 R 50 50 1 1 O 245 | X P5.7 60 1300 100 200 L 50 50 1 1 B 246 | X VAREF 11 1300 -1000 200 L 50 50 1 1 P 247 | X P3.0/RXD 21 -1300 -1000 200 R 50 50 1 1 B 248 | X P1.5/T2EX 31 -1300 300 200 R 50 50 1 1 B 249 | X P2.0 41 -1300 -100 200 R 50 50 1 1 B 250 | X ~EA~ 51 1300 1900 200 L 50 50 1 1 I I 251 | X P5.6 61 1300 200 200 L 50 50 1 1 B 252 | X VAGND 12 1300 -1200 200 L 50 50 1 1 W 253 | X P3.1/TXD 22 -1300 -1100 200 R 50 50 1 1 B 254 | X P1.4/~INT2~ 32 -1300 400 200 R 50 50 1 1 B 255 | X P2.1 42 -1300 -200 200 R 50 50 1 1 B 256 | X P0.0 52 -1300 1700 200 R 50 50 1 1 B 257 | X P5.5 62 1300 300 200 L 50 50 1 1 B 258 | X AN7/P6.7 13 1300 -800 200 L 50 50 1 1 I 259 | X P3.2/~INT0~ 23 -1300 -1200 200 R 50 50 1 1 B 260 | X P1.3/INT6/CC3 33 -1300 500 200 R 50 50 1 1 B 261 | X P2.2 43 -1300 -300 200 R 50 50 1 1 B 262 | X P0.1 53 -1300 1600 200 R 50 50 1 1 B 263 | X P5.4 63 1300 400 200 L 50 50 1 1 B 264 | X AN6/P6.6 14 1300 -700 200 L 50 50 1 1 I 265 | X P3.3/~INT1~ 24 -1300 -1300 200 R 50 50 1 1 B 266 | X P1.2/INT5/CC2 34 -1300 600 200 R 50 50 1 1 B 267 | X P2.3 44 -1300 -400 200 R 50 50 1 1 B 268 | X P0.2 54 -1300 1500 200 R 50 50 1 1 B 269 | X P5.3 64 1300 500 200 L 50 50 1 1 B 270 | X AN5/P6.5 15 1300 -600 200 L 50 50 1 1 I 271 | X P3.4/T0 25 -1300 -1400 200 R 50 50 1 1 B 272 | X P1.1/INT4/CC1 35 -1300 700 200 R 50 50 1 1 B 273 | X P2.4 45 -1300 -500 200 R 50 50 1 1 B 274 | X P0.3 55 -1300 1400 200 R 50 50 1 1 B 275 | X P5.2 65 1300 600 200 L 50 50 1 1 B 276 | X AN4/P6.4 16 1300 -500 200 L 50 50 1 1 I 277 | X P3.5/T1 26 -1300 -1500 200 R 50 50 1 1 B 278 | X P1.0/~INT3~/CC0 36 -1300 800 200 R 50 50 1 1 B 279 | X P2.5 46 -1300 -600 200 R 50 50 1 1 B 280 | X P0.4 56 -1300 1300 200 R 50 50 1 1 B 281 | X P5.1 66 1300 700 200 L 50 50 1 1 B 282 | X AN3/P6.3 17 1300 -400 200 L 50 50 1 1 I 283 | X P3.6/~WR~ 27 -1300 -1600 200 R 50 50 1 1 B 284 | X VCC 37 100 2200 200 D 50 50 1 1 W 285 | X P2.6 47 -1300 -700 200 R 50 50 1 1 B 286 | X P0.5 57 -1300 1200 200 R 50 50 1 1 B 287 | X P5.0 67 1300 800 200 L 50 50 1 1 B 288 | X AN2/P6.2 18 1300 -300 200 L 50 50 1 1 I 289 | X P3.7/~RD~ 28 -1300 -1700 200 R 50 50 1 1 B 290 | X VSS 38 0 -2300 200 U 50 50 1 1 W 291 | X P2.7 48 -1300 -800 200 R 50 50 1 1 B 292 | X P0.6 58 -1300 1100 200 R 50 50 1 1 B 293 | X VCC 68 -100 2200 200 D 50 50 1 1 W 294 | X AN1/P6.1 19 1300 -200 200 L 50 50 1 1 I 295 | X P1.7/T2 29 -1300 100 200 R 50 50 1 1 B 296 | X XTAL2 39 1300 -1700 200 L 50 50 1 1 O 297 | X ~PSEN~ 49 -1300 -2000 200 R 50 50 1 1 O I 298 | X P0.7 59 -1300 1000 200 R 50 50 1 1 B 299 | ENDDRAW 300 | ENDDEF 301 | # 302 | #End Library 303 | -------------------------------------------------------------------------------- /kicad/test-cad/test-cad-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # LED 5 | # 6 | DEF LED D 0 40 Y N 1 F N 7 | F0 "D" 0 100 50 H V C CNN 8 | F1 "LED" 0 -100 50 H V C CNN 9 | F2 "" 0 0 50 H I C CNN 10 | F3 "" 0 0 50 H I C CNN 11 | $FPLIST 12 | LED* 13 | $ENDFPLIST 14 | DRAW 15 | P 2 0 1 8 -50 -50 -50 50 N 16 | P 2 0 1 0 -50 0 50 0 N 17 | P 4 0 1 8 50 -50 50 50 -50 0 50 -50 N 18 | P 5 0 1 0 -120 -30 -180 -90 -150 -90 -180 -90 -180 -60 N 19 | P 5 0 1 0 -70 -30 -130 -90 -100 -90 -130 -90 -130 -60 N 20 | X K 1 -150 0 100 R 50 50 1 1 P 21 | X A 2 150 0 100 L 50 50 1 1 P 22 | ENDDRAW 23 | ENDDEF 24 | # 25 | # Mifare 26 | # 27 | DEF Mifare MiF 0 40 Y Y 1 F N 28 | F0 "MiF" 0 0 60 H V C BNN 29 | F1 "Mifare" 0 0 60 H V C TNN 30 | F2 "" 0 0 60 H I C CNN 31 | F3 "" 0 0 60 H I C CNN 32 | DRAW 33 | S -400 450 400 -450 0 1 0 N 34 | X SDA 1 -350 -450 200 D 50 50 1 1 I 35 | X SCK 2 -250 -450 200 D 50 50 1 1 I 36 | X MOSI 3 -150 -450 200 D 50 50 1 1 I 37 | X MISO 4 -50 -450 200 D 50 50 1 1 I 38 | X IRQ 5 50 -450 200 D 50 50 1 1 I 39 | X GND 6 150 -450 200 D 50 50 1 1 O 40 | X RST 7 250 -450 200 D 50 50 1 1 I 41 | X PWR_3.3V 8 350 -450 200 D 50 50 1 1 W 42 | ENDDRAW 43 | ENDDEF 44 | # 45 | # R 46 | # 47 | DEF R R 0 0 N Y 1 F N 48 | F0 "R" 80 0 50 V V C CNN 49 | F1 "R" 0 0 50 V V C CNN 50 | F2 "" -70 0 50 V I C CNN 51 | F3 "" 0 0 50 H I C CNN 52 | $FPLIST 53 | R_* 54 | R_* 55 | $ENDFPLIST 56 | DRAW 57 | S -40 -100 40 100 0 1 10 N 58 | X ~ 1 0 150 50 D 50 50 1 1 P 59 | X ~ 2 0 -150 50 U 50 50 1 1 P 60 | ENDDRAW 61 | ENDDEF 62 | # 63 | # RC1602A-RESCUE-test-cad 64 | # 65 | DEF RC1602A-RESCUE-test-cad U 0 40 Y Y 1 F N 66 | F0 "U" -250 650 50 H V C CNN 67 | F1 "RC1602A-RESCUE-test-cad" 110 650 50 H V L CNN 68 | F2 "Displays:RC1602A" 100 -800 50 H I C CNN 69 | F3 "" 100 -100 50 H I C CNN 70 | $FPLIST 71 | *RC1602A* 72 | $ENDFPLIST 73 | DRAW 74 | S -300 600 300 -600 0 1 10 f 75 | X VSS 1 0 -700 100 U 50 50 1 1 P 76 | X VDD 2 0 700 100 D 50 50 1 1 W 77 | X VO 3 400 200 100 L 50 50 1 1 w 78 | X RS 4 -400 500 100 R 50 50 1 1 I 79 | X R/W 5 -400 400 100 R 50 50 1 1 I 80 | X E 6 -400 300 100 R 50 50 1 1 I 81 | X DB0 7 -400 200 100 R 50 50 1 1 B 82 | X DB1 8 -400 100 100 R 50 50 1 1 B 83 | X DB2 9 -400 0 100 R 50 50 1 1 B 84 | X DB3 10 -400 -100 100 R 50 50 1 1 B 85 | X DB4 11 -400 -200 100 R 50 50 1 1 B 86 | X DB5 12 -400 -300 100 R 50 50 1 1 B 87 | X DB6 13 -400 -400 100 R 50 50 1 1 B 88 | X DB7 14 -400 -500 100 R 50 50 1 1 B 89 | X A/VEE 15 400 -300 100 L 50 50 1 1 W 90 | X K 16 400 -200 100 L 50 50 1 1 P 91 | ENDDRAW 92 | ENDDEF 93 | # 94 | # Raspberry_Pi_2_3-RESCUE-test-cad 95 | # 96 | DEF Raspberry_Pi_2_3-RESCUE-test-cad J 0 40 Y Y 1 F N 97 | F0 "J" 700 -1250 50 H V C CNN 98 | F1 "Raspberry_Pi_2_3-RESCUE-test-cad" -400 900 50 H V C CNN 99 | F2 "Pin_Headers:Pin_Header_Straight_2x20" 1000 1250 50 H I C CNN 100 | F3 "" 50 -150 50 H I C CNN 101 | DRAW 102 | S -800 1200 800 -1200 0 1 10 f 103 | X 3V3 1 100 1300 100 D 50 50 1 1 w 104 | X 5V 2 -200 1300 100 D 50 50 1 1 w 105 | X (SDA1)_GPIO2 3 900 900 100 L 50 50 1 1 B 106 | X 5V 4 -100 1300 100 D 50 50 1 1 w 107 | X (SCL1)_GPIO3 5 900 800 100 L 50 50 1 1 B 108 | X GND 6 -400 -1300 100 U 50 50 1 1 P 109 | X (GCLK)_GPIO4 7 900 700 100 L 50 50 1 1 B 110 | X (TXD0)_GPIO14 8 900 -700 100 L 50 50 1 1 B 111 | X GND 9 -300 -1300 100 U 50 50 1 1 P 112 | X (RXD0)_GPIO15 10 900 -800 100 L 50 50 1 1 B 113 | X GND 20 -100 -1300 100 U 50 50 1 1 P 114 | X GND 30 100 -1300 100 U 50 50 1 1 P 115 | X GPIO21 40 -900 200 100 R 50 50 1 1 B 116 | X GPIO17_(GEN0) 11 -900 600 100 R 50 50 1 1 B 117 | X (SPI_MISO)_GPIO9 21 900 0 100 L 50 50 1 1 B 118 | X GPIO6 31 900 400 100 L 50 50 1 1 B 119 | X GPIO18_(GEN1) 12 -900 500 100 R 50 50 1 1 B 120 | X GPIO25_(GEN6) 22 -900 -200 100 R 50 50 1 1 B 121 | X GPIO12 32 900 -400 100 L 50 50 1 1 B 122 | X GPIO27_(GEN2) 13 -900 -400 100 R 50 50 1 1 B 123 | X (SPI_SCLK)_GPIO11 23 900 -200 100 L 50 50 1 1 B 124 | X GPIO13 33 900 -500 100 L 50 50 1 1 B 125 | X GND 14 -200 -1300 100 U 50 50 1 1 P 126 | X (~SPI_CE0~)_GPIO8 24 900 100 100 L 50 50 1 1 B 127 | X GND 34 200 -1300 100 U 50 50 1 1 P 128 | X GPIO22_(GEN3) 15 -900 100 100 R 50 50 1 1 B 129 | X GND 25 0 -1300 100 U 50 50 1 1 P 130 | X GPIO19 35 -900 400 100 R 50 50 1 1 B 131 | X GPIO23_(GEN4) 16 -900 0 100 R 50 50 1 1 B 132 | X (~SPI_CE1~)_GPIO7 26 900 200 100 L 50 50 1 1 B 133 | X GPIO16 36 -900 700 100 R 50 50 1 1 B 134 | X 3V3 17 200 1300 100 D 50 50 1 1 w 135 | X ID_SD 27 -900 -700 100 R 50 50 1 1 B 136 | X GPIO26 37 -900 -300 100 R 50 50 1 1 B 137 | X GPIO24_(GEN5) 18 -900 -100 100 R 50 50 1 1 B 138 | X ID_SC 28 -900 -800 100 R 50 50 1 1 B 139 | X GPIO20 38 -900 300 100 R 50 50 1 1 B 140 | X (SPI_MOSI)_GPIO10 19 900 -100 100 L 50 50 1 1 B 141 | X GPIO5 29 900 500 100 L 50 50 1 1 B 142 | X GND 39 300 -1300 100 U 50 50 1 1 P 143 | ENDDRAW 144 | ENDDEF 145 | # 146 | # SW_Push_Dual 147 | # 148 | DEF SW_Push_Dual SW 0 40 Y N 1 F N 149 | F0 "SW" 50 100 50 H V L CNN 150 | F1 "SW_Push_Dual" 0 -270 50 H V C CNN 151 | F2 "" 0 200 50 H I C CNN 152 | F3 "" 0 200 50 H I C CNN 153 | DRAW 154 | C -80 -200 20 0 1 0 N 155 | C -80 0 20 0 1 0 N 156 | C 80 -200 20 0 1 0 N 157 | C 80 0 20 0 1 0 N 158 | P 2 0 1 0 0 -120 0 -140 N 159 | P 2 0 1 0 0 -80 0 -100 N 160 | P 2 0 1 0 0 -60 0 -40 N 161 | P 2 0 1 0 0 -20 0 0 N 162 | P 2 0 1 0 0 20 0 40 N 163 | P 2 0 1 0 0 50 0 120 N 164 | P 2 0 1 0 100 -150 -100 -150 N 165 | P 2 0 1 0 100 50 -100 50 N 166 | X 1 1 -200 0 100 R 50 50 0 1 P 167 | X 2 2 200 0 100 L 50 50 0 1 P 168 | X 3 3 -200 -200 100 R 50 50 0 1 P 169 | X 4 4 200 -200 100 L 50 50 0 1 P 170 | ENDDRAW 171 | ENDDEF 172 | # 173 | #End Library 174 | -------------------------------------------------------------------------------- /kicad/test-cad/test-cad-rescue.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # RC1602A-RESCUE-test-cad 5 | # 6 | DEF RC1602A-RESCUE-test-cad U 0 40 Y Y 1 F N 7 | F0 "U" -250 650 50 H V C CNN 8 | F1 "RC1602A-RESCUE-test-cad" 110 650 50 H V L CNN 9 | F2 "Displays:RC1602A" 100 -800 50 H I C CNN 10 | F3 "" 100 -100 50 H I C CNN 11 | $FPLIST 12 | *RC1602A* 13 | $ENDFPLIST 14 | DRAW 15 | S -300 600 300 -600 0 1 10 f 16 | X VSS 1 0 -700 100 U 50 50 1 1 P 17 | X VDD 2 0 700 100 D 50 50 1 1 W 18 | X VO 3 400 200 100 L 50 50 1 1 w 19 | X RS 4 -400 500 100 R 50 50 1 1 I 20 | X R/W 5 -400 400 100 R 50 50 1 1 I 21 | X E 6 -400 300 100 R 50 50 1 1 I 22 | X DB0 7 -400 200 100 R 50 50 1 1 B 23 | X DB1 8 -400 100 100 R 50 50 1 1 B 24 | X DB2 9 -400 0 100 R 50 50 1 1 B 25 | X DB3 10 -400 -100 100 R 50 50 1 1 B 26 | X DB4 11 -400 -200 100 R 50 50 1 1 B 27 | X DB5 12 -400 -300 100 R 50 50 1 1 B 28 | X DB6 13 -400 -400 100 R 50 50 1 1 B 29 | X DB7 14 -400 -500 100 R 50 50 1 1 B 30 | X A/VEE 15 400 -300 100 L 50 50 1 1 W 31 | X K 16 400 -200 100 L 50 50 1 1 P 32 | ENDDRAW 33 | ENDDEF 34 | # 35 | # Raspberry_Pi_2_3-RESCUE-test-cad 36 | # 37 | DEF Raspberry_Pi_2_3-RESCUE-test-cad J 0 40 Y Y 1 F N 38 | F0 "J" 700 -1250 50 H V C CNN 39 | F1 "Raspberry_Pi_2_3-RESCUE-test-cad" -400 900 50 H V C CNN 40 | F2 "Pin_Headers:Pin_Header_Straight_2x20" 1000 1250 50 H I C CNN 41 | F3 "" 50 -150 50 H I C CNN 42 | DRAW 43 | S -800 1200 800 -1200 0 1 10 f 44 | X 3V3 1 100 1300 100 D 50 50 1 1 w 45 | X 5V 2 -200 1300 100 D 50 50 1 1 w 46 | X (SDA1)_GPIO2 3 900 900 100 L 50 50 1 1 B 47 | X 5V 4 -100 1300 100 D 50 50 1 1 w 48 | X (SCL1)_GPIO3 5 900 800 100 L 50 50 1 1 B 49 | X GND 6 -400 -1300 100 U 50 50 1 1 P 50 | X (GCLK)_GPIO4 7 900 700 100 L 50 50 1 1 B 51 | X (TXD0)_GPIO14 8 900 -700 100 L 50 50 1 1 B 52 | X GND 9 -300 -1300 100 U 50 50 1 1 P 53 | X (RXD0)_GPIO15 10 900 -800 100 L 50 50 1 1 B 54 | X GND 20 -100 -1300 100 U 50 50 1 1 P 55 | X GND 30 100 -1300 100 U 50 50 1 1 P 56 | X GPIO21 40 -900 200 100 R 50 50 1 1 B 57 | X GPIO17_(GEN0) 11 -900 600 100 R 50 50 1 1 B 58 | X (SPI_MISO)_GPIO9 21 900 0 100 L 50 50 1 1 B 59 | X GPIO6 31 900 400 100 L 50 50 1 1 B 60 | X GPIO18_(GEN1) 12 -900 500 100 R 50 50 1 1 B 61 | X GPIO25_(GEN6) 22 -900 -200 100 R 50 50 1 1 B 62 | X GPIO12 32 900 -400 100 L 50 50 1 1 B 63 | X GPIO27_(GEN2) 13 -900 -400 100 R 50 50 1 1 B 64 | X (SPI_SCLK)_GPIO11 23 900 -200 100 L 50 50 1 1 B 65 | X GPIO13 33 900 -500 100 L 50 50 1 1 B 66 | X GND 14 -200 -1300 100 U 50 50 1 1 P 67 | X (~SPI_CE0~)_GPIO8 24 900 100 100 L 50 50 1 1 B 68 | X GND 34 200 -1300 100 U 50 50 1 1 P 69 | X GPIO22_(GEN3) 15 -900 100 100 R 50 50 1 1 B 70 | X GND 25 0 -1300 100 U 50 50 1 1 P 71 | X GPIO19 35 -900 400 100 R 50 50 1 1 B 72 | X GPIO23_(GEN4) 16 -900 0 100 R 50 50 1 1 B 73 | X (~SPI_CE1~)_GPIO7 26 900 200 100 L 50 50 1 1 B 74 | X GPIO16 36 -900 700 100 R 50 50 1 1 B 75 | X 3V3 17 200 1300 100 D 50 50 1 1 w 76 | X ID_SD 27 -900 -700 100 R 50 50 1 1 B 77 | X GPIO26 37 -900 -300 100 R 50 50 1 1 B 78 | X GPIO24_(GEN5) 18 -900 -100 100 R 50 50 1 1 B 79 | X ID_SC 28 -900 -800 100 R 50 50 1 1 B 80 | X GPIO20 38 -900 300 100 R 50 50 1 1 B 81 | X (SPI_MOSI)_GPIO10 19 900 -100 100 L 50 50 1 1 B 82 | X GPIO5 29 900 500 100 L 50 50 1 1 B 83 | X GND 39 300 -1300 100 U 50 50 1 1 P 84 | ENDDRAW 85 | ENDDEF 86 | # 87 | #End Library 88 | -------------------------------------------------------------------------------- /kicad/test-cad/test-cad.bak: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:test-cad-rescue 3 | LIBS:power 4 | LIBS:device 5 | LIBS:switches 6 | LIBS:relays 7 | LIBS:motors 8 | LIBS:transistors 9 | LIBS:conn 10 | LIBS:linear 11 | LIBS:regul 12 | LIBS:74xx 13 | LIBS:cmos4000 14 | LIBS:adc-dac 15 | LIBS:memory 16 | LIBS:xilinx 17 | LIBS:microcontrollers 18 | LIBS:dsp 19 | LIBS:microchip 20 | LIBS:analog_switches 21 | LIBS:motorola 22 | LIBS:texas 23 | LIBS:intel 24 | LIBS:audio 25 | LIBS:interface 26 | LIBS:digital-audio 27 | LIBS:philips 28 | LIBS:display 29 | LIBS:cypress 30 | LIBS:siliconi 31 | LIBS:opto 32 | LIBS:atmel 33 | LIBS:contrib 34 | LIBS:valves 35 | LIBS:test-cad-cache 36 | EELAYER 25 0 37 | EELAYER END 38 | $Descr A4 11693 8268 39 | encoding utf-8 40 | Sheet 1 1 41 | Title "" 42 | Date "" 43 | Rev "" 44 | Comp "" 45 | Comment1 "" 46 | Comment2 "" 47 | Comment3 "" 48 | Comment4 "" 49 | $EndDescr 50 | $Comp 51 | L Raspberry_Pi_2_3-RESCUE-test-cad J1 52 | U 1 1 5A6E2298 53 | P 5200 3450 54 | F 0 "J1" H 5900 2200 50 0000 C CNN 55 | F 1 "Raspberry_Pi_2_3" H 4800 4350 50 0000 C CNN 56 | F 2 "Pin_Headers:Pin_Header_Straight_2x20" H 6200 4700 50 0001 C CNN 57 | F 3 "" H 5250 3300 50 0001 C CNN 58 | 1 5200 3450 59 | 1 0 0 -1 60 | $EndComp 61 | $Comp 62 | L R R1 63 | U 1 1 5A6E5834 64 | P 4050 5000 65 | F 0 "R1" V 4130 5000 50 0000 C CNN 66 | F 1 "2K" V 4050 5000 50 0000 C CNN 67 | F 2 "" V 3980 5000 50 0001 C CNN 68 | F 3 "" H 4050 5000 50 0001 C CNN 69 | 1 4050 5000 70 | 0 1 1 0 71 | $EndComp 72 | $Comp 73 | L Mifare MiF1 74 | U 1 1 5A6E5B51 75 | P 7400 2700 76 | F 0 "MiF1" H 7400 2700 60 0000 C BNN 77 | F 1 "Mifare" H 7400 2700 60 0000 C TNN 78 | F 2 "" H 7400 2700 60 0001 C CNN 79 | F 3 "" H 7400 2700 60 0001 C CNN 80 | 1 7400 2700 81 | 1 0 0 -1 82 | $EndComp 83 | $Comp 84 | L SW_Push_Dual SWUp1 85 | U 1 1 5A6E72B5 86 | P 6650 5250 87 | F 0 "SWUp1" H 6700 5350 50 0000 L CNN 88 | F 1 "SW_Push_Dual" H 6650 4980 50 0000 C CNN 89 | F 2 "" H 6650 5450 50 0001 C CNN 90 | F 3 "" H 6650 5450 50 0001 C CNN 91 | 1 6650 5250 92 | 1 0 0 -1 93 | $EndComp 94 | $Comp 95 | L SW_Push_Dual SWDown1 96 | U 1 1 5A6E741A 97 | P 7450 5200 98 | F 0 "SWDown1" H 7500 5300 50 0000 L CNN 99 | F 1 "SW_Push_Dual" H 7450 4930 50 0000 C CNN 100 | F 2 "" H 7450 5400 50 0001 C CNN 101 | F 3 "" H 7450 5400 50 0001 C CNN 102 | 1 7450 5200 103 | 1 0 0 -1 104 | $EndComp 105 | $Comp 106 | L SW_Push_Dual SWOk1 107 | U 1 1 5A6E7479 108 | P 8350 5150 109 | F 0 "SWOk1" H 8400 5250 50 0000 L CNN 110 | F 1 "SW_Push_Dual" H 8350 4880 50 0000 C CNN 111 | F 2 "" H 8350 5350 50 0001 C CNN 112 | F 3 "" H 8350 5350 50 0001 C CNN 113 | 1 8350 5150 114 | 1 0 0 -1 115 | $EndComp 116 | $Comp 117 | L LED DError1 118 | U 1 1 5A6E7BD1 119 | P 2450 1900 120 | F 0 "DError1" H 2450 2000 50 0000 C CNN 121 | F 1 "LED" H 2450 1800 50 0000 C CNN 122 | F 2 "" H 2450 1900 50 0001 C CNN 123 | F 3 "" H 2450 1900 50 0001 C CNN 124 | 1 2450 1900 125 | 1 0 0 -1 126 | $EndComp 127 | $Comp 128 | L LED DReady1 129 | U 1 1 5A6E7D1C 130 | P 2450 2350 131 | F 0 "DReady1" H 2450 2450 50 0000 C CNN 132 | F 1 "LED" H 2450 2250 50 0000 C CNN 133 | F 2 "" H 2450 2350 50 0001 C CNN 134 | F 3 "" H 2450 2350 50 0001 C CNN 135 | 1 2450 2350 136 | 1 0 0 -1 137 | $EndComp 138 | $Comp 139 | L LED DStandby1 140 | U 1 1 5A6E7D5F 141 | P 2450 2800 142 | F 0 "DStandby1" H 2450 2900 50 0000 C CNN 143 | F 1 "LED" H 2450 2700 50 0000 C CNN 144 | F 2 "" H 2450 2800 50 0001 C CNN 145 | F 3 "" H 2450 2800 50 0001 C CNN 146 | 1 2450 2800 147 | 1 0 0 -1 148 | $EndComp 149 | NoConn ~ 6100 4250 150 | NoConn ~ 6100 3250 151 | NoConn ~ 6100 2750 152 | NoConn ~ 6100 2650 153 | NoConn ~ 6100 2550 154 | NoConn ~ 4300 4150 155 | NoConn ~ 4300 4250 156 | NoConn ~ 2900 5200 157 | NoConn ~ 4300 2750 158 | NoConn ~ 4300 2850 159 | NoConn ~ 5200 4750 160 | NoConn ~ 5300 4750 161 | $Comp 162 | L RC1602A-RESCUE-test-cad LCD1 163 | U 1 1 5A6E9AA6 164 | P 3300 5200 165 | F 0 "LCD1" H 3050 5850 50 0000 C CNN 166 | F 1 "RC1602A" H 3410 5850 50 0000 L CNN 167 | F 2 "Displays:RC1602A" H 3400 4400 50 0001 C CNN 168 | F 3 "" H 3400 5100 50 0001 C CNN 169 | 1 3300 5200 170 | 1 0 0 -1 171 | $EndComp 172 | NoConn ~ 2900 5000 173 | NoConn ~ 2900 5100 174 | NoConn ~ 2900 5300 175 | $Comp 176 | L R R2 177 | U 1 1 5A6EC72A 178 | P 1950 4750 179 | F 0 "R2" V 2030 4750 50 0000 C CNN 180 | F 1 "560" V 1950 4750 50 0000 C CNN 181 | F 2 "" V 1880 4750 50 0001 C CNN 182 | F 3 "" H 1950 4750 50 0001 C CNN 183 | 1 1950 4750 184 | 1 0 0 -1 185 | $EndComp 186 | Wire Wire Line 187 | 3700 5400 4900 5400 188 | Wire Wire Line 189 | 2900 4800 2700 4800 190 | Wire Wire Line 191 | 2700 4800 2700 4400 192 | Wire Wire Line 193 | 2700 4400 4250 4400 194 | Wire Wire Line 195 | 2900 4700 2900 3750 196 | Wire Wire Line 197 | 2900 3750 4300 3750 198 | Wire Wire Line 199 | 3300 5900 3300 6350 200 | Wire Wire Line 201 | 3300 6350 5000 6350 202 | Wire Wire Line 203 | 2250 3650 4300 3650 204 | Wire Wire Line 205 | 2200 5500 2200 3550 206 | Wire Wire Line 207 | 2200 3550 4300 3550 208 | Wire Wire Line 209 | 4300 3450 2150 3450 210 | Wire Wire Line 211 | 2150 3450 2150 5600 212 | Wire Wire Line 213 | 2100 5700 2100 3350 214 | Wire Wire Line 215 | 2100 3350 4300 3350 216 | Wire Wire Line 217 | 7350 3150 7350 3450 218 | Wire Wire Line 219 | 7350 3450 6100 3450 220 | Wire Wire Line 221 | 7250 3150 7250 3550 222 | Wire Wire Line 223 | 7250 3550 6100 3550 224 | Wire Wire Line 225 | 7550 3150 7550 4900 226 | Wire Wire Line 227 | 7550 4900 5500 4900 228 | Wire Wire Line 229 | 5500 4900 5500 4750 230 | Wire Wire Line 231 | 7450 3150 7450 3850 232 | Wire Wire Line 233 | 7450 3850 6100 3850 234 | Wire Wire Line 235 | 7650 3150 7650 3950 236 | Wire Wire Line 237 | 7650 3950 6100 3950 238 | Wire Wire Line 239 | 7150 3150 7150 3650 240 | Wire Wire Line 241 | 7150 3650 6100 3650 242 | Wire Wire Line 243 | 5400 2150 5400 2050 244 | Wire Wire Line 245 | 5400 2050 7900 2050 246 | Wire Wire Line 247 | 7900 2050 7900 3350 248 | Wire Wire Line 249 | 7900 3350 7750 3350 250 | Wire Wire Line 251 | 7750 3350 7750 3150 252 | Wire Wire Line 253 | 7050 3350 6100 3350 254 | Wire Wire Line 255 | 3300 4500 3300 2050 256 | Wire Wire Line 257 | 3300 2050 5000 2050 258 | Wire Wire Line 259 | 6450 5250 6300 5250 260 | Wire Wire Line 261 | 6300 3050 6300 5450 262 | Wire Wire Line 263 | 6300 3050 6100 3050 264 | Wire Wire Line 265 | 6300 5450 6450 5450 266 | Connection ~ 6300 5250 267 | Wire Wire Line 268 | 5300 2150 5300 1750 269 | Wire Wire Line 270 | 5300 1750 8550 1750 271 | Wire Wire Line 272 | 6850 4700 8550 4700 273 | Wire Wire Line 274 | 6850 4700 6850 5450 275 | Connection ~ 6850 5250 276 | Wire Wire Line 277 | 6850 5200 6850 5250 278 | Connection ~ 8550 4700 279 | Connection ~ 7650 4700 280 | Connection ~ 8550 5150 281 | Wire Wire Line 282 | 7250 5050 7250 5400 283 | Wire Wire Line 284 | 7250 5050 6450 5050 285 | Wire Wire Line 286 | 6450 5050 6450 2950 287 | Wire Wire Line 288 | 6450 2950 6100 2950 289 | Connection ~ 7250 5200 290 | Wire Wire Line 291 | 8150 1950 8150 5350 292 | Connection ~ 8150 5150 293 | Wire Wire Line 294 | 2300 1900 1950 1900 295 | Wire Wire Line 296 | 1950 6600 5400 6600 297 | Wire Wire Line 298 | 5400 6600 5400 4750 299 | Wire Wire Line 300 | 2300 2350 1950 2350 301 | Connection ~ 1950 2350 302 | Wire Wire Line 303 | 1950 2800 2300 2800 304 | Connection ~ 1950 2800 305 | Wire Wire Line 306 | 4300 3250 2600 3250 307 | Wire Wire Line 308 | 2600 3250 2600 2800 309 | Wire Wire Line 310 | 4300 3150 2800 3150 311 | Wire Wire Line 312 | 2800 3150 2800 2350 313 | Wire Wire Line 314 | 2800 2350 2600 2350 315 | Wire Wire Line 316 | 4300 3050 2900 3050 317 | Wire Wire Line 318 | 2900 3050 2900 1900 319 | Wire Wire Line 320 | 2900 1900 2600 1900 321 | Wire Wire Line 322 | 7650 4700 7650 5400 323 | Connection ~ 7650 5200 324 | Wire Wire Line 325 | 3800 5500 3700 5500 326 | Wire Wire Line 327 | 2250 5400 2900 5400 328 | Wire Wire Line 329 | 2250 3650 2250 5400 330 | Wire Wire Line 331 | 2900 5500 2200 5500 332 | Wire Wire Line 333 | 2150 5600 2900 5600 334 | Wire Wire Line 335 | 2100 5700 2900 5700 336 | Wire Wire Line 337 | 4300 3850 2600 3850 338 | Wire Wire Line 339 | 2600 3850 2600 4900 340 | Wire Wire Line 341 | 2600 4900 2900 4900 342 | Wire Wire Line 343 | 5000 6350 5000 4750 344 | Wire Wire Line 345 | 4250 4400 4250 5250 346 | Wire Wire Line 347 | 4250 5250 5100 5250 348 | Wire Wire Line 349 | 5100 5250 5100 4750 350 | Wire Wire Line 351 | 3700 5000 3900 5000 352 | Wire Wire Line 353 | 4200 5000 4800 5000 354 | Wire Wire Line 355 | 4800 5000 4800 4750 356 | Wire Wire Line 357 | 5000 2050 5000 2150 358 | Wire Wire Line 359 | 1950 1900 1950 4600 360 | Wire Wire Line 361 | 1950 4900 1950 6600 362 | Wire Wire Line 363 | 3800 5500 3800 1900 364 | Wire Wire Line 365 | 3800 1900 5100 1900 366 | Wire Wire Line 367 | 5100 1900 5100 2150 368 | Wire Wire Line 369 | 4900 5400 4900 4750 370 | $Comp 371 | L R R3 372 | U 1 1 5A6ED944 373 | P 8550 3050 374 | F 0 "R3" V 8630 3050 50 0000 C CNN 375 | F 1 "560" V 8550 3050 50 0000 C CNN 376 | F 2 "" V 8480 3050 50 0001 C CNN 377 | F 3 "" H 8550 3050 50 0001 C CNN 378 | 1 8550 3050 379 | 1 0 0 -1 380 | $EndComp 381 | Wire Wire Line 382 | 8550 1750 8550 2900 383 | Wire Wire Line 384 | 8550 3200 8550 5350 385 | Wire Wire Line 386 | 7050 3350 7050 3150 387 | Wire Wire Line 388 | 8150 1950 4150 1950 389 | Wire Wire Line 390 | 4150 1950 4150 2950 391 | Wire Wire Line 392 | 4150 2950 4300 2950 393 | NoConn ~ 6100 4150 394 | NoConn ~ 6750 4350 395 | $EndSCHEMATC 396 | -------------------------------------------------------------------------------- /kicad/test-cad/test-cad.pro: -------------------------------------------------------------------------------- 1 | update=Sun 11 Mar 2018 01:59:30 PM EDT 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir= 31 | [eeschema/libraries] 32 | LibName1=test-cad-rescue 33 | LibName2=power 34 | LibName3=device 35 | LibName4=switches 36 | LibName5=relays 37 | LibName6=motors 38 | LibName7=transistors 39 | LibName8=conn 40 | LibName9=linear 41 | LibName10=regul 42 | LibName11=74xx 43 | LibName12=cmos4000 44 | LibName13=adc-dac 45 | LibName14=memory 46 | LibName15=xilinx 47 | LibName16=microcontrollers 48 | LibName17=dsp 49 | LibName18=microchip 50 | LibName19=analog_switches 51 | LibName20=motorola 52 | LibName21=texas 53 | LibName22=intel 54 | LibName23=audio 55 | LibName24=interface 56 | LibName25=digital-audio 57 | LibName26=philips 58 | LibName27=display 59 | LibName28=cypress 60 | LibName29=siliconi 61 | LibName30=opto 62 | LibName31=atmel 63 | LibName32=contrib 64 | LibName33=valves 65 | [schematic_editor] 66 | version=1 67 | PageLayoutDescrFile= 68 | PlotDirectoryName= 69 | SubpartIdSeparator=0 70 | SubpartFirstId=65 71 | NetFmtName= 72 | SpiceForceRefPrefix=0 73 | SpiceUseNetNumbers=0 74 | LabSize=60 75 | -------------------------------------------------------------------------------- /kicad/test-cad/test-cad.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:test-cad-rescue 3 | LIBS:power 4 | LIBS:device 5 | LIBS:switches 6 | LIBS:relays 7 | LIBS:motors 8 | LIBS:transistors 9 | LIBS:conn 10 | LIBS:linear 11 | LIBS:regul 12 | LIBS:74xx 13 | LIBS:cmos4000 14 | LIBS:adc-dac 15 | LIBS:memory 16 | LIBS:xilinx 17 | LIBS:microcontrollers 18 | LIBS:dsp 19 | LIBS:microchip 20 | LIBS:analog_switches 21 | LIBS:motorola 22 | LIBS:texas 23 | LIBS:intel 24 | LIBS:audio 25 | LIBS:interface 26 | LIBS:digital-audio 27 | LIBS:philips 28 | LIBS:display 29 | LIBS:cypress 30 | LIBS:siliconi 31 | LIBS:opto 32 | LIBS:atmel 33 | LIBS:contrib 34 | LIBS:valves 35 | LIBS:test-cad-cache 36 | EELAYER 25 0 37 | EELAYER END 38 | $Descr A4 11693 8268 39 | encoding utf-8 40 | Sheet 1 1 41 | Title "" 42 | Date "" 43 | Rev "" 44 | Comp "" 45 | Comment1 "" 46 | Comment2 "" 47 | Comment3 "" 48 | Comment4 "" 49 | $EndDescr 50 | $Comp 51 | L Raspberry_Pi_2_3-RESCUE-test-cad J1 52 | U 1 1 5A6E2298 53 | P 5200 3450 54 | F 0 "J1" H 5900 2200 50 0000 C CNN 55 | F 1 "Raspberry_Pi_2_3" H 4800 4350 50 0000 C CNN 56 | F 2 "Pin_Headers:Pin_Header_Straight_2x20" H 6200 4700 50 0001 C CNN 57 | F 3 "" H 5250 3300 50 0001 C CNN 58 | 1 5200 3450 59 | 1 0 0 -1 60 | $EndComp 61 | $Comp 62 | L R R1 63 | U 1 1 5A6E5834 64 | P 4050 5000 65 | F 0 "R1" V 4130 5000 50 0000 C CNN 66 | F 1 "2K" V 4050 5000 50 0000 C CNN 67 | F 2 "" V 3980 5000 50 0001 C CNN 68 | F 3 "" H 4050 5000 50 0001 C CNN 69 | 1 4050 5000 70 | 0 1 1 0 71 | $EndComp 72 | $Comp 73 | L Mifare MiF1 74 | U 1 1 5A6E5B51 75 | P 7400 2700 76 | F 0 "MiF1" H 7400 2700 60 0000 C BNN 77 | F 1 "Mifare" H 7400 2700 60 0000 C TNN 78 | F 2 "" H 7400 2700 60 0001 C CNN 79 | F 3 "" H 7400 2700 60 0001 C CNN 80 | 1 7400 2700 81 | 1 0 0 -1 82 | $EndComp 83 | $Comp 84 | L SW_Push_Dual SWUp1 85 | U 1 1 5A6E72B5 86 | P 6650 5250 87 | F 0 "SWUp1" H 6700 5350 50 0000 L CNN 88 | F 1 "SW_Push_Dual" H 6650 4980 50 0000 C CNN 89 | F 2 "" H 6650 5450 50 0001 C CNN 90 | F 3 "" H 6650 5450 50 0001 C CNN 91 | 1 6650 5250 92 | 1 0 0 -1 93 | $EndComp 94 | $Comp 95 | L SW_Push_Dual SWDown1 96 | U 1 1 5A6E741A 97 | P 7450 5200 98 | F 0 "SWDown1" H 7500 5300 50 0000 L CNN 99 | F 1 "SW_Push_Dual" H 7450 4930 50 0000 C CNN 100 | F 2 "" H 7450 5400 50 0001 C CNN 101 | F 3 "" H 7450 5400 50 0001 C CNN 102 | 1 7450 5200 103 | 1 0 0 -1 104 | $EndComp 105 | $Comp 106 | L SW_Push_Dual SWOk1 107 | U 1 1 5A6E7479 108 | P 8350 5150 109 | F 0 "SWOk1" H 8400 5250 50 0000 L CNN 110 | F 1 "SW_Push_Dual" H 8350 4880 50 0000 C CNN 111 | F 2 "" H 8350 5350 50 0001 C CNN 112 | F 3 "" H 8350 5350 50 0001 C CNN 113 | 1 8350 5150 114 | 1 0 0 -1 115 | $EndComp 116 | $Comp 117 | L LED DError1 118 | U 1 1 5A6E7BD1 119 | P 2450 1900 120 | F 0 "DError1" H 2450 2000 50 0000 C CNN 121 | F 1 "LED" H 2450 1800 50 0000 C CNN 122 | F 2 "" H 2450 1900 50 0001 C CNN 123 | F 3 "" H 2450 1900 50 0001 C CNN 124 | 1 2450 1900 125 | 1 0 0 -1 126 | $EndComp 127 | $Comp 128 | L LED DReady1 129 | U 1 1 5A6E7D1C 130 | P 2450 2350 131 | F 0 "DReady1" H 2450 2450 50 0000 C CNN 132 | F 1 "LED" H 2450 2250 50 0000 C CNN 133 | F 2 "" H 2450 2350 50 0001 C CNN 134 | F 3 "" H 2450 2350 50 0001 C CNN 135 | 1 2450 2350 136 | 1 0 0 -1 137 | $EndComp 138 | $Comp 139 | L LED DStandby1 140 | U 1 1 5A6E7D5F 141 | P 2450 2800 142 | F 0 "DStandby1" H 2450 2900 50 0000 C CNN 143 | F 1 "LED" H 2450 2700 50 0000 C CNN 144 | F 2 "" H 2450 2800 50 0001 C CNN 145 | F 3 "" H 2450 2800 50 0001 C CNN 146 | 1 2450 2800 147 | 1 0 0 -1 148 | $EndComp 149 | NoConn ~ 6100 4250 150 | NoConn ~ 6100 3250 151 | NoConn ~ 6100 2750 152 | NoConn ~ 6100 2650 153 | NoConn ~ 6100 2550 154 | NoConn ~ 4300 4150 155 | NoConn ~ 4300 4250 156 | NoConn ~ 2900 5200 157 | NoConn ~ 4300 2750 158 | NoConn ~ 4300 2850 159 | NoConn ~ 5200 4750 160 | $Comp 161 | L RC1602A-RESCUE-test-cad LCD1 162 | U 1 1 5A6E9AA6 163 | P 3300 5200 164 | F 0 "LCD1" H 3050 5850 50 0000 C CNN 165 | F 1 "RC1602A" H 3410 5850 50 0000 L CNN 166 | F 2 "Displays:RC1602A" H 3400 4400 50 0001 C CNN 167 | F 3 "" H 3400 5100 50 0001 C CNN 168 | 1 3300 5200 169 | 1 0 0 -1 170 | $EndComp 171 | NoConn ~ 2900 5000 172 | NoConn ~ 2900 5100 173 | NoConn ~ 2900 5300 174 | $Comp 175 | L R R2 176 | U 1 1 5A6EC72A 177 | P 1950 4750 178 | F 0 "R2" V 2030 4750 50 0000 C CNN 179 | F 1 "560" V 1950 4750 50 0000 C CNN 180 | F 2 "" V 1880 4750 50 0001 C CNN 181 | F 3 "" H 1950 4750 50 0001 C CNN 182 | 1 1950 4750 183 | 1 0 0 -1 184 | $EndComp 185 | Wire Wire Line 186 | 3700 5400 4900 5400 187 | Wire Wire Line 188 | 2900 4800 2700 4800 189 | Wire Wire Line 190 | 2700 4800 2700 4400 191 | Wire Wire Line 192 | 2700 4400 4250 4400 193 | Wire Wire Line 194 | 2900 4700 2900 3750 195 | Wire Wire Line 196 | 2900 3750 4300 3750 197 | Wire Wire Line 198 | 3300 5900 3300 6350 199 | Wire Wire Line 200 | 3300 6350 5000 6350 201 | Wire Wire Line 202 | 2250 3650 4300 3650 203 | Wire Wire Line 204 | 2200 5500 2200 3550 205 | Wire Wire Line 206 | 2200 3550 4300 3550 207 | Wire Wire Line 208 | 4300 3450 2150 3450 209 | Wire Wire Line 210 | 2150 3450 2150 5600 211 | Wire Wire Line 212 | 2100 5700 2100 3350 213 | Wire Wire Line 214 | 2100 3350 4300 3350 215 | Wire Wire Line 216 | 7350 3150 7350 3450 217 | Wire Wire Line 218 | 7350 3450 6100 3450 219 | Wire Wire Line 220 | 7250 3150 7250 3550 221 | Wire Wire Line 222 | 7250 3550 6100 3550 223 | Wire Wire Line 224 | 7550 3150 7550 4900 225 | Wire Wire Line 226 | 7550 4900 5500 4900 227 | Wire Wire Line 228 | 5500 4900 5500 4750 229 | Wire Wire Line 230 | 7450 3150 7450 3850 231 | Wire Wire Line 232 | 7450 3850 6100 3850 233 | Wire Wire Line 234 | 7650 3150 7650 3950 235 | Wire Wire Line 236 | 7650 3950 6100 3950 237 | Wire Wire Line 238 | 7150 3150 7150 3650 239 | Wire Wire Line 240 | 7150 3650 6100 3650 241 | Wire Wire Line 242 | 5400 2150 5400 2050 243 | Wire Wire Line 244 | 5400 2050 7900 2050 245 | Wire Wire Line 246 | 7900 2050 7900 3350 247 | Wire Wire Line 248 | 7900 3350 7750 3350 249 | Wire Wire Line 250 | 7750 3350 7750 3150 251 | Wire Wire Line 252 | 7050 3350 6100 3350 253 | Wire Wire Line 254 | 3300 4500 3300 2050 255 | Wire Wire Line 256 | 3300 2050 5000 2050 257 | Wire Wire Line 258 | 6450 5250 6300 5250 259 | Wire Wire Line 260 | 6300 3050 6300 5450 261 | Wire Wire Line 262 | 6300 3050 6100 3050 263 | Wire Wire Line 264 | 6300 5450 6450 5450 265 | Connection ~ 6300 5250 266 | Wire Wire Line 267 | 6850 5200 6850 5950 268 | Connection ~ 6850 5250 269 | Connection ~ 8550 5150 270 | Wire Wire Line 271 | 7250 5050 7250 5400 272 | Wire Wire Line 273 | 7250 5050 6450 5050 274 | Wire Wire Line 275 | 6450 5050 6450 2950 276 | Wire Wire Line 277 | 6450 2950 6100 2950 278 | Connection ~ 7250 5200 279 | Wire Wire Line 280 | 8150 1950 8150 5350 281 | Connection ~ 8150 5150 282 | Wire Wire Line 283 | 2300 1900 1950 1900 284 | Wire Wire Line 285 | 1950 6600 5400 6600 286 | Wire Wire Line 287 | 5400 6600 5400 4750 288 | Wire Wire Line 289 | 2300 2350 1950 2350 290 | Connection ~ 1950 2350 291 | Wire Wire Line 292 | 1950 2800 2300 2800 293 | Connection ~ 1950 2800 294 | Wire Wire Line 295 | 4300 3250 2600 3250 296 | Wire Wire Line 297 | 2600 3250 2600 2800 298 | Wire Wire Line 299 | 4300 3150 2800 3150 300 | Wire Wire Line 301 | 2800 3150 2800 2350 302 | Wire Wire Line 303 | 2800 2350 2600 2350 304 | Wire Wire Line 305 | 4300 3050 2900 3050 306 | Wire Wire Line 307 | 2900 3050 2900 1900 308 | Wire Wire Line 309 | 2900 1900 2600 1900 310 | Wire Wire Line 311 | 7650 5950 7650 5200 312 | Connection ~ 7650 5200 313 | Wire Wire Line 314 | 3800 5500 3700 5500 315 | Wire Wire Line 316 | 2250 5400 2900 5400 317 | Wire Wire Line 318 | 2250 3650 2250 5400 319 | Wire Wire Line 320 | 2900 5500 2200 5500 321 | Wire Wire Line 322 | 2150 5600 2900 5600 323 | Wire Wire Line 324 | 2100 5700 2900 5700 325 | Wire Wire Line 326 | 4300 3850 2600 3850 327 | Wire Wire Line 328 | 2600 3850 2600 4900 329 | Wire Wire Line 330 | 2600 4900 2900 4900 331 | Wire Wire Line 332 | 5000 6350 5000 4750 333 | Wire Wire Line 334 | 4250 4400 4250 5250 335 | Wire Wire Line 336 | 4250 5250 5100 5250 337 | Wire Wire Line 338 | 5100 5250 5100 4750 339 | Wire Wire Line 340 | 3700 5000 3900 5000 341 | Wire Wire Line 342 | 4200 5000 4800 5000 343 | Wire Wire Line 344 | 4800 5000 4800 4750 345 | Wire Wire Line 346 | 5000 2050 5000 2150 347 | Wire Wire Line 348 | 1950 1900 1950 4600 349 | Wire Wire Line 350 | 1950 4900 1950 6600 351 | Wire Wire Line 352 | 3800 5500 3800 1900 353 | Wire Wire Line 354 | 3800 1900 5100 1900 355 | Wire Wire Line 356 | 5100 1900 5100 2150 357 | Wire Wire Line 358 | 4900 5400 4900 4750 359 | $Comp 360 | L R R3 361 | U 1 1 5A6ED944 362 | P 5950 5950 363 | F 0 "R3" V 6030 5950 50 0000 C CNN 364 | F 1 "560" V 5950 5950 50 0000 C CNN 365 | F 2 "" V 5880 5950 50 0001 C CNN 366 | F 3 "" H 5950 5950 50 0001 C CNN 367 | 1 5950 5950 368 | 0 1 1 0 369 | $EndComp 370 | Wire Wire Line 371 | 8550 5950 8550 5150 372 | Wire Wire Line 373 | 7050 3350 7050 3150 374 | Wire Wire Line 375 | 8150 1950 4150 1950 376 | Wire Wire Line 377 | 4150 1950 4150 2950 378 | Wire Wire Line 379 | 4150 2950 4300 2950 380 | NoConn ~ 6100 4150 381 | NoConn ~ 6750 4350 382 | NoConn ~ 5300 2150 383 | Wire Wire Line 384 | 6100 5950 8550 5950 385 | Connection ~ 6850 5450 386 | Connection ~ 6850 5950 387 | Connection ~ 7650 5400 388 | Connection ~ 7650 5950 389 | Connection ~ 8550 5350 390 | Wire Wire Line 391 | 5800 5950 5300 5950 392 | Wire Wire Line 393 | 5300 5950 5300 4750 394 | $EndSCHEMATC 395 | -------------------------------------------------------------------------------- /web/.env: -------------------------------------------------------------------------------- 1 | VUE_APP_API_URL=http://localhost:8081 2 | -------------------------------------------------------------------------------- /web/.env.production: -------------------------------------------------------------------------------- 1 | VUE_APP_API_URL=http://10.101.1.1 -------------------------------------------------------------------------------- /web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/** 3 | dist/ 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /web/README.md: -------------------------------------------------------------------------------- 1 | # passkeeper 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | npm run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | 28 | ### Customize configuration 29 | See [Configuration Reference](https://cli.vuejs.org/config/). 30 | -------------------------------------------------------------------------------- /web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "passkeeper", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "@fortawesome/fontawesome-svg-core": "^1.2.21", 12 | "@fortawesome/free-solid-svg-icons": "^5.10.1", 13 | "@fortawesome/vue-fontawesome": "^0.1.6", 14 | "axios": "^0.19.0", 15 | "bootstrap": "^4.3.1", 16 | "bootstrap-vue": "^2.0.0-rc.27", 17 | "core-js": "^2.6.5", 18 | "v-file-upload": "^3.1.7", 19 | "vue": "^2.6.10", 20 | "vue-router": "^3.0.7" 21 | }, 22 | "devDependencies": { 23 | "@vue/cli-plugin-babel": "^3.9.0", 24 | "@vue/cli-plugin-eslint": "^3.9.0", 25 | "@vue/cli-service": "^3.9.0", 26 | "babel-eslint": "^10.0.1", 27 | "eslint": "^5.16.0", 28 | "eslint-plugin-vue": "^5.0.0", 29 | "vue-template-compiler": "^2.6.10" 30 | }, 31 | "eslintConfig": { 32 | "root": true, 33 | "env": { 34 | "node": true 35 | }, 36 | "extends": [ 37 | "plugin:vue/essential", 38 | "eslint:recommended" 39 | ], 40 | "rules": {}, 41 | "parserOptions": { 42 | "parser": "babel-eslint" 43 | } 44 | }, 45 | "postcss": { 46 | "plugins": { 47 | "autoprefixer": {} 48 | } 49 | }, 50 | "browserslist": [ 51 | "> 1%", 52 | "last 2 versions" 53 | ] 54 | } 55 | -------------------------------------------------------------------------------- /web/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jdevelop/passkeeper/9f4f89d32d88c0b0e3dc074cbefc3204258801dd/web/public/favicon.ico -------------------------------------------------------------------------------- /web/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | PassKeeper WEB 2.0 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /web/public/style.css: -------------------------------------------------------------------------------- 1 | #app { 2 | background-color: black; 3 | } -------------------------------------------------------------------------------- /web/src/App.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 23 | 24 | 43 | -------------------------------------------------------------------------------- /web/src/components/Home.vue: -------------------------------------------------------------------------------- 1 | 131 | 132 | 250 | 251 | 252 | -------------------------------------------------------------------------------- /web/src/components/Settings.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 142 | 143 | 149 | -------------------------------------------------------------------------------- /web/src/js/models.js: -------------------------------------------------------------------------------- 1 | export const Model = { 2 | Credentials: () => { 3 | return { 4 | id: "", 5 | service: "", 6 | secret: "", 7 | confirm: "", 8 | comment: "" 9 | }; 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /web/src/js/restapi.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | export const REST = { 4 | UpdateCardPassword(cardPassword, ok, fail) { 5 | axios 6 | .put(`${process.env.VUE_APP_API_URL}/cardpassword`, cardPassword, {}) 7 | .then(data => ok(data)) 8 | .catch(e => fail(e)); 9 | }, 10 | GeneratePasswords(done) { 11 | axios 12 | .get(`${process.env.VUE_APP_API_URL}/generate`, {}, {}) 13 | .then(data => done(data)); 14 | }, 15 | SaveCredentials(credentials, done) { 16 | axios 17 | .put(`${process.env.VUE_APP_API_URL}/add`, credentials, {}) 18 | .then(data => done(data)); 19 | }, 20 | ListCredentials(done) { 21 | axios 22 | .get(`${process.env.VUE_APP_API_URL}/list`, {}, {}) 23 | .then(data => done(data.data)); 24 | }, 25 | RemoveCredentials(id, done) { 26 | axios 27 | .delete(`${process.env.VUE_APP_API_URL}/${id}`, {}, {}) 28 | .then(data => done(data.data)); 29 | }, 30 | Backup() { 31 | axios 32 | .get(`${process.env.VUE_APP_API_URL}/backup`, { responseType: "blob" }) 33 | .then(response => { 34 | const url = window.URL.createObjectURL(new Blob([response.data])); 35 | const link = document.createElement("a"); 36 | link.href = url; 37 | link.setAttribute("download", "passkeeper-credentials.json"); 38 | document.body.appendChild(link); 39 | link.click(); 40 | }); 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /web/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import App from "./App.vue"; 3 | import BootstrapVue from "bootstrap-vue"; 4 | import VueRouter from "vue-router"; 5 | import "bootstrap/dist/css/bootstrap.css"; 6 | import "bootstrap-vue/dist/bootstrap-vue.css"; 7 | 8 | import { library } from "@fortawesome/fontawesome-svg-core"; 9 | import { faEyeSlash, faEdit, faTrash } from "@fortawesome/free-solid-svg-icons"; 10 | import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; 11 | 12 | library.add(faEyeSlash, faEdit, faTrash); 13 | Vue.component("font-awesome-icon", FontAwesomeIcon); 14 | 15 | import Home from "./components/Home.vue"; 16 | import Settings from "./components/Settings.vue"; 17 | 18 | Vue.use(BootstrapVue); 19 | Vue.use(VueRouter); 20 | 21 | Vue.config.productionTip = false; 22 | 23 | const routes = [ 24 | { path: "/", component: Home }, 25 | { path: "/settings", component: Settings } 26 | ]; 27 | 28 | const router = new VueRouter({ 29 | routes // short for `routes: routes` 30 | }); 31 | 32 | new Vue({ 33 | render: h => h(App), 34 | router: router 35 | }).$mount("#app"); 36 | --------------------------------------------------------------------------------