embedded-hal-mock
A collection of mocked devices that implement the embedded-hal traits
0.11.1
5.6M downloads/mo
#4303 most downloaded on crates.io
dbrgn/embedded-hal-mock
What this package is like to depend on
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.4 years
Nearly every release is documented
notes for 15 of 15 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
19 releases · first in 2018
0 releases in the last 12 months
see the full history below
Release timeline
19 releases · Mar 2018 to Jun 2024Releases
latest 19-
0.11.102 Jun 2024Release notes
Open source →This release only includes a documentation fix (with regards to default-enabled Cargo features), but no code changes.
-
0.11.030 May 2024Release notes
Open source →This release adds support for various async APIs as defined in
embedded-hal-async. To use these features, you need to enable theembedded-hal-asyncCargo feature.If you're upgrading from an earlier version, please note that the
pinmodule was renamed todigitalto matchembedded-hal.Added
- Add
ToggleableOutputPinsupport foreh0::digital::Mock(#89) - Add
StatefulOutputPinsupport foreh1::digital::Mock(#89) - Async support for
eh1::i2c::Mock(#119) - Async support for
eh1::digital::Mock(#91) - Async delay for
NoopDelay/StdSleep(#104) - New
CheckedDelaymock that supports both sync and async delays (#104)
Changed
- Rename
pinmodule todigitalto match embedded-hal (#113) - Improve top level usage docs (#117)
- Add
-
0.10.011 Jan 2024Release notes
Open source →This release contains a big change:
embedded-hal-mocknow supports bothembedded-hal0.x and 1.x! The two variants are accessible throughembedded_hal_mock::eh0::*andembedded_hal_mock::eh1::*. If there are any issues, leave feedback in the GitHub issue tracker.Additionally, tests now fail if you forgot to call
.done(). This should reduce the chance of accidentally writing a broken test.This release contains commits by 12 different people, thanks a lot for the contributions!
Migrating to 0.10.0
- Update your imports: Change
use embedded_hal_mock::*touse embedded_hal_mock::eh0::* - Rename all
.expect(...)calls on mocks to.update_expectations(...) - Rename all
eh0::delay::MockNoopusages toeh0::delay::NoopDelay - Run your tests to ensure that you don't have any missing
.done()calls in your code - Look through the rest of the changes below and check if they might affect your code
Added
- Support for both
embedded-hal0.x and 1.x in the same crate (#75) - Print a warning to stderr and fail test if a mock is dropped without having
calling
.done()on it, or if.done()is called twice (#59, #61) - Implement mock for
eh1::pwm::SetDutyCycle
Fixed
Genericmock: Fix a bug that caused the call to.done()to fail if.next()was called on the mock after all expectations have already been consumed (#58)- Fix assertion error message for SPI
transferandtransfer_in_place(#90)
Changed
- Renamed
.expect(...)method to.update_expectations(...)to avoid confusion with the expect method inOptionandResult(#63) - When updating expectations on a mock by calling
.expect(...)/.update_expectations(...)on it, assert that previous expectations have been consumed (#63) - Rename
delay::MockNooptodelay::NoopDelay. - Changed the eh1 SPI implementation to be generic over word size
- Updated
nbdependency from 0.1 to 1.1 (#107) - Bump minimal supported Rust version (MSRV) to 1.63 (or 1.75 if you use embedded-hal 1.0)
- The minimal supported Rust version (MSRV) is specified in the
Cargo.tomlto offer clearer error messages to consumers with outdated Rust versions
- Update your imports: Change
-
0.10.0-rc.414 Dec 2023 pre-releaseNothing published for this version
-
0.10.0-rc.329 Nov 2023 pre-releaseNothing published for this version
-
0.10.0-rc.223 Nov 2023 pre-releaseNothing published for this version
-
0.10.0-rc.101 Nov 2023 pre-releaseNothing published for this version
-
0.9.006 Jan 2023Release notes
Open source →Added
- Implement
WriteIterandWriteIterReadfor i2c mock (#44) - Implement
PwmPinfor pin mock (#52) - Add mock for timers using embedded-time with nanosecond precision (#40)
Changed
- Bump minimal supported Rust version (MSRV) to 1.60
- Switch to Rust 2021 edition (#55)
- Switch from CircleCI to GitHub Actions (#50)
- Implement
-
0.8.016 Aug 2021 -
0.7.202 Jun 2020Release notes
Open source →Added
- Implement
std::Errortrait forMockError(#31) - serial: Implement error expectations (#32)
- Implement
-
0.7.103 Jan 2020Release notes
Open source →Added
- i2c: Implement error expectations (#29)
Fixed
- Fix link to digital pin docs (#28)
-
0.7.022 May 2019Release notes
Open source →Added
- The serial transaction API now has two new constructor methods:
read_manyandwrite_many.
Changed
- The serial transaction API changed: The
Transaction::writefunction now expects a single word, not a collection of words. To add a transaction for many writes, useTransaction::write_manyinstead.
Fixed
- Make the serial mock actually cloneable
- The serial transaction API now has two new constructor methods:
-
0.6.010 May 2019Release notes
Open source →Added
- Add serial device mock (#21)
- Add InputPin and OutputPin mocks (#18)
Changed
MockError::Ionow wraps anio::ErrorKindinstance instead ofio::Error.
-
0.5.007 Jan 2019Release notes
Open source →Added
- SPI: Add support for non-blocking
FullDuplexmode (#14)
Changed
- Require Rust 1.31+
- Apply and enforce rustfmt
- SPI: Add support for non-blocking
-
0.4.126 Dec 2018Release notes
Open source →Added
- Add
StdSleepdelay implementation based onstd::thread::sleep(#8) - Add
new()methods toMockNoopandStdSleep
Fixed
- Fix error messages for unfulfilled I²C expectations (#12)
- Add
-
0.4.022 Oct 2018Release notes
Open source →Changed
- I²C mock has a new transaction based API, matching the SPI mock (#4)
-
0.3.012 Oct 2018Release notes
Open source →Added
- SPI mock implementation (#2)
- Set up CI (#3)
Changed
- Restructure crate:
I2cMockis now ati2c::MockDelayMockNoopis now atdelay::MockNoop
- Move all docs into crate docs (so it can be tested)
-
0.2.018 Jun 2018 -
0.1.031 Mar 2018