Skip to content

Commit

Permalink
bus/spi: add semver risk warning to new_no_delay.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Dec 27, 2023
1 parent 13e151c commit 3d6fcfe
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions embedded-hal-bus/src/spi/critical_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ impl<'a, BUS, CS, D> CriticalSectionDevice<'a, BUS, CS, D> {

impl<'a, BUS, CS> CriticalSectionDevice<'a, BUS, CS, super::NoDelay> {
/// Create a new [`CriticalSectionDevice`] without support for in-transaction delays.
///
/// **Warning**: The returned instance *technically* doesn't comply with the `SpiDevice`
/// contract, which mandates delay support. It is relatively rare for drivers to use
/// in-transaction delays, so you might still want to use this method because it's more practical.
///
/// Note that a future version of the driver might start using delays, causing your
/// code to panic. This wouldn't be considered a breaking change from the driver side, because
/// drivers are allowed to assume `SpiDevice` implementations comply with the contract.
/// If you feel this risk outweighs the convenience of having `cargo` automatically upgrade
/// the driver crate, you might want to pin the driver's version.
///
/// # Panics
///
Expand Down
10 changes: 10 additions & 0 deletions embedded-hal-bus/src/spi/exclusive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ impl<BUS, CS, D> ExclusiveDevice<BUS, CS, D> {

impl<BUS, CS> ExclusiveDevice<BUS, CS, super::NoDelay> {
/// Create a new [`ExclusiveDevice`] without support for in-transaction delays.
///
/// **Warning**: The returned instance *technically* doesn't comply with the `SpiDevice`
/// contract, which mandates delay support. It is relatively rare for drivers to use
/// in-transaction delays, so you might still want to use this method because it's more practical.
///
/// Note that a future version of the driver might start using delays, causing your
/// code to panic. This wouldn't be considered a breaking change from the driver side, because
/// drivers are allowed to assume `SpiDevice` implementations comply with the contract.
/// If you feel this risk outweighs the convenience of having `cargo` automatically upgrade
/// the driver crate, you might want to pin the driver's version.
///
/// # Panics
///
Expand Down
10 changes: 10 additions & 0 deletions embedded-hal-bus/src/spi/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ impl<'a, BUS, CS, D> MutexDevice<'a, BUS, CS, D> {

impl<'a, BUS, CS> MutexDevice<'a, BUS, CS, super::NoDelay> {
/// Create a new [`MutexDevice`] without support for in-transaction delays.
///
/// **Warning**: The returned instance *technically* doesn't comply with the `SpiDevice`
/// contract, which mandates delay support. It is relatively rare for drivers to use
/// in-transaction delays, so you might still want to use this method because it's more practical.
///
/// Note that a future version of the driver might start using delays, causing your
/// code to panic. This wouldn't be considered a breaking change from the driver side, because
/// drivers are allowed to assume `SpiDevice` implementations comply with the contract.
/// If you feel this risk outweighs the convenience of having `cargo` automatically upgrade
/// the driver crate, you might want to pin the driver's version.
///
/// # Panics
///
Expand Down
10 changes: 10 additions & 0 deletions embedded-hal-bus/src/spi/refcell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ impl<'a, BUS, CS, D> RefCellDevice<'a, BUS, CS, D> {

impl<'a, BUS, CS> RefCellDevice<'a, BUS, CS, super::NoDelay> {
/// Create a new [`RefCellDevice`] without support for in-transaction delays.
///
/// **Warning**: The returned instance *technically* doesn't comply with the `SpiDevice`
/// contract, which mandates delay support. It is relatively rare for drivers to use
/// in-transaction delays, so you might still want to use this method because it's more practical.
///
/// Note that a future version of the driver might start using delays, causing your
/// code to panic. This wouldn't be considered a breaking change from the driver side, because
/// drivers are allowed to assume `SpiDevice` implementations comply with the contract.
/// If you feel this risk outweighs the convenience of having `cargo` automatically upgrade
/// the driver crate, you might want to pin the driver's version.
///
/// # Panics
///
Expand Down

0 comments on commit 3d6fcfe

Please sign in to comment.