{"id":19437498,"url":"https://github.com/eric15342335/inspirematrix-buttons","last_synced_at":"2026-02-16T17:33:50.397Z","repository":{"id":247547896,"uuid":"824050374","full_name":"eric15342335/inspirematrix-buttons","owner":"eric15342335","description":"STEM education using RISC-V boards.","archived":false,"fork":false,"pushed_at":"2024-08-29T09:24:25.000Z","size":1579,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T11:54:47.582Z","etag":null,"topics":["adc","c","ch32v003","ch32v003fun","i2c","risc-v","ws2812b"],"latest_commit_sha":null,"homepage":"https://inspirelab.hk","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eric15342335.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-07-04T09:07:53.000Z","updated_at":"2025-04-26T18:36:16.000Z","dependencies_parsed_at":"2024-07-22T04:23:58.232Z","dependency_job_id":"91c3beaf-013e-4ea1-b06e-9da5a9b44e67","html_url":"https://github.com/eric15342335/inspirematrix-buttons","commit_stats":null,"previous_names":["eric15342335/inspirematrix-buttons"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/eric15342335/inspirematrix-buttons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric15342335%2Finspirematrix-buttons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric15342335%2Finspirematrix-buttons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric15342335%2Finspirematrix-buttons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric15342335%2Finspirematrix-buttons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eric15342335","download_url":"https://codeload.github.com/eric15342335/inspirematrix-buttons/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric15342335%2Finspirematrix-buttons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29513989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["adc","c","ch32v003","ch32v003fun","i2c","risc-v","ws2812b"],"created_at":"2024-11-10T15:14:45.647Z","updated_at":"2026-02-16T17:33:50.381Z","avatar_url":"https://github.com/eric15342335.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InspireMatrix + CH32V003\n\nThis repository contains various projects and utilities for\nworking with the CH32V003 microcontroller.\n\nOlder hardware (InspireMatrix):\n\n![InspireMatrix](inspire_matrix.jpeg)\n\n## Project Structure\n\n* `.github`:\n  * `workflows`: GitHub Actions workflows.\n  * `Doxyfile`: Doxygen configuration.\n\n* `.vscode`:\n  * `settings.json`: VSCode settings:\n\n    ```json\n    \"C_Cpp.default.compilerPath\": \"riscv-none-elf-gcc\",\n    ```\n\n  To set the default compiler to `riscv-none-elf-gcc` for IDE integration.\n\n* `ch32v003_stt`\n  * Simple spoken digit recognition.\n  * Originally from \u003chttps://github.com/brian-smith-github/ch32v003_stt\u003e\n  * Read its [README.md](ch32v003_stt/STT-README.md) for more information.\n\n* `ch32v003fun`\n  * `driver.h`: Contains the most frequently used functions for the CH32V003.\n  * `i2c_events.h`: Contains some frequently used I2C functions written manually.\n  * `i2c_tx.c`, `i2c_tx.h`, `oled_min.c`, `oled_min.h`: Contains some frequently used functions for the SSD1306 OLED display. Comes from \u003chttps://github.com/eric15342335/inspirelab-game\u003e\n  * `ws2812b_simple.h`: Contains one function for controlling the WS2812B LEDs.\n  You need to declare the following variables in your code:\n  In `funconfig.h`:\n  \n    ```c\n    #define FUNCONF_SYSTICK_USE_HCLK 1\n    ```\n\n    In your code (e.g. `main.c`):\n  \n    ```c\n    #define WS2812BSIMPLE_IMPLEMENTATION\n    // ...\n    #include \"ws2812b_simple.h\"\n    ```\n\n  * Originally from the `extralibs` folder in \u003chttps://github.com/cnlohr/ch32v003fun\u003e\n\n* `data`\n  * `buttons.h`: Button ADC calibration data.\n\n    Contains two sets of data, one for the first prototype\n    `InspireMatrix` and one for the second prototype `InspireComputer` (which uses two ADC channels for buttons). If you are using the `InspireComputer`, declare the following in `funconfig.h`:\n\n    ```c\n    #define INTERNAL_INSPIRE_MATRIX\n    ```\n\n  * `colors.h`: Contains the color palette for the `InspireMatrix` or `InspireComputer`.\n  \n    One global variable `led_array[]` act as buffer to store the color data to be displayed.\n    Provides functions to manipulate the `led_array[]` buffer.\n\n  * `fonts.h`: Display numbers and characters in the size of 3x5 on WS2812B LEDs.\n\n  * `music.h`: Frequencies, durations and functions for playing music using a buzzer.\n  To play sound, use `JOY_sound()`.\n\n* `emulator`\n  * Support development of basic embedded system software on Windows/MacOS without requiring\n  physical hardware.\n  * Aims to achieve function compatibility with the `ch32v003fun` library.\n\n* `i2c-comm`\n  * Communication between two boards using I2C protocol. The code contains a master and a slave.\n\n* `misc`\n  * `libgcc.a` required by the `ch32v003fun` library on MacOS. See [here](misc/README.md) for more information.\n\n* `movingnum`\n  * Animations of numbers moving from right to left, bottom to top. Uses math instead of hard coding.\n  Demonstrates the use of `fonts.h`.\n\n* `paint-cursor`\n  * Draw images on `InspireMatrix` with direction buttons and matrix buttons\n  * Connection:\n    * PD2: SW (Analog to Digital PIN)\n    * PC6: IN (WS2812B Data PIN)\n\n* `paint`\n  * Paint on `InspireMatrix`.\n\n* `rv-asm`\n  * Coding RISC-V Compressed instructions on a board with buttons, and showing the result on the matrix.\n  * Originally from \u003chttps://github.com/mnurzia/rv\u003e\n\n* `rv-dis` (Working in progress)\n  * Disassemble RISC-V compressed instructions and print the result on an external OLED display (e.g. SSD1306).\n  * Originally from \u003chttps://github.com/michaeljclark/riscv-disassembler\u003e\n\n* `testing`\n  * This folder contains a bunch of test programs that are subject to change, and are not guaranteed to work for\n  your specific hardware.\n\n\u003e [!NOTE]\n\u003e Both `savepaint` and `save-rvasm` implements an filesystem structure.\n\n* `savepaint`\n  * Add saving and loading features.\n  * Combines `paint`, `movingcar`, `snake-game` and `tic-tac-toe`\n  * How to play:\n    * Before first icon appearing, hold Y to clear all the saved paints.\n    * After first icon appearing, use `UP` and `DOWN` to select apps.\n    * Use `LEFT` to use the selected app.\n    * Integrated `paint`:\n      * Press 64 (or `NUM_LEDS` buttons) to toggle between foreground color and background color.\n      * Press X or Y to change the foreground or background color.\n      * Press `UP` button to load a saved paint.\n      * Press `DOWN` button to save the current paint.\n    * Integrated `movingcar`:\n      * Currently 64 buttons are divided into left and right section.\n      * For each row (8 buttons), left four buttons correspond to `Left Wheel Forward`, `Left Wheel Backward`, `Right Wheel Forward`, `Right Wheel Backward`.\n      * For each row (8 buttons), right four buttons correspond to `Red`, `Green`, `Blue` and `Special Command` (Currently not used). The LEDs will display the colors when the motor is running.\n      * E.g. if buttons (counting from left) 1, 3, 5 are pressed, the car will go forward and displays red on the entire screen.\n      * Special: If all 8 buttons are pressed, the program will go back the first instruction to execute.\n    * Integrated `snake-game`:\n      * Press Y to start.\n      * Use `up / down / left / right` to move the snake.\n    * Integrated `tic-tac-toe`:\n      * Press any of the empty spot to play.\n    * When any of the app ends, press `Y` to go back to the main menu. (`NVIC_SystemReset()` is called)\n\n* `save-rvasm`\n  * Add saving and loading features\n  * Uses `rv-asm`.\n  * How to play:\n    * Before the load save menu appear, hold `X` to clear all the saved paints.\n    * Pick a saved program to load. Each program size is 32 instructions (hence 64 bytes / 1 page in the filesystem).\n    * Press `Y` to load the default program (Smile face) instead of loading a saved program.\n      You must choose this if no program are saved.\n    * Use `UP` and `DOWN` to navigate the instruction pages. The top 32 LEDs in light pink indicates\n      which page is currently displayed. E.g. 1 LED on =\u003e page 1 =\u003e Instruction 1 and 2.\n    * Use `Y` to execute the program.\n    * The button `32` LEDs are used to display the current instruction, with the active bit highlighted as `blue`.\n    * Notes when writing programs:\n      * You `MUST` end your program with an `ecall` (a.k.a `0x0073`) to exit the program.\n\n* `snake-game`\n  * Porting the classic snake game to `InspireMatrix`, which has `8x8`=`64` LEDs and `up / down / left / right` controls.\n\n* `tic-tac-toe`\n  * Play tic-tac-toe with a bot\n  * Press button to start\n  * Green is player while Red is the bot\n  * Try to win it (very easy)\n\n## `funconfig.h` Explanation\n\n```c\n#ifndef _FUNCONFIG_H // Guard\n#define _FUNCONFIG_H\n\n#define CH32V003 1 // Required\n#define FUNCONF_USE_DEBUGPRINTF 0\n#define FUNCONF_USE_UARTPRINTF 1 // For printf() over UART (Use Hercules to view)\n#define FUNCONF_UART_PRINTF_BAUD 115200 // Baud rate\n// Connect UTX pin to RX pin in WCH-LinkE\n\n// Newly created definitions\n#define horizontalButtons 8\n#define verticalButtons 8\n#define NUM_LEDS (horizontalButtons * verticalButtons)\n\n// Not required for the new InspireComputer board\n// For GameConsole, need to define the following\n// and connect buzzer pin to RX.\n// Affects ch32v003fun.h SystemInit() UART printf initialization.\n// #define CH32V003J4M6_USE_PD6_AS_UART_TX\n\n// Required for WS2812B LEDs `ws2812b_simple.h`\n#define FUNCONF_SYSTICK_USE_HCLK 1\n\n#endif\n\n```\n\n## Compilation\n\nTwo options are available for compilation:\n\n* `make`\n  * Compile and output `*.hex` and `*.bin` files which can be used for flashing the program into\n  CH32V003.\n\n* `make emulator`\n  * Compile an executable using `GCC` which runs natively on your operating system, simulating behaviour on real hardware.\n\n## Credits\n\nGreat thanks to these projects (LICENSE included):\n\n* \u003chttps://github.com/cnlohr/ch32v003fun\u003e\n* \u003chttps://github.com/brian-smith-github/ch32v003_stt\u003e\n* \u003chttps://github.com/mnurzia/rv\u003e\n* \u003chttps://github.com/michaeljclark/riscv-disassembler\u003e\n* \u003chttps://github.com/hexeguitar/ch32v003fun_libs\u003e\n\n## Check out our other projects as well\n\n* \u003chttps://github.com/eric15342335/inspirelab-game\u003e\n  * A game console based on the `CH32V003J4M6` MCU.\n  * Originally from \u003chttps://github.com/wagiminator/CH32V003-GameConsole\u003e\n\n* \u003chttps://github.com/eric15342335/BitNetMCU\u003e\n  * Receives image data via UART and predict the digit using an ML model.\n  * Originally from \u003chttps://github.com/cpldcpu/BitNetMCU\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feric15342335%2Finspirematrix-buttons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feric15342335%2Finspirematrix-buttons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feric15342335%2Finspirematrix-buttons/lists"}