Skip to content

Commit 1ae5990

Browse files
committed
Rename transaction_helper! to transaction
1 parent 0392676 commit 1ae5990

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

embedded-hal-async/src/spi.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ where
4141
/// # Examples
4242
///
4343
/// ```
44-
/// use embedded_hal_async::spi::{transaction_helper, SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
44+
/// use embedded_hal_async::spi::{transaction, SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
4545
///
4646
/// pub async fn transaction_example<SPI>(mut device: SPI) -> Result<u32, SPI::Error>
4747
/// where
4848
/// SPI: SpiDevice,
4949
/// SPI::Bus: SpiBus,
5050
/// {
51-
/// transaction_helper!(&mut device, move |bus| async move {
51+
/// transaction!(&mut device, move |bus| async move {
5252
/// // Unlike `SpiDevice::transaction`, we don't need to
5353
/// // manually dereference a pointer in order to use the bus.
5454
/// bus.write(&[42]).await?;
@@ -62,22 +62,22 @@ where
6262
///
6363
/// Note that the compiler will prevent you from moving the bus reference outside of the closure
6464
/// ```compile_fail
65-
/// # use embedded_hal_async::spi::{transaction_helper, SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
65+
/// # use embedded_hal_async::spi::{transaction, SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
6666
/// #
6767
/// # pub async fn smuggle_test<SPI>(mut device: SPI) -> Result<(), SPI::Error>
6868
/// # where
6969
/// # SPI: SpiDevice,
7070
/// # SPI::Bus: SpiBus,
7171
/// # {
7272
/// let mut bus_smuggler: Option<&mut SPI::Bus> = None;
73-
/// transaction_helper!(&mut device, move |bus| async move {
73+
/// transaction!(&mut device, move |bus| async move {
7474
/// bus_smuggler = Some(bus);
7575
/// Ok(())
7676
/// })
7777
/// .await
7878
/// # }
7979
/// ```
80-
macro_rules! spi_transaction_helper {
80+
macro_rules! spi_transaction {
8181
($device:expr, move |$bus:ident| async move $closure_body:expr) => {
8282
$crate::spi::SpiDevice::transaction($device, move |$bus| {
8383
// Safety: Implementers of the `SpiDevice` trait guarantee that the pointer is
@@ -133,7 +133,7 @@ macro_rules! spi_transaction_helper {
133133
}
134134

135135
#[doc(inline)]
136-
pub use spi_transaction_helper as transaction_helper;
136+
pub use spi_transaction as transaction;
137137

138138
/// SPI device trait
139139
///
@@ -195,7 +195,7 @@ pub unsafe trait SpiDevice: ErrorType {
195195
Self::Bus: SpiBusRead<Word>,
196196
Word: Copy + 'static,
197197
{
198-
transaction_helper!(self, move |bus| async move { bus.read(buf).await })
198+
transaction!(self, move |bus| async move { bus.read(buf).await })
199199
}
200200

201201
/// Do a write within a transaction.
@@ -208,7 +208,7 @@ pub unsafe trait SpiDevice: ErrorType {
208208
Self::Bus: SpiBusWrite<Word>,
209209
Word: Copy + 'static,
210210
{
211-
transaction_helper!(self, move |bus| async move { bus.write(buf).await })
211+
transaction!(self, move |bus| async move { bus.write(buf).await })
212212
}
213213

214214
/// Do a transfer within a transaction.
@@ -225,7 +225,7 @@ pub unsafe trait SpiDevice: ErrorType {
225225
Self::Bus: SpiBus<Word>,
226226
Word: Copy + 'static,
227227
{
228-
transaction_helper!(
228+
transaction!(
229229
self,
230230
move |bus| async move { bus.transfer(read, write).await }
231231
)
@@ -244,7 +244,7 @@ pub unsafe trait SpiDevice: ErrorType {
244244
Self::Bus: SpiBus<Word>,
245245
Word: Copy + 'static,
246246
{
247-
transaction_helper!(
247+
transaction!(
248248
self,
249249
move |bus| async move { bus.transfer_in_place(buf).await }
250250
)

0 commit comments

Comments
 (0)