Infineon / XMC-for-Arduino

Integration of Infineon's XMC microcontrollers into the Arduino IDE.
Other
103 stars 64 forks source link

Variable gain ADC feature #240

Closed boramonideep closed 1 year ago

boramonideep commented 1 year ago

By creating this pull request you agree to the terms in CONTRIBUTING.md. https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md --- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description Add variable gain feature of XMC VADC to Arduino API

Context XMC VADC for XMC1000 series provide a gain stage at the ADC inputs with variable gain factors. This is particularly useful for sampling weak voltage values. This has been enabled with an additional function in the Arduino API.

boramonideep commented 1 year ago

Investigating the CI/CD failures

techpaul commented 1 year ago

Two things missing

  1. defines LIKE ADC_VAR_GAIN_1 to ADC_VAR_GAIN_12 in analog.h to simplify the setting of gains.

  2. Documentation at least in Wiki to describe limits especially on channels, which are different on different boards.

Personally in a lot of my front ends this low level of gain would not help, but then again for gains of 100+ I would not do it inside the micro for noise reasons.

boramonideep commented 1 year ago

Added wiki note here: https://github.com/Infineon/XMC-for-Arduino/wiki/Analog-Functions-and-Additions Added macros as suggested Thanks @techpaul

techpaul commented 1 year ago

One advantage of the Macros reduces chance of someone trying a gain factor of 50 and wondering why it is not working.