{"id":26146066,"url":"https://github.com/aaronc81/numworks-epsilon-rust-template","last_synced_at":"2025-03-11T04:59:37.473Z","repository":{"id":265944630,"uuid":"736763238","full_name":"AaronC81/numworks-epsilon-rust-template","owner":"AaronC81","description":"NumWorks Epsilon template app, with C and Rust","archived":false,"fork":false,"pushed_at":"2023-12-28T20:04:21.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T15:17:08.313Z","etag":null,"topics":["epsilon","numworks","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AaronC81.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}},"created_at":"2023-12-28T20:04:06.000Z","updated_at":"2023-12-28T20:04:52.000Z","dependencies_parsed_at":"2024-12-01T18:13:01.523Z","dependency_job_id":"ada88f38-e9e0-4cd0-b132-0b9887d73819","html_url":"https://github.com/AaronC81/numworks-epsilon-rust-template","commit_stats":null,"previous_names":["aaronc81/numworks-epsilon-rust-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronC81%2Fnumworks-epsilon-rust-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronC81%2Fnumworks-epsilon-rust-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronC81%2Fnumworks-epsilon-rust-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AaronC81%2Fnumworks-epsilon-rust-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AaronC81","download_url":"https://codeload.github.com/AaronC81/numworks-epsilon-rust-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242973971,"owners_count":20215249,"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":["epsilon","numworks","rust"],"created_at":"2025-03-11T04:59:36.809Z","updated_at":"2025-03-11T04:59:37.463Z","avatar_url":"https://github.com/AaronC81.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample Rust app for Epsilon\n\nThis is a sample EADK app for the [NumWorks calculator](https://www.numworks.com) which uses a C\n\"harness\" to run a Rust application.\n\n## Why?\n\nNumWorks provide a [pure Rust sample application](https://github.com/numworks/epsilon-sample-app-rust)\nthemselves, but it had some problems for me:\n\n- Calculator crash and reset when trying to call `eadk_display_draw_string`\n- Intermittent crashes or unexpected behaviour when drawing to the screen\n\nOn the contrary, I had no issues using the [Epsilon C example app](https://github.com/numworks/epsilon-sample-app-c).\n\nMy best guesses are either: Rust's compiler toolchain making decisions about memory allocation which\nNumWorks doesn't like; or an EABI incompatibility between Epsilon's EADK libraries and Rust.\n\nSo I decided to create a new sample application based on that C example, which compiles and links a\nRust static library. EADK APIs are usable through a provided `eadk_bridge`, which wraps EADK\nfunctions with \"simpler\" signatures to reduce the chance of EABI problems.\n\n```c\n// Original EADK API\ntypedef struct {\n  uint16_t x;\n  uint16_t y;\n  uint16_t width;\n  uint16_t height;\n} eadk_rect_t;\ntypedef uint16_t eadk_color_t;\neadk_display_push_rect_uniform(eadk_rect_t rect, eadk_color_t color);\n\n// Wrapped `eadk_bridge` API\neadk_bridge__display_push_rect_uniform(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);\n```\n\n## Features\n\nMost of the important EADK APIs are broken out into nice, high-level Rust APIs. For example:\n\n```rust\ndisplay::write_string(\n  \"Hello from Rust!\",\n  Point { x: 50, y: 50 },\n  Font::Large,\n  Color::BLACK,\n  Color::WHITE,\n);\n\ntiming::msleep(1000);\n```\n\nThere is also a `GlobalAlloc` implementation, so you can use the `alloc` crate.\n\n## Compatibility\n\nThis was developed/tested on:\n\n- `nwlink` 0.0.17, running on Node 18.19.0\n- Rust 1.71.0-nightly (c609da59d 2023-04-18)\n- NumWorks N0120, running Epsilon 21.3.0\n\n## Usage\n\nThe same dependencies apply as the [Epsilon C example app](https://github.com/numworks/epsilon-sample-app-c)\nwhich this is derived from.\n\nOnce installed, you can build an NWA and run it on your calculator:\n\n```shell\nmake build  # Build Rust and C parts into NWA\nmake check  # Ensure that NWA links successfully\nmake run    # Upload to calculator\n```\n\n## Layout\n\n`src` includes C source code, including the `main` and `eadk_bridge` definitions. You probably don't\nneed to edit any of the C files in here, besides the app name in `main.c`.\n\n`rs` contains the Rust code. In `lib.rs` you'll find the entry point, `rs_main`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronc81%2Fnumworks-epsilon-rust-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaronc81%2Fnumworks-epsilon-rust-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronc81%2Fnumworks-epsilon-rust-template/lists"}