aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f411_adc/README.md
diff options
context:
space:
mode:
authorMilton Eduardo Sosa <31409391+snorkman88@users.noreply.github.com>2024-06-26 19:35:43 +0200
committerGitHub <noreply@github.com>2024-06-26 17:35:43 +0000
commit35891f4559cb2ec90128530ebd0ea74a65421b7a (patch)
treec47e6c8fb159c5c03c0d292f61393a1a54a76fc0 /examples/stm32f411_adc/README.md
parent861a63dbe31f8c1062bbc9a7eca012370ac26d76 (diff)
Add ADC example for STM32F411 (#952)
* Add ADC example for STM32F411 * Update dependencies * Update RTIC version * example: f411-adc: prefer text over picture * example: f411-adc: nit: typo --------- Co-authored-by: Milton Eduardo Sosa <milton@Miltons-MacBook-Pro.local> Co-authored-by: Henrik Tjäder <henrik@tjaders.com>
Diffstat (limited to 'examples/stm32f411_adc/README.md')
-rw-r--r--examples/stm32f411_adc/README.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/examples/stm32f411_adc/README.md b/examples/stm32f411_adc/README.md
new file mode 100644
index 0000000..972772d
--- /dev/null
+++ b/examples/stm32f411_adc/README.md
@@ -0,0 +1,36 @@
+# STM32F411CEU6 ADC example
+Working example to work with the internal ADC of the STM32F411CEU6 present on a Blackpill board.
+
+The `#init` task configures the ADC module for single-shot conversion and `PA1` as analog pin.
+
+Afterwards, the analog pin stored in a Potentiometer struct is set as a **local** resource to the hardware task associated to `EXTI0`.
+
+The `Adc<ADC1>` instance on the other hand, is set as a **shared** resource. The reason behind this approach is to allow other tasks make use of the only ADC module present on this microcontroller.
+
+
+
+## How-to
+
+### Build
+Run `cargo build --release` to compile the code. If you run it for the first time, it will take some time to download and compile dependencies.
+
+### Run
+Install `probe-rs` and configure it using the [debugging extension for VScode](https://probe.rs/docs/tools/debugger/).
+The output should look like this:
+
+```
+INFO Current delay value 1900
+INFO Current ADC value 665
+
+INFO Current delay value 1800
+INFO Current ADC value 1138
+
+INFO Current delay value 1700
+INFO Current ADC value 1136
+
+INFO Current delay value 1600
+INFO Current ADC value 811
+
+INFO Current delay value 1500
+INFO Current ADC value 1752
+```