diff options
| author | Henrik Alsér <[email protected]> | 2022-11-22 00:55:05 +0100 |
|---|---|---|
| committer | Henrik Alsér <[email protected]> | 2022-11-22 00:55:05 +0100 |
| commit | a6d941fac3d08512f7ef90131d7189ae3aa83bf0 (patch) | |
| tree | cee7446042c62cf62cf241f50b158451580c6604 /embassy-nrf/src/spis.rs | |
| parent | af34fc4ccc110bf37165f2b9655585ba3a33889a (diff) | |
Fix txonly/rxonly data pin dir, _from_ram and doc
Diffstat (limited to 'embassy-nrf/src/spis.rs')
| -rw-r--r-- | embassy-nrf/src/spis.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/embassy-nrf/src/spis.rs b/embassy-nrf/src/spis.rs index 3f77c61d1..e005f7b92 100644 --- a/embassy-nrf/src/spis.rs +++ b/embassy-nrf/src/spis.rs | |||
| @@ -78,7 +78,7 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 78 | irq: impl Peripheral<P = T::Interrupt> + 'd, | 78 | irq: impl Peripheral<P = T::Interrupt> + 'd, |
| 79 | cs: impl Peripheral<P = impl GpioPin> + 'd, | 79 | cs: impl Peripheral<P = impl GpioPin> + 'd, |
| 80 | sck: impl Peripheral<P = impl GpioPin> + 'd, | 80 | sck: impl Peripheral<P = impl GpioPin> + 'd, |
| 81 | mosi: impl Peripheral<P = impl GpioPin> + 'd, | 81 | miso: impl Peripheral<P = impl GpioPin> + 'd, |
| 82 | config: Config, | 82 | config: Config, |
| 83 | ) -> Self { | 83 | ) -> Self { |
| 84 | into_ref!(cs, sck, mosi); | 84 | into_ref!(cs, sck, mosi); |
| @@ -87,8 +87,8 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 87 | irq, | 87 | irq, |
| 88 | cs.map_into(), | 88 | cs.map_into(), |
| 89 | sck.map_into(), | 89 | sck.map_into(), |
| 90 | Some(miso.map_into()), | ||
| 90 | None, | 91 | None, |
| 91 | Some(mosi.map_into()), | ||
| 92 | config, | 92 | config, |
| 93 | ) | 93 | ) |
| 94 | } | 94 | } |
| @@ -98,7 +98,7 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 98 | irq: impl Peripheral<P = T::Interrupt> + 'd, | 98 | irq: impl Peripheral<P = T::Interrupt> + 'd, |
| 99 | cs: impl Peripheral<P = impl GpioPin> + 'd, | 99 | cs: impl Peripheral<P = impl GpioPin> + 'd, |
| 100 | sck: impl Peripheral<P = impl GpioPin> + 'd, | 100 | sck: impl Peripheral<P = impl GpioPin> + 'd, |
| 101 | miso: impl Peripheral<P = impl GpioPin> + 'd, | 101 | mosi: impl Peripheral<P = impl GpioPin> + 'd, |
| 102 | config: Config, | 102 | config: Config, |
| 103 | ) -> Self { | 103 | ) -> Self { |
| 104 | into_ref!(cs, sck, miso); | 104 | into_ref!(cs, sck, miso); |
| @@ -107,8 +107,8 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 107 | irq, | 107 | irq, |
| 108 | cs.map_into(), | 108 | cs.map_into(), |
| 109 | sck.map_into(), | 109 | sck.map_into(), |
| 110 | Some(miso.map_into()), | ||
| 111 | None, | 110 | None, |
| 111 | Some(mosi.map_into()), | ||
| 112 | config, | 112 | config, |
| 113 | ) | 113 | ) |
| 114 | } | 114 | } |
| @@ -355,7 +355,7 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 355 | } | 355 | } |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | /// Reads data from the SPI bus without sending anything. Blocks until the buffer has been filled. | 358 | /// Reads data from the SPI bus without sending anything. Blocks until `cs` is deasserted. |
| 359 | /// Returns number of bytes read. | 359 | /// Returns number of bytes read. |
| 360 | pub fn blocking_read(&mut self, data: &mut [u8]) -> Result<usize, Error> { | 360 | pub fn blocking_read(&mut self, data: &mut [u8]) -> Result<usize, Error> { |
| 361 | self.blocking_inner(data, &[]).map(|n| n.0) | 361 | self.blocking_inner(data, &[]).map(|n| n.0) |
| @@ -371,7 +371,7 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 371 | /// Same as [`blocking_transfer`](Spis::blocking_transfer) but will fail instead of copying data into RAM. Consult the module level documentation to learn more. | 371 | /// Same as [`blocking_transfer`](Spis::blocking_transfer) but will fail instead of copying data into RAM. Consult the module level documentation to learn more. |
| 372 | /// Returns number of bytes transferred `(n_rx, n_tx)`. | 372 | /// Returns number of bytes transferred `(n_rx, n_tx)`. |
| 373 | pub fn blocking_transfer_from_ram(&mut self, read: &mut [u8], write: &[u8]) -> Result<(usize, usize), Error> { | 373 | pub fn blocking_transfer_from_ram(&mut self, read: &mut [u8], write: &[u8]) -> Result<(usize, usize), Error> { |
| 374 | self.blocking_inner(read, write) | 374 | self.blocking_inner_from_ram(read, write) |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | /// Simultaneously sends and receives data. | 377 | /// Simultaneously sends and receives data. |
| @@ -391,7 +391,7 @@ impl<'d, T: Instance> Spis<'d, T> { | |||
| 391 | /// Same as [`blocking_write`](Spis::blocking_write) but will fail instead of copying data into RAM. Consult the module level documentation to learn more. | 391 | /// Same as [`blocking_write`](Spis::blocking_write) but will fail instead of copying data into RAM. Consult the module level documentation to learn more. |
| 392 | /// Returns number of bytes written. | 392 | /// Returns number of bytes written. |
| 393 | pub fn blocking_write_from_ram(&mut self, data: &[u8]) -> Result<usize, Error> { | 393 | pub fn blocking_write_from_ram(&mut self, data: &[u8]) -> Result<usize, Error> { |
| 394 | self.blocking_inner(&mut [], data).map(|n| n.1) | 394 | self.blocking_inner_from_ram(&mut [], data).map(|n| n.1) |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | /// Reads data from the SPI bus without sending anything. | 397 | /// Reads data from the SPI bus without sending anything. |
