diff options
| author | JuliDi <[email protected]> | 2023-06-19 13:50:17 +0200 |
|---|---|---|
| committer | JuliDi <[email protected]> | 2023-06-19 13:50:17 +0200 |
| commit | 88052480b14b8dd38e7c4ba179b7035390f59618 (patch) | |
| tree | 2c04af25808df289757203cb2dfe331136b19512 | |
| parent | 218b102b2840c9786944aa6f613450c876b6110b (diff) | |
fix typo, minor cleanup
| -rw-r--r-- | embassy-stm32/src/dac/mod.rs | 13 | ||||
| -rw-r--r-- | embassy-stm32/src/dma/bdma.rs | 7 |
2 files changed, 10 insertions, 10 deletions
diff --git a/embassy-stm32/src/dac/mod.rs b/embassy-stm32/src/dac/mod.rs index 0fbf67673..704b77b37 100644 --- a/embassy-stm32/src/dac/mod.rs +++ b/embassy-stm32/src/dac/mod.rs | |||
| @@ -275,42 +275,43 @@ impl<'d, T: Instance, Tx> Dac<'d, T, Tx> { | |||
| 275 | }); | 275 | }); |
| 276 | 276 | ||
| 277 | let tx_request = self.txdma.request(); | 277 | let tx_request = self.txdma.request(); |
| 278 | let channel = &mut self.txdma; | ||
| 278 | 279 | ||
| 279 | // Initiate the correct type of DMA transfer depending on what data is passed | 280 | // Initiate the correct type of DMA transfer depending on what data is passed |
| 280 | let tx_f = match data_ch1 { | 281 | let tx_f = match data_ch1 { |
| 281 | ValueArray::Bit8(buf) => unsafe { | 282 | ValueArray::Bit8(buf) => unsafe { |
| 282 | Transfer::new_write( | 283 | Transfer::new_write( |
| 283 | &mut self.txdma, | 284 | channel, |
| 284 | tx_request, | 285 | tx_request, |
| 285 | buf, | 286 | buf, |
| 286 | T::regs().dhr8r(CHANNEL).as_ptr() as *mut u8, | 287 | T::regs().dhr8r(CHANNEL).as_ptr() as *mut u8, |
| 287 | TransferOptions { | 288 | TransferOptions { |
| 288 | circular, | 289 | circular, |
| 289 | halt_transfer_ir: false, | 290 | half_transfer_ir: false, |
| 290 | }, | 291 | }, |
| 291 | ) | 292 | ) |
| 292 | }, | 293 | }, |
| 293 | ValueArray::Bit12Left(buf) => unsafe { | 294 | ValueArray::Bit12Left(buf) => unsafe { |
| 294 | Transfer::new_write( | 295 | Transfer::new_write( |
| 295 | &mut self.txdma, | 296 | channel, |
| 296 | tx_request, | 297 | tx_request, |
| 297 | buf, | 298 | buf, |
| 298 | T::regs().dhr12l(CHANNEL).as_ptr() as *mut u16, | 299 | T::regs().dhr12l(CHANNEL).as_ptr() as *mut u16, |
| 299 | TransferOptions { | 300 | TransferOptions { |
| 300 | circular, | 301 | circular, |
| 301 | halt_transfer_ir: false, | 302 | half_transfer_ir: false, |
| 302 | }, | 303 | }, |
| 303 | ) | 304 | ) |
| 304 | }, | 305 | }, |
| 305 | ValueArray::Bit12Right(buf) => unsafe { | 306 | ValueArray::Bit12Right(buf) => unsafe { |
| 306 | Transfer::new_write( | 307 | Transfer::new_write( |
| 307 | &mut self.txdma, | 308 | channel, |
| 308 | tx_request, | 309 | tx_request, |
| 309 | buf, | 310 | buf, |
| 310 | T::regs().dhr12r(CHANNEL).as_ptr() as *mut u16, | 311 | T::regs().dhr12r(CHANNEL).as_ptr() as *mut u16, |
| 311 | TransferOptions { | 312 | TransferOptions { |
| 312 | circular, | 313 | circular, |
| 313 | halt_transfer_ir: false, | 314 | half_transfer_ir: false, |
| 314 | }, | 315 | }, |
| 315 | ) | 316 | ) |
| 316 | }, | 317 | }, |
diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index 3d315e20b..0ad20579a 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | #![macro_use] | 1 | #![macro_use] |
| 2 | 2 | ||
| 3 | use core::future::Future; | 3 | use core::future::Future; |
| 4 | use core::option; | ||
| 5 | use core::pin::Pin; | 4 | use core::pin::Pin; |
| 6 | use core::sync::atomic::{fence, Ordering}; | 5 | use core::sync::atomic::{fence, Ordering}; |
| 7 | use core::task::{Context, Poll, Waker}; | 6 | use core::task::{Context, Poll, Waker}; |
| @@ -24,14 +23,14 @@ use crate::pac::bdma::{regs, vals}; | |||
| 24 | #[non_exhaustive] | 23 | #[non_exhaustive] |
| 25 | pub struct TransferOptions { | 24 | pub struct TransferOptions { |
| 26 | pub circular: bool, | 25 | pub circular: bool, |
| 27 | pub halt_transfer_ir: bool, | 26 | pub half_transfer_ir: bool, |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | impl Default for TransferOptions { | 29 | impl Default for TransferOptions { |
| 31 | fn default() -> Self { | 30 | fn default() -> Self { |
| 32 | Self { | 31 | Self { |
| 33 | circular: false, | 32 | circular: false, |
| 34 | halt_transfer_ir: false, | 33 | half_transfer_ir: false, |
| 35 | } | 34 | } |
| 36 | } | 35 | } |
| 37 | } | 36 | } |
| @@ -291,7 +290,7 @@ impl<'a, C: Channel> Transfer<'a, C> { | |||
| 291 | w.set_dir(dir.into()); | 290 | w.set_dir(dir.into()); |
| 292 | w.set_teie(true); | 291 | w.set_teie(true); |
| 293 | w.set_tcie(true); | 292 | w.set_tcie(true); |
| 294 | w.set_htie(options.halt_transfer_ir); | 293 | w.set_htie(options.half_transfer_ir); |
| 295 | if options.circular { | 294 | if options.circular { |
| 296 | w.set_circ(vals::Circ::ENABLED); | 295 | w.set_circ(vals::Circ::ENABLED); |
| 297 | debug!("Setting circular mode"); | 296 | debug!("Setting circular mode"); |
