From dd0fc9d48c6996d46641241fc639983e48674903 Mon Sep 17 00:00:00 2001 From: Tnze Date: Tue, 21 Jan 2025 22:20:21 +0800 Subject: [PATCH 1/3] Add enable/disable EOC interrupt functions for ADC --- src/adc.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/adc.rs b/src/adc.rs index e282b8cb..26bd1b20 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -418,6 +418,26 @@ macro_rules! adc_hal { self.disable_clock(); self.rb } + + /// Enable interrupt for EOC (end of convert) + pub fn enable_eoc_interrupt() { + self.rb.cr1()..write(|w| w.eocie().set_bit()); + } + + /// Disable interrupt for EOC (end of convert) + pub fn disable_eoc_interrupt() { + self.rb.cr1()..write(|w| w.eocie().clear_bit()); + } + + /// Enable interrupt for JEOC (EOC for injected channels) + pub fn enable_jeoc_interrupt() { + self.rb.cr1()..write(|w| w.jeocie().set_bit()); + } + + /// Disable interrupt for JEOC (EOC for injected channels) + pub fn disable_jeoc_interrupt() { + self.rb.cr1()..write(|w| w.jeocie().clear_bit()); + } } impl ChannelTimeSequence for Adc<$ADC> { From 37ee3685dd3cc19e552d719146fff94e85b3e2ab Mon Sep 17 00:00:00 2001 From: Tnze Date: Tue, 21 Jan 2025 22:28:03 +0800 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d16faa..82c0caee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Add an option to allow overclocking [#494] - `new` on gpio mode [#506] - Add `Serial` `rx`/`tx` constructors [#509] +- Add enable/disable EOC interrupt functions for ADCs [#526] [#416]: https://github.com/stm32-rs/stm32f1xx-hal/pull/416 [#453]: https://github.com/stm32-rs/stm32f1xx-hal/pull/453 @@ -69,6 +70,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [#514]: https://github.com/stm32-rs/stm32f1xx-hal/pull/514 [#516]: https://github.com/stm32-rs/stm32f1xx-hal/pull/516 [#520]: https://github.com/stm32-rs/stm32f1xx-hal/pull/520 +[#526]: https://github.com/stm32-rs/stm32f1xx-hal/pull/526 ## [v0.10.0] - 2022-12-12 From 72a5e956ee5c92670696a6bda478a856b1dd82b3 Mon Sep 17 00:00:00 2001 From: Tnze Date: Tue, 21 Jan 2025 22:33:29 +0800 Subject: [PATCH 3/3] amend! Add enable/disable EOC interrupt functions for ADC Add enable/disable EOC interrupt functions for ADC --- src/adc.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/adc.rs b/src/adc.rs index 26bd1b20..72498d9f 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -420,23 +420,23 @@ macro_rules! adc_hal { } /// Enable interrupt for EOC (end of convert) - pub fn enable_eoc_interrupt() { - self.rb.cr1()..write(|w| w.eocie().set_bit()); + pub fn enable_eoc_interrupt(&mut self) { + self.rb.cr1().write(|w| w.eocie().set_bit()); } /// Disable interrupt for EOC (end of convert) - pub fn disable_eoc_interrupt() { - self.rb.cr1()..write(|w| w.eocie().clear_bit()); + pub fn disable_eoc_interrupt(&mut self) { + self.rb.cr1().write(|w| w.eocie().clear_bit()); } /// Enable interrupt for JEOC (EOC for injected channels) - pub fn enable_jeoc_interrupt() { - self.rb.cr1()..write(|w| w.jeocie().set_bit()); + pub fn enable_jeoc_interrupt(&mut self) { + self.rb.cr1().write(|w| w.jeocie().set_bit()); } /// Disable interrupt for JEOC (EOC for injected channels) - pub fn disable_jeoc_interrupt() { - self.rb.cr1()..write(|w| w.jeocie().clear_bit()); + pub fn disable_jeoc_interrupt(&mut self) { + self.rb.cr1().write(|w| w.jeocie().clear_bit()); } }