aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src
diff options
context:
space:
mode:
authoretiennecollin <[email protected]>2025-08-25 21:10:59 +0200
committerDario Nieuwenhuis <[email protected]>2025-09-05 14:43:29 +0200
commit4291a092bedb0f45d236a1847a9b85fd093d3af9 (patch)
tree750b06baa99a714039e50140e8bd73ff32448c53 /embassy-stm32/src
parenta2daa9739f375301425a4581601b65470ba5f459 (diff)
fix: moved channel configuration from new() to start()
See this PR comment explaining why configuration in `new()` is a bad idea: https://github.com/embassy-rs/embassy/pull/3923#issuecomment-2889193736
Diffstat (limited to 'embassy-stm32/src')
-rw-r--r--embassy-stm32/src/dma/gpdma/ringbuffered.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/embassy-stm32/src/dma/gpdma/ringbuffered.rs b/embassy-stm32/src/dma/gpdma/ringbuffered.rs
index 3a7ceb292..359bc83b3 100644
--- a/embassy-stm32/src/dma/gpdma/ringbuffered.rs
+++ b/embassy-stm32/src/dma/gpdma/ringbuffered.rs
@@ -79,9 +79,6 @@ impl<'a, W: Word> ReadableRingBuffer<'a, W> {
79 ]; 79 ];
80 let table = Table::new(items); 80 let table = Table::new(items);
81 81
82 // Apply the default configuration to the channel.
83 unsafe { channel.configure_linked_list(&table, options) };
84
85 Self { 82 Self {
86 channel, 83 channel,
87 ringbuf: ReadableDmaRingBuffer::new(buffer), 84 ringbuf: ReadableDmaRingBuffer::new(buffer),
@@ -92,6 +89,8 @@ impl<'a, W: Word> ReadableRingBuffer<'a, W> {
92 89
93 /// Start the ring buffer operation. 90 /// Start the ring buffer operation.
94 pub fn start(&mut self) { 91 pub fn start(&mut self) {
92 // Apply the default configuration to the channel.
93 unsafe { self.channel.configure_linked_list(&self.table, self.options) };
95 self.table.link(RunMode::Circular); 94 self.table.link(RunMode::Circular);
96 self.channel.start(); 95 self.channel.start();
97 } 96 }
@@ -231,9 +230,6 @@ impl<'a, W: Word> WritableRingBuffer<'a, W> {
231 ]; 230 ];
232 let table = Table::new(items); 231 let table = Table::new(items);
233 232
234 // Apply the default configuration to the channel.
235 unsafe { channel.configure_linked_list(&table, options) };
236
237 let this = Self { 233 let this = Self {
238 channel, 234 channel,
239 ringbuf: WritableDmaRingBuffer::new(buffer), 235 ringbuf: WritableDmaRingBuffer::new(buffer),
@@ -246,6 +242,8 @@ impl<'a, W: Word> WritableRingBuffer<'a, W> {
246 242
247 /// Start the ring buffer operation. 243 /// Start the ring buffer operation.
248 pub fn start(&mut self) { 244 pub fn start(&mut self) {
245 // Apply the default configuration to the channel.
246 unsafe { self.channel.configure_linked_list(&self.table, self.options) };
249 self.table.link(RunMode::Circular); 247 self.table.link(RunMode::Circular);
250 self.channel.start(); 248 self.channel.start();
251 } 249 }