@@ -41,14 +41,14 @@ where
41
41
/// # Examples
42
42
///
43
43
/// ```
44
- /// use embedded_hal_async::spi::{transaction_helper , SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
44
+ /// use embedded_hal_async::spi::{transaction , SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
45
45
///
46
46
/// pub async fn transaction_example<SPI>(mut device: SPI) -> Result<u32, SPI::Error>
47
47
/// where
48
48
/// SPI: SpiDevice,
49
49
/// SPI::Bus: SpiBus,
50
50
/// {
51
- /// transaction_helper !(&mut device, move |bus| async move {
51
+ /// transaction !(&mut device, move |bus| async move {
52
52
/// // Unlike `SpiDevice::transaction`, we don't need to
53
53
/// // manually dereference a pointer in order to use the bus.
54
54
/// bus.write(&[42]).await?;
@@ -62,22 +62,22 @@ where
62
62
///
63
63
/// Note that the compiler will prevent you from moving the bus reference outside of the closure
64
64
/// ```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};
66
66
/// #
67
67
/// # pub async fn smuggle_test<SPI>(mut device: SPI) -> Result<(), SPI::Error>
68
68
/// # where
69
69
/// # SPI: SpiDevice,
70
70
/// # SPI::Bus: SpiBus,
71
71
/// # {
72
72
/// 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 {
74
74
/// bus_smuggler = Some(bus);
75
75
/// Ok(())
76
76
/// })
77
77
/// .await
78
78
/// # }
79
79
/// ```
80
- macro_rules! spi_transaction_helper {
80
+ macro_rules! spi_transaction {
81
81
( $device: expr, move |$bus: ident| async move $closure_body: expr) => {
82
82
$crate:: spi:: SpiDevice :: transaction( $device, move |$bus| {
83
83
// Safety: Implementers of the `SpiDevice` trait guarantee that the pointer is
@@ -133,7 +133,7 @@ macro_rules! spi_transaction_helper {
133
133
}
134
134
135
135
#[ doc( inline) ]
136
- pub use spi_transaction_helper as transaction_helper ;
136
+ pub use spi_transaction as transaction ;
137
137
138
138
/// SPI device trait
139
139
///
@@ -195,7 +195,7 @@ pub unsafe trait SpiDevice: ErrorType {
195
195
Self :: Bus : SpiBusRead < Word > ,
196
196
Word : Copy + ' static ,
197
197
{
198
- transaction_helper ! ( self , move |bus| async move { bus. read( buf) . await } )
198
+ transaction ! ( self , move |bus| async move { bus. read( buf) . await } )
199
199
}
200
200
201
201
/// Do a write within a transaction.
@@ -208,7 +208,7 @@ pub unsafe trait SpiDevice: ErrorType {
208
208
Self :: Bus : SpiBusWrite < Word > ,
209
209
Word : Copy + ' static ,
210
210
{
211
- transaction_helper ! ( self , move |bus| async move { bus. write( buf) . await } )
211
+ transaction ! ( self , move |bus| async move { bus. write( buf) . await } )
212
212
}
213
213
214
214
/// Do a transfer within a transaction.
@@ -225,7 +225,7 @@ pub unsafe trait SpiDevice: ErrorType {
225
225
Self :: Bus : SpiBus < Word > ,
226
226
Word : Copy + ' static ,
227
227
{
228
- transaction_helper ! (
228
+ transaction ! (
229
229
self ,
230
230
move |bus| async move { bus. transfer( read, write) . await }
231
231
)
@@ -244,7 +244,7 @@ pub unsafe trait SpiDevice: ErrorType {
244
244
Self :: Bus : SpiBus < Word > ,
245
245
Word : Copy + ' static ,
246
246
{
247
- transaction_helper ! (
247
+ transaction ! (
248
248
self ,
249
249
move |bus| async move { bus. transfer_in_place( buf) . await }
250
250
)
0 commit comments