| Crates.io | embedded-hal-mock |
| lib.rs | embedded-hal-mock |
| version | 0.11.1 |
| created_at | 2018-03-31 16:51:58.031193+00 |
| updated_at | 2024-06-02 18:29:42.173743+00 |
| description | A collection of mocked devices that implement the embedded-hal traits |
| homepage | |
| repository | https://github.com/dbrgn/embedded-hal-mock |
| max_upload_size | |
| id | 58354 |
| size | 200,151 |
This is a collection of types that implement the embedded-hal traits.
The implementations never access real hardware. Instead, the hardware is mocked or no-op implementations are used.
The goal of the crate is to be able to test drivers in CI without having access to hardware.
See module-level docs for more information.
This crate supports both version 0.x and version 1.x of embedded-hal. By default only support
for version 0.x is enabled. To enable support for version 1.x, use the eh1 feature.
There are currently the following cargo features:
eh0: Provide module eh0 that mocks embedded-hal version 0.x (enabled by default)eh1: Provide module eh1 that mocks embedded-hal version 1.x (enabled by default)embedded-time: Enable the eh0::timer module (enabled by default)embedded-hal-async: Provide mocks for embedded-hal-async in eh1Currently this crate is not no_std. If you think this is important, let
me know.
| Feature | embedded-hal | embeded-hal-async |
|---|---|---|
| I²C | ✅ | ✅ |
| SPI | ✅ | ✅ |
| No-op delay | ✅ | ✅ |
| Actual delay | ✅ | ✅ |
| Serial | ✅ | - |
| RNG | - | - |
| I/O pins (including PWM) | ✅ | ✅ |
| ADC | ✅ | - |
Timers (with embedded-time Cargo feature) |
✅ | - |
Pull requests for more mock implementations are welcome! :)
This crate is guaranteed to compile on stable Rust 1.63 and up. It might compile with older versions but that may change in any new patch release.
embedded-halIf you would like to use the current development version of embedded-hal (or any other version),
so long as they are API compatible you can use a patch field in your Cargo.toml file to override
the dependency version.
[patch.crates-io]
eh1 = { git = "https://github.com/rust-embedded/embedded-hal" }
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.