aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/dac/mod.rs
diff options
context:
space:
mode:
authorJuliDi <[email protected]>2023-06-18 18:51:36 +0200
committerJuliDi <[email protected]>2023-06-18 18:51:36 +0200
commitf8ee33abb9943d6fe57c126eeecb36db9935c4ba (patch)
tree8764043bc2cd73527a0a013eac0e889010f564ab /embassy-stm32/src/dac/mod.rs
parent78a2ca8a0e5af3fe2c76a6cd025b74ea4322f6cf (diff)
add half transfer interrupt and circular dma
Diffstat (limited to 'embassy-stm32/src/dac/mod.rs')
-rw-r--r--embassy-stm32/src/dac/mod.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/embassy-stm32/src/dac/mod.rs b/embassy-stm32/src/dac/mod.rs
index 7b81ec1f2..525d45d72 100644
--- a/embassy-stm32/src/dac/mod.rs
+++ b/embassy-stm32/src/dac/mod.rs
@@ -2,7 +2,7 @@
2 2
3use embassy_hal_common::{into_ref, PeripheralRef}; 3use embassy_hal_common::{into_ref, PeripheralRef};
4 4
5use crate::dma::Transfer; 5use crate::dma::{Transfer, TransferOptions};
6use crate::pac::dac; 6use crate::pac::dac;
7use crate::rcc::RccPeripheral; 7use crate::rcc::RccPeripheral;
8use crate::{peripherals, Peripheral}; 8use crate::{peripherals, Peripheral};
@@ -237,7 +237,7 @@ impl<'d, T: Instance, Tx> Dac<'d, T, Tx> {
237 } 237 }
238 238
239 /// TODO: Allow an array of Value instead of only u16, right-aligned 239 /// TODO: Allow an array of Value instead of only u16, right-aligned
240 pub async fn write(&mut self, data: &[u16]) -> Result<(), Error> 240 pub async fn write(&mut self, data: &[u16], circular: bool) -> Result<(), Error>
241 where 241 where
242 Tx: Dma<T>, 242 Tx: Dma<T>,
243 { 243 {
@@ -257,7 +257,18 @@ impl<'d, T: Instance, Tx> Dac<'d, T, Tx> {
257 // Use the 12 bit right-aligned register for now. TODO: distinguish values 257 // Use the 12 bit right-aligned register for now. TODO: distinguish values
258 let tx_dst = T::regs().dhr12r(CHANNEL).ptr() as *mut u16; 258 let tx_dst = T::regs().dhr12r(CHANNEL).ptr() as *mut u16;
259 259
260 let tx_f = unsafe { Transfer::new_write(&mut self.txdma, tx_request, data, tx_dst, Default::default()) }; 260 let tx_f = unsafe {
261 Transfer::new_write(
262 &mut self.txdma,
263 tx_request,
264 data,
265 tx_dst,
266 TransferOptions {
267 circular,
268 halt_transfer_ir: false,
269 },
270 )
271 };
261 272
262 //debug!("Awaiting tx_f"); 273 //debug!("Awaiting tx_f");
263 274