{"id":31890042,"url":"https://github.com/db7/crunch-ps2decoder","last_synced_at":"2026-02-17T07:08:12.270Z","repository":{"id":317053737,"uuid":"1065809059","full_name":"db7/crunch-ps2decoder","owner":"db7","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-28T13:57:19.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-28T15:45:47.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/db7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-28T13:25:54.000Z","updated_at":"2025-09-28T13:57:22.000Z","dependencies_parsed_at":"2025-09-28T15:45:49.859Z","dependency_job_id":null,"html_url":"https://github.com/db7/crunch-ps2decoder","commit_stats":null,"previous_names":["db7/crunch-ps2decoder"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/db7/crunch-ps2decoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fcrunch-ps2decoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fcrunch-ps2decoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fcrunch-ps2decoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fcrunch-ps2decoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/db7","download_url":"https://codeload.github.com/db7/crunch-ps2decoder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fcrunch-ps2decoder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014114,"owners_count":26085463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T07:17:51.695Z","updated_at":"2025-10-13T07:17:54.346Z","avatar_url":"https://github.com/db7.png","language":"Scheme","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PS/2 Mouse Decoder (Teensy 2.0 + CRUNCH Scheme)\n\nThis project implements a PS/2 mouse/trackpoint decoder on a Teensy 2.0\n(ATmega32U4).  It uses USART1 in synchronous slave mode to sample PS/2 frames\nand a ring buffer + state machine written in [CRUNCH\nScheme](https://wiki.call-cc.org/eggref/6/crunch).  Decoded motion packets are\nstreamed to the host via USB using PJRC’s `usb_serial`.\n\n## Features\n- No bit-banging — PS/2 captured in hardware via USART1.\n- Handles unmarked PS/2 IC that streams immediately\n (no init required, no config possible).\n- Ring buffer shared between ISR and main loop (atomic access).\n\n## Hardware\n\n- **Board:** Teensy 2.0 (ATmega32U4, 16 MHz)\n- **Connections:**\n\n```\nDAT ── PD2 (RXD1)\nCLK ── PD5 (XCK1)\nVCC ── VCC (5 V)\nGND ── GND\nRST ── leave floating\n\nCLK and DAT require 4.7 kΩ pull-ups to VCC.\n```\n\n## Software requirements\n- `avr-gcc`, `make`, `teensy_loader_cli`\n- CHICKEN Scheme v6.0.0pre1 + CRUNCH egg v0.98\n- `curl` and `git` (for fetching `usb_serial`)\n\n## Build \u0026 flash\n\nFirst, fetch and build PJRC’s `usb_serial`:\n```sh\nmake -C deps\n```\n\nNext, build firmware and flash board:\n\n```sh\nmake\nmake flash\n```\n\n## Usage\n\nConnect the Teensy to USB. Decoded PS/2 packets (X, Y motion, flags) are printed\nover CDC serial.\nUse `screen`, `minicom`, or `cu` to view output.\n\n## Project structure\n\n```\n.\n├── Makefile             # Build rules, fetches PJRC usb_serial if missing\n├── main.scm             # Entry point, init + main loop\n├── avr.ps2.scm          # USART1 setup, RX ISR, ps2-ready?/ps2-read\n├── byte-rbuf.scm        # Ring buffer implementation\n├── ps2-decoder.scm      # PS/2 packet state machine (header → motion)\n├── byte-utils.scm       # Helpers for byte arithmetic and comparisons\n├── avr.usb.scm          # Wrapper around PJRC usb_serial\n└── crunch-environment.h # Freestanding CRUNCH environment config\n```\n\n## License\n\nThis project is released under the **0BSD license** -- free for any use, without\nattribution requirements.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb7%2Fcrunch-ps2decoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdb7%2Fcrunch-ps2decoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb7%2Fcrunch-ps2decoder/lists"}