Replies: 1 comment
-
Hmm. I think this is a good method for making changes specific to your application. But I do think we should actually build oversampling into Mbed properly at some point, as it's a cool feature that many people are likely to want to use. In the medium-long term, I have thought about adding some kind of "ADC configuration" feature to AnalogIn, which would allow configuration of oversampling/averaging as well as clock frequency, voltage reference, etc. But that would be a big effort. What we could do right now would be to add an option like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi !!!
I would like to discuss the topic of adding functionality to the Mbed os and how best to do it.
I see two ways:
1 - Change the source files of the Mbed
2 - Override files in the cmake script for a custom target.
I usually use method 2 to keep the Mbed clean. After testing the changes in the API, I would like to share the code with the community.
Below I will give an example using the oversampling module.
A lot of novel MCUs have oversampling module on the die, so we can use this feature. in case the device has no oversampling module we can use software realization.
My proposal:
(I use STM32l4 series mcu for example)
Changes in targets/TARGET_STM/analogin_api.c
in targets/TARGET_STM/TARGET_STM32L4/analogin_device.c
we can redefine these files in custom target cmake, like this:
So now we can use it in our code. let's config mbed_app.json5
Beta Was this translation helpful? Give feedback.
All reactions