Skip to content

Commit 5842633

Browse files
committed
Add a note about the macro in the transaction method docs
1 parent 6c9f380 commit 5842633

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

embedded-hal-async/src/spi.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ pub unsafe trait SpiDevice: ErrorType {
160160

161161
/// Perform a transaction against the device.
162162
///
163+
/// **NOTE:**
164+
/// It is not recommended to use this method directly, because it requires `unsafe` code to dereference the raw pointer.
165+
/// Instead, the [`transaction!`] macro should be used, which handles this safely inside the macro.
166+
///
163167
/// - Locks the bus
164168
/// - Asserts the CS (Chip Select) pin.
165169
/// - Calls `f` with an exclusive reference to the bus, which can then be used to do transfers against the device.

0 commit comments

Comments
 (0)