embedded-hal
A Hardware Abstraction Layer (HAL) for embedded systems
1.0.0
31M downloads/mo
#1649 most downloaded on crates.io
rust-embedded/embedded-hal
What this package is like to depend on
Last release 3 years ago
no release in 18 months
Ships fairly regularly
a new release about every 2 months
Most releases are documented
notes for 9 of 13 stable releases
Nothing withdrawn
no release was ever pulled
9 years old
28 releases · first in 2018
0 releases in the last 12 months
see the full history below
Release timeline
28 releases · Jan 2018 to Jan 2024Releases
latest 28-
1.0.009 Jan 2024Release notes
Open source →Check out the announcement blog post and the migration guide.
Changes since v1.0.0-rc.3:
- gpio: remove
ToggleableOutputPin, movetoggle()toStatefulOutputPin.
Release notes
Open source →Check out the announcement blog post and the migration guide for help with migrating from v0.2 to v1.0.
- gpio: remove
ToggleableOutputPin, movetoggle()toStatefulOutputPin.
- gpio: remove
-
1.0.0-rc.314 Dec 2023 pre-release -
1.0.0-rc.229 Nov 2023 pre-releaseRelease notes
Open source →- Minor document fixes.
- Add #[inline] hints to most of
embedded-halfunctions. - pwm: rename
get_max_duty_cycletomax_duty_cycle. - delay: Rename
DelayUstoDelayNs - delay: Add
DelayNs::delay_ns() - delay: Add default impls of
delay_msanddelay_usbased ondelay_ns. - delay: Make the default impl of
delay_msmore efficient, it now does less calls to the underlyingdelay_ns(previouslydelay_us). - spi: Rename
Operation::DelayUstoOperation::DelayNs, with nanosecond precision.
-
1.0.0-rc.115 Aug 2023 pre-releaseRelease notes
Open source →- The Minimum Supported Rust Version (MSRV) is now 1.60.0
- Add optional
defmt0.3 support. - Remove serial traits, the replacement is the
embedded-iocrate. - Added
+ ?Sizedto all blanket impls.
-
1.0.0-alpha.1104 Jul 2023 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Added
- spi: added
Operation::DelayUs(u32).
Removed
- spi: removed read-only and write-only traits.
- spi: added
-
1.0.0-alpha.1005 Apr 2023 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Added
- Added
pwm::SetDutyCycletrait.
Changed
- gpio: add
ErrorKindenum for consistency with other traits and for future extensibility. No kinds are defined for now. - delay: make infallible.
- i2c: remove
_iter()methods. - i2c: add default implementations for all methods based on
transaction(). - i2c: document guidelines for shared bus usage.
- spi: SpiDevice transaction now takes an operation slice instead of a closure
- Added
-
1.0.0-alpha.928 Sep 2022 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Changed
- The
embedded-halcrate now contains blocking traits only. Import paths no longer contain::blocking.
Added
- Implement
PartialOrd,Ord,Hashforcan::StandardId,can::ExtendedIdandcan::Idaccording to CAN bus arbitration rules - Implement
Eqfori2c::Operation - Implement
PartialOrd,Ord,Hashforcan::StandardId,can::ExtendedIdandcan::Idaccording to CAN bus arbitration rules.
Fixed
- Fixed documentation for
wait_for_rising_edge.
Removed
digital::blocking::IoPintraits. See: #340, #397.nbtraits are now available in a separateembedded-hal-nbcrate.spi::blocking::ExclusiveDeviceandspi::blocking::ExclusiveDeviceError. These have been moved to a separateembedded-hal-buscrate.- Moved CAN traits to a separate
embedded-cancrate.
- The
-
1.0.0-alpha.815 Apr 2022 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Changed
- The Minimum Supported Rust Version (MSRV) is now 1.59.0
spi: unify all traits intoSpiReadBus,SpiWriteBusandSpiBus(read-write).spi: AddSpiDevicetrait to represent a single device in a (possibly shared) bus, with managed chip-select (CS) pin.spi: Clarify that implementations are allowed to return before operations are finished, addflushto wait until finished.
Removed
- ADC traits:
adc::nb::OneShotandadc::nb::Channel.
-
1.0.0-alpha.710 Feb 2022 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Added
Errortraits for CAN, SPI, I2C and Serial are implemented forInfallible.
Fixed
- Fixed blanket impl of
DelayUsnot covering thedelay_msmethod.
Changed
spi: traits now enforce all impls on the same struct (e.g.TransferandWrite) have the sameErrortype.digital: traits now enforce all impls on the same struct have the sameErrortype.serial: traits now enforce all impls on the same struct have the sameErrortype.i2c: traits now enforce all impls on the same struct have the sameErrortype.i2c: unify all traits into a singleI2ctrait.
Removed
-
1.0.0-alpha.619 Nov 2021 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Changed
- Use
u8as default SPI as Serial Word type - The Minimum Supported Rust Version (MSRV) is now 1.46.0
- Require all SPI and Serial word types to be
Copy.
Added
- Added
CanController Area Network traits. Errortraits for SPI, I2C and Serial traits. The error types used in those must implement theseErrortraits, which implies providing a conversion to a common set of error kinds. Generic drivers using these interfaces can then convert the errors to this common set to act upon them.
Removed
- Removed
DelayMsin favor ofDelayUswithu32as type for clarity.
- Use
-
1.0.0-alpha.511 Sep 2021 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Added
- Added
IoPintrait for pins that can change between being inputs or outputs dynamically. - Added
Debugto all spi mode types. - Add impls of all traits for references (
&Tor&mut Tdepending on the trait) whenTimplements the trait. - SPI: Added blocking
Readtrait andReadtransactional operation - SPI: Added blocking
Transfertrait with separate buffers (single-bufferTransferhas been renamedTransferInplace)
Changed
- Swap PWM channel arguments to references
- All trait methods have been renamed to remove the
try_prefix (i.e.try_send->send) for consistency. - Moved all traits into two submodules for each feature depending on the execution model:
blockingandnb(non-blocking). For example, the spi traits can now be found underembedded_hal::spi::blockingorembedded_hal::spi::nb. - Execution-model-independent definitions have been moved into the feature module. For example, SPI
Phaseis now defined inembedded_hal::spi::Phase. For convenience, these definitions are reexported in both of its blocking and non-blocking submodules. - Re-export
nb::{block!, Error, Result}to avoid version mismatches. These should be used instead of importing thenbcrate directly in dependent crates. blocking::Serial: renamedbwrite_alltowrite,bflushto `flush.- Removed
preludeto avoid method name conflicts between different flavors (blocking, nb) of the same trait. Traits must now be manually imported. - Removed the various
Defaultmarker traits. - Removed
&[W]returned slice inspi::blocking::Transfer. - Require all associated error types to implement
core::fmt::Debug.
Removed
- Removed random number generation (
rng) traits in favor of rand_core.
- Added
-
1.0.0-alpha.412 Nov 2020 pre-release -
1.0.0-alpha.304 Nov 2020 pre-releaseRelease notes
Open source →Added
TransactionalSPI interface for executing groups of SPI transactions.TransactionalI2C interface for executing groups of I2C transactions.
-
1.0.0-alpha.215 Oct 2020 pre-releaseRelease notes
Open source →*** This is (also) an alpha release with breaking changes (sorry) ***
Added
- 10-bit addressing mode for I2C traits.
try_set_statemethod forOutputPinusing an inputPinStatevalue.
Changed
- I2C addressing modes are now selected via an
AddressModetype parameter. The trait features implementations for marker typesSevenBitAddressandTenBitAddress.SevenBitAddressis the default mode so this is not a breaking change. - The method
try_writefrom the traitblocking::i2c::WriteItertrait has been renamedtry_write_iterfor consistency. - Updated
nbdependency to version1. - The watchdog API now uses move semantics. See PR.
- The ADC
Channeltrait now uses a stateful method to get the IDs.
-
1.0.0-alpha.116 Jun 2020 pre-releaseRelease notes
Open source →*** This is an alpha release with breaking changes (sorry) ***
Added
- A nonblocking trait for interfacing with random number generation hardware.
Changed
- All traits have been marked as proven (
unprovenfeature has been removed). - All trait methods have been made fallible.
- All trait methods have been renamed
try_*(i.e.try_send) for consistency. - The
Capture,Pwm,PwmPinandQeitraits have been moved into their owncapture,pwmandqeimodules for consistency. - Void has been replaced with
core::convert::Infalliblewhich should be used in trait implementations where methods cannot fail. - A new process has been adopted for the addition of traits to the embedded-hal.
- The ADC
Channeltrait now uses a constant to represent the IDs. - The minimum supported Rust version is 1.35 due to this issue.
-
0.2.709 Feb 2022Nothing published for this version
-
0.2.604 Aug 2021Nothing published for this version
-
0.2.528 Apr 2021Nothing published for this version
-
0.2.417 Jun 2020Nothing published for this version
-
0.2.309 May 2019Release notes
Open source →Added
- A new version of the digital
OutputPin,StatefulOutputPin,ToggleableOutputPinandInputPintraits has been added underdigital::v2. These traits are now fallible and their methods now return aResulttype as setting an output pin and reading an input pin could potentially fail. See here for more info. - Compatibility shims between
digital::v1anddigital::v2traits allowing v1 traits to be implicitly promoted to v2, and for v2 traits to be explicitly cast to v1 wrappers.
Changed
- The current versions of the
OutputPin,StatefulOutputPin,ToggleableOutputPinandInputPintraits have been marked as deprecated. Please use the new versions included indigital::v2. See here for more info.
- A new version of the digital
-
0.2.3-rc.110 Apr 2019 pre-releaseNothing published for this version
-
0.2.203 Nov 2018Release notes
Open source →Added
- Added the Rust Code of Conduct to this repository
- The first ADC-related trait. This is a simple trait for one-shot conversions.
- Iterator-based blocking write and write+read traits have been added to I2C and SPI.
- New helper constants for SPI modes.
- A new trait for a cancellable countdown.
- New traits for watchdog timer management, including startup, feeding, and stopping.
Changed
- Updated docs to clarify I2C address bit widths and expectations.
-
0.2.114 May 2018Release notes
Open source →Changed
- Auto-generated documentation (docs.rs) now includes the unproven traits.
-
0.2.012 May 2018Release notes
Open source →Added
- A
ToggeableOutputPintrait has been added. This trait contains a single method:togglethat can be used to toggle the state of a push-pull pin.
Changed
- [breaking-change] The signature of
CountDown.waitchanged; it now returnsnb::Result<(), Void>. WhereVoidis the stable alternative to the never type,!, provided by the stablevoidcrate. Implementations of theCountDowntrait will have to be updated to use the new signature. With this change this crate compiles on the stable and beta channels.
-
[breaking-change] the
OutputPin.is_{low,high}methods have been moved into its own traitStatefulOutputPinand renamed tois_set_{low,high}. -
It has been clarified in the documentation that
OutputPinmust be implemented for push-pull output pins (and e.g. not for open drain output pins).
- A
-
0.1.314 May 2018Release notes
Open source →Changed
- Re-export most / unchanged traits from embedded-hal v0.2.x to allow interoperation between HAL implementations and drivers that are using different minor versions.
-
0.1.213 Feb 2018 -
0.1.106 Feb 2018 -
0.1.016 Jan 2018