{"id":16960125,"url":"https://github.com/dflemstr/embedded-platform","last_synced_at":"2025-07-19T15:06:44.855Z","repository":{"id":57624669,"uuid":"232091526","full_name":"dflemstr/embedded-platform","owner":"dflemstr","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-26T07:24:25.000Z","size":54,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T18:07:10.555Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dflemstr.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}},"created_at":"2020-01-06T11:59:00.000Z","updated_at":"2023-02-17T03:53:51.000Z","dependencies_parsed_at":"2022-08-26T22:21:50.105Z","dependency_job_id":null,"html_url":"https://github.com/dflemstr/embedded-platform","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Fembedded-platform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Fembedded-platform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Fembedded-platform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflemstr%2Fembedded-platform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflemstr","download_url":"https://codeload.github.com/dflemstr/embedded-platform/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487696,"owners_count":21112191,"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":[],"created_at":"2024-10-13T22:47:11.274Z","updated_at":"2025-04-11T22:10:28.666Z","avatar_url":"https://github.com/dflemstr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `embedded-platform`\n\n**NOTE**: This is currently a sketch work-in-progress set of libraries that should be treated as a proof-of-concept.\n\nThis is defines the `embedded-platform` set of crates.  The idea is to add device and peripheral support to complement\n`embedded-hal`-based crates.  This makes it possible to plug-and-play and mix-and-match different crates that adhere to\ncommon specs.  For example, if you have a `nrf52840`-based MCU as well as a `ili9341`-based device, and both adhere to\nthe Adafruit Feather spec (pin layout, voltage levels, ...), you can connect them up and all the wiring will be done for\nyou.\n\nThe ambition is that `embedded-platform` should be to `embedded-hal` what `tokio` is to `mio`.\n\nSome design trade-offs that have been made:\n\n  * `#![forbid(unsafe_code)]`; that belongs in `-pac` or `-hal` crates.\n  * Don't require `alloc`.\n  * Do some compatibility checks at runtime during startup instead of at compile time, for example to check that a pin\n    is used only once.  It turns out to be super tricky to do granular ownership mapping of device registers at compile\n    time (this has been done in [`drone-os`](https://www.drone-os.com/)), and instead we opt to do some checks at\n    runtime (e.g. `Option::take`).  This wastes a dozen or so instructions at startup, which is a one-time cost.\n  * All APIs are async-first, so that code won't have to block and we can be power efficient.  This does require an\n    executor, and one can be made that doesn't require `alloc`.  I created one that works for cortex-m devices in [core](./core) together with the [`direct-executor`](https://github.com/dflemstr/direct-executor) crate.\n  * The crate uses its own HAL-like traits for e.g. `OutputPin` or `I2cRead` to enable async APIs as well as smooth\n    over any incompatibilities between `embedded_hal::gpio::v1` and `embedded_hal::gpio::v2` etc.\n  * All platform crates should be maintained in this repository so that changes like the last bullet point can be\n    made in lock-step.\n  * Don't expose interrupts to the user.  `mypin.changes()` should return an async `futures::Stream` when the pin\n    changes.  In the background, we stash away a `Waker` that gets called from the interrupt handler.\n\nYou can think about the intended stack like this:\n\n```text\n┌─────────────────────────────────────────┐\n│         Peripheral Access Crate         │\n│            e.g. nrf52840-pac            │\n├─────────────────────────────────────────┤\n│        Hardware Abstraction Layer       │\n│            e.g. nrf52840-hal            │\n├─────────────────────────────────────────┤\n│         Platform Implementation         │\n│          e.g. nrf52840-platform         │\n│ ┌─────────────────────────────────────┐ │\n│ │          Specific Product           │ │\n│ │         e.g. Particle Argon         │ │\n│ ├─────────────────────────────────────┤ │\n│ │            Common Spec              │ │\n│ │        e.g. Adafruit Feather        │ │\n│ │          or Arduino Shield          │ │\n│ ├─────────────────────────────────────┤ │\n│ │              Adapter                │ │\n│ │        e.g. \"Main SPI bus\" on       │ │\n│ │        specific Feather pins        │ │\n│ └─────────────────────────────────────┘ │\n├─────────────────────────────────────────┤\n│              Device Driver              │\n│              e.g. ili9341               │\n└─────────────────────────────────────────┘\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflemstr%2Fembedded-platform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflemstr%2Fembedded-platform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflemstr%2Fembedded-platform/lists"}