aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreZio Pan <[email protected]>2024-02-28 18:08:41 +0800
committereZio Pan <[email protected]>2024-02-29 00:11:40 +0800
commit47c579eba2a7b4372a891bcd747f2bb0c56ce8a4 (patch)
treecd0baafd0bc85a0b4ef8a8c7cef695943472cdea
parent5ced938184e141471e921d235975e95725d6be53 (diff)
update metapac
-rw-r--r--embassy-stm32/Cargo.toml4
-rw-r--r--embassy-stm32/src/can/fd/peripheral.rs4
-rw-r--r--embassy-stm32/src/opamp.rs2
-rw-r--r--embassy-stm32/src/timer/mod.rs12
-rw-r--r--examples/stm32h7/src/bin/low_level_timer_api.rs4
5 files changed, 15 insertions, 11 deletions
diff --git a/embassy-stm32/Cargo.toml b/embassy-stm32/Cargo.toml
index 81b8e2f94..08ccd35ae 100644
--- a/embassy-stm32/Cargo.toml
+++ b/embassy-stm32/Cargo.toml
@@ -70,7 +70,7 @@ rand_core = "0.6.3"
70sdio-host = "0.5.0" 70sdio-host = "0.5.0"
71critical-section = "1.1" 71critical-section = "1.1"
72#stm32-metapac = { version = "15" } 72#stm32-metapac = { version = "15" }
73stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-7c8b53413499acc3273b706318777a60f932d77a" } 73stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4a0bcec33362449fb733c066936d25cbabab396a" }
74vcell = "0.1.3" 74vcell = "0.1.3"
75bxcan = "0.7.0" 75bxcan = "0.7.0"
76nb = "1.0.0" 76nb = "1.0.0"
@@ -94,7 +94,7 @@ critical-section = { version = "1.1", features = ["std"] }
94proc-macro2 = "1.0.36" 94proc-macro2 = "1.0.36"
95quote = "1.0.15" 95quote = "1.0.15"
96#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]} 96#stm32-metapac = { version = "15", default-features = false, features = ["metadata"]}
97stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-7c8b53413499acc3273b706318777a60f932d77a", default-features = false, features = ["metadata"]} 97stm32-metapac = { git = "https://github.com/embassy-rs/stm32-data-generated", tag = "stm32-data-4a0bcec33362449fb733c066936d25cbabab396a", default-features = false, features = ["metadata"]}
98 98
99 99
100[features] 100[features]
diff --git a/embassy-stm32/src/can/fd/peripheral.rs b/embassy-stm32/src/can/fd/peripheral.rs
index c5606b883..9b8802ff9 100644
--- a/embassy-stm32/src/can/fd/peripheral.rs
+++ b/embassy-stm32/src/can/fd/peripheral.rs
@@ -303,7 +303,9 @@ impl Registers {
303 // Framework specific settings are set here 303 // Framework specific settings are set here
304 304
305 // set TxBuffer to Queue Mode 305 // set TxBuffer to Queue Mode
306 self.regs.txbc().write(|w| w.set_tfqm(true)); 306 self.regs
307 .txbc()
308 .write(|w| w.set_tfqm(crate::pac::can::vals::Tfqm::QUEUE));
307 309
308 // set standard filters list size to 28 310 // set standard filters list size to 28
309 // set extended filters list size to 8 311 // set extended filters list size to 8
diff --git a/embassy-stm32/src/opamp.rs b/embassy-stm32/src/opamp.rs
index ae8b3cacc..cf531e266 100644
--- a/embassy-stm32/src/opamp.rs
+++ b/embassy-stm32/src/opamp.rs
@@ -90,6 +90,7 @@ impl<'d, T: Instance> OpAmp<'d, T> {
90 in_pin.set_as_analog(); 90 in_pin.set_as_analog();
91 out_pin.set_as_analog(); 91 out_pin.set_as_analog();
92 92
93 // PGA_GAIN value may have different meaning in different MCU serials, use with caution.
93 let (vm_sel, pga_gain) = match gain { 94 let (vm_sel, pga_gain) = match gain {
94 OpAmpGain::Mul1 => (0b11, 0b00), 95 OpAmpGain::Mul1 => (0b11, 0b00),
95 OpAmpGain::Mul2 => (0b10, 0b00), 96 OpAmpGain::Mul2 => (0b10, 0b00),
@@ -127,6 +128,7 @@ impl<'d, T: Instance> OpAmp<'d, T> {
127 into_ref!(pin); 128 into_ref!(pin);
128 pin.set_as_analog(); 129 pin.set_as_analog();
129 130
131 // PGA_GAIN value may have different meaning in different MCU serials, use with caution.
130 let (vm_sel, pga_gain) = match gain { 132 let (vm_sel, pga_gain) = match gain {
131 OpAmpGain::Mul1 => (0b11, 0b00), 133 OpAmpGain::Mul1 => (0b11, 0b00),
132 OpAmpGain::Mul2 => (0b10, 0b00), 134 OpAmpGain::Mul2 => (0b10, 0b00),
diff --git a/embassy-stm32/src/timer/mod.rs b/embassy-stm32/src/timer/mod.rs
index c8f580101..8530c5229 100644
--- a/embassy-stm32/src/timer/mod.rs
+++ b/embassy-stm32/src/timer/mod.rs
@@ -379,7 +379,7 @@ pub(crate) mod sealed {
379 379
380 let regs = Self::regs_gp32(); 380 let regs = Self::regs_gp32();
381 regs.psc().write(|r| r.set_psc(psc)); 381 regs.psc().write(|r| r.set_psc(psc));
382 regs.arr().write(|r| r.set_arr(arr)); 382 regs.arr().write_value(arr);
383 383
384 regs.cr1().modify(|r| r.set_urs(vals::Urs::COUNTERONLY)); 384 regs.cr1().modify(|r| r.set_urs(vals::Urs::COUNTERONLY));
385 regs.egr().write(|r| r.set_ug(true)); 385 regs.egr().write(|r| r.set_ug(true));
@@ -391,7 +391,7 @@ pub(crate) mod sealed {
391 let timer_f = Self::frequency(); 391 let timer_f = Self::frequency();
392 392
393 let regs = Self::regs_gp32(); 393 let regs = Self::regs_gp32();
394 let arr = regs.arr().read().arr(); 394 let arr = regs.arr().read();
395 let psc = regs.psc().read().psc(); 395 let psc = regs.psc().read().psc();
396 396
397 timer_f / arr / (psc + 1) 397 timer_f / arr / (psc + 1)
@@ -399,22 +399,22 @@ pub(crate) mod sealed {
399 399
400 /// Set comapre value for a channel. 400 /// Set comapre value for a channel.
401 fn set_compare_value(&self, channel: Channel, value: u32) { 401 fn set_compare_value(&self, channel: Channel, value: u32) {
402 Self::regs_gp32().ccr(channel.index()).modify(|w| w.set_ccr(value)); 402 Self::regs_gp32().ccr(channel.index()).write_value(value);
403 } 403 }
404 404
405 /// Get capture value for a channel. 405 /// Get capture value for a channel.
406 fn get_capture_value(&self, channel: Channel) -> u32 { 406 fn get_capture_value(&self, channel: Channel) -> u32 {
407 Self::regs_gp32().ccr(channel.index()).read().ccr() 407 Self::regs_gp32().ccr(channel.index()).read()
408 } 408 }
409 409
410 /// Get max compare value. This depends on the timer frequency and the clock frequency from RCC. 410 /// Get max compare value. This depends on the timer frequency and the clock frequency from RCC.
411 fn get_max_compare_value(&self) -> u32 { 411 fn get_max_compare_value(&self) -> u32 {
412 Self::regs_gp32().arr().read().arr() 412 Self::regs_gp32().arr().read()
413 } 413 }
414 414
415 /// Get compare value for a channel. 415 /// Get compare value for a channel.
416 fn get_compare_value(&self, channel: Channel) -> u32 { 416 fn get_compare_value(&self, channel: Channel) -> u32 {
417 Self::regs_gp32().ccr(channel.index()).read().ccr() 417 Self::regs_gp32().ccr(channel.index()).read()
418 } 418 }
419 } 419 }
420 420
diff --git a/examples/stm32h7/src/bin/low_level_timer_api.rs b/examples/stm32h7/src/bin/low_level_timer_api.rs
index cc508c3cf..049d9967d 100644
--- a/examples/stm32h7/src/bin/low_level_timer_api.rs
+++ b/examples/stm32h7/src/bin/low_level_timer_api.rs
@@ -113,11 +113,11 @@ impl<'d, T: CaptureCompare32bitInstance> SimplePwm32<'d, T> {
113 } 113 }
114 114
115 pub fn get_max_duty(&self) -> u32 { 115 pub fn get_max_duty(&self) -> u32 {
116 T::regs_gp32().arr().read().arr() 116 T::regs_gp32().arr().read()
117 } 117 }
118 118
119 pub fn set_duty(&mut self, channel: Channel, duty: u32) { 119 pub fn set_duty(&mut self, channel: Channel, duty: u32) {
120 defmt::assert!(duty < self.get_max_duty()); 120 defmt::assert!(duty < self.get_max_duty());
121 T::regs_gp32().ccr(channel.index()).modify(|w| w.set_ccr(duty)) 121 T::regs_gp32().ccr(channel.index()).write_value(duty)
122 } 122 }
123} 123}