{"id":27650805,"url":"https://github.com/grgomariani/raspberry-pico-pocket-gamer","last_synced_at":"2025-04-24T03:47:59.807Z","repository":{"id":287229609,"uuid":"522687703","full_name":"GrgoMariani/Raspberry-Pico-Pocket-Gamer","owner":"GrgoMariani","description":"A Raspberry Pico RP2040 and ILI9341 based pocket console.","archived":false,"fork":false,"pushed_at":"2023-01-01T09:32:14.000Z","size":177,"stargazers_count":42,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T03:47:54.422Z","etag":null,"topics":["game","ili9341","pico","raspberry-pi","raspberry-pi-pico","raspberrypi","raspberrypipico","rp2040"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrgoMariani.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}},"created_at":"2022-08-08T19:52:49.000Z","updated_at":"2024-12-08T18:02:17.000Z","dependencies_parsed_at":"2025-04-10T17:09:39.178Z","dependency_job_id":"8b41d205-84e1-49f6-907f-8ac5ef02e1d2","html_url":"https://github.com/GrgoMariani/Raspberry-Pico-Pocket-Gamer","commit_stats":null,"previous_names":["grgomariani/raspberry-pico-pocket-gamer"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2FRaspberry-Pico-Pocket-Gamer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2FRaspberry-Pico-Pocket-Gamer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2FRaspberry-Pico-Pocket-Gamer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrgoMariani%2FRaspberry-Pico-Pocket-Gamer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrgoMariani","download_url":"https://codeload.github.com/GrgoMariani/Raspberry-Pico-Pocket-Gamer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250560007,"owners_count":21450168,"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","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":["game","ili9341","pico","raspberry-pi","raspberry-pi-pico","raspberrypi","raspberrypipico","rp2040"],"created_at":"2025-04-24T03:47:59.264Z","updated_at":"2025-04-24T03:47:59.792Z","avatar_url":"https://github.com/GrgoMariani.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pico Pocket Gamer\n\nA Raspberry Pico __RP2040__ and __ILI9341__ based pocket console.\n\n[Featured on MagPi Issue #122](https://magpi.raspberrypi.com/articles/pico-pocket-gamer)\n\n\u003e Watch the video by clicking on the image\n\n[![Raspberry Pico Pocket Gamer Video](https://img.youtube.com/vi/271OoiJQUyk/0.jpg)](https://www.youtube.com/watch?v=271OoiJQUyk \"Raspberry Pico Pocket Gamer Video\")\n\n\n## Description\n\nSince the Pico came out I wanted to create a project for it that I can show my son to, so I decided to make him a Pocket Console. The game repertoire is quite basic and consists of fourteen different games.\n\n## Game list\n|              |             |            |\n|:------------:|:-----------:|:----------:|\n| TicTacToe 1P | Labirinth   | Snake      |\n| TicTacToe 2P | Connect4 1P | Calculator |\n| Lights Out   | Connect4 2P | Pong       |\n| Math         | 2048        | Breakout   |\n| Tetramino    | Paint.NOT   |            |\n\n## Hardware\nRequired components:\n* Raspberry Pico (__RP2040__)\n* __ILI9341__ controller with __XPT2046__ touch module (I am using 3.2'' version)\n* five switches (preferably mechanical switches)\n\n\u003e Optional components:\n\u003e * Printed __PCB__ (gerber available within `extras` folder of this repository)\n\u003e * Button (switch) 6mm\n\n\n## How to compile/run ?\n\nSteps are similar (same) as with any other C++ Pico SDK based project.\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake -j${nproc}\n```\n\nAfter which you should be able to find `build/PocketGamer.uf2` file to upload to your Pico microcontroller.\n\n\u003e __HINT__: In case you want to try the project without the Pico board `cd` into the `extras` folder and do a `make run`. I've adapted the interface and the main function to run on top of the olc's PixelGameEngine so you can try it directly from your Linux PC. Controls are `QWASD` and mouse click.\n\n## Pinout\nYou should be able to find a compressed __gerber__ file with `extras` directory of the repository and order a new PCB online on which you can solder all the elements easily.\n\nILI9341 to Pico pin connections looks like this:\n \n```\n ILI9341         Pico (RP2040)\n \n T_IRQ  \u003c-----\u003e PIN 20\n T_DO   \u003c-----\u003e PIN 8\n T_DIN  \u003c-----\u003e PIN 11\n T_CS   \u003c-----\u003e PIN 21\n T_CLK  \u003c-----\u003e PIN 10\n SDO    \u003c-----\u003e PIN 4\n LED    \u003c-----\u003e PIN 26 (or directly to 3v3)\n SCK    \u003c-----\u003e PIN 6\n SDI    \u003c-----\u003e PIN 7\n DC     \u003c-----\u003e PIN 18\n RESET  \u003c-----\u003e PIN 17\n CS     \u003c-----\u003e PIN 16\n GND    \u003c-----\u003e GND\n VCC    \u003c-----\u003e 3V3\n\n```\n \n Additionally keyboard switches are added to the following pins:\n \n```\n                   Pico (RP2040)\n \n KEY_MENU  \u003c-----\u003e PIN 0\n KEY_UP    \u003c-----\u003e PIN 15\n KEY_DOWN  \u003c-----\u003e PIN 27\n KEY_LEFT  \u003c-----\u003e PIN 28\n KEY_RIGHT \u003c-----\u003e PIN 14\n\n```\n\nIn case you need to change them they are all defined within their own source files: `src/interface.c`, `src/interface/ili9341.c` and `src/interface/ili9341_touchscreen.c`.\n\n## Code explanation\n\n```mermaid\nstateDiagram-v2\n    direction LR\n    A: DoMainLoop()\n    note left of A: Main loop description\n    state A {\n      GetInputs: Register keyboard and touch events\n      [*] --\u003e GetInputs\n      GetInputs --\u003e updateCallback\n      updateCallback --\u003e drawCallback\n      drawCallback --\u003e GetInputs\n    }\n    note left of B: SetupCallbacks(Callbacks* callbacks) changes your current game\n    B: SetupCallbacks(callbacks)\n    state B {\n      [*] --\u003e deinitCallback\n      deinitCallback --\u003e initCallback\n      initCallback --\u003e [*]\n    }\n```\n\n```mermaid\nclassDiagram\n    class Callbacks{\n        void * initCallback()\n        void * updateCallback()\n        void * drawCallback()\n        void * deinitCallback()\n    }\n```\n\n\u003e Should I add more detailed info here?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrgomariani%2Fraspberry-pico-pocket-gamer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrgomariani%2Fraspberry-pico-pocket-gamer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrgomariani%2Fraspberry-pico-pocket-gamer/lists"}