-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ADC support STM32L4xx and STM32G4xx series MCUs #22341
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was based just on the first commit (8435456), and not the whole branch (master...sigprof:qmk_firmware:adc-stm32l4xx)? At least the RP2040 breakage seems to be still there.
I was actually unsure about the sampling rate situation myself tbh. An idea that I had was to check if features like joystick etc are enabled, and if so to print a message in the terminal. Adding a note in the documentation once I update that is gonna be helpful too, both in the joystick section and in the ADC specs. |
Also @sigprof did you test the support for oversampling for ADCv3? I saw that you had something in a branch of yours but I didn't include it in this PR. If by your testing that's good I'll amend this PR to include that too. |
…lot/qmk_firmware into adc-add-stm32l4xx-stm32g4xx
It seems like the CI Build fails are all using RP2040 ADC. Errors arise in the |
Fix for RP2040 build errors
…com/Cipulot/qmk_firmware into adc-add-stm32l4xx-stm32g4xx" This reverts commit b11c297, reversing changes made to ed3051f.
Attempt fix for formatting CI error
Co-authored-by: Joel Challis <[email protected]>
Co-authored-by: Joel Challis <[email protected]>
Co-authored-by: Joel Challis <[email protected]>
* Update analog.c * Changes to remove errors in compile * Update analog.c Fix for RP2040 build errors * Revert "Merge branch 'adc-add-stm32l4xx-stm32g4xx' of https://github.com/Cipulot/qmk_firmware into adc-add-stm32l4xx-stm32g4xx" This reverts commit b11c297, reversing changes made to ed3051f. * Update analog.c Attempt fix for formatting CI error * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> --------- Co-authored-by: Joel Challis <[email protected]>
* Update analog.c * Changes to remove errors in compile * Update analog.c Fix for RP2040 build errors * Revert "Merge branch 'adc-add-stm32l4xx-stm32g4xx' of https://github.com/Cipulot/qmk_firmware into adc-add-stm32l4xx-stm32g4xx" This reverts commit b11c297, reversing changes made to ed3051f. * Update analog.c Attempt fix for formatting CI error * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> --------- Co-authored-by: Joel Challis <[email protected]>
* Update analog.c * Changes to remove errors in compile * Update analog.c Fix for RP2040 build errors * Revert "Merge branch 'adc-add-stm32l4xx-stm32g4xx' of https://github.com/Cipulot/qmk_firmware into adc-add-stm32l4xx-stm32g4xx" This reverts commit b11c297, reversing changes made to ed3051f. * Update analog.c Attempt fix for formatting CI error * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> --------- Co-authored-by: Joel Challis <[email protected]>
* Update analog.c * Changes to remove errors in compile * Update analog.c Fix for RP2040 build errors * Revert "Merge branch 'adc-add-stm32l4xx-stm32g4xx' of https://github.com/Cipulot/qmk_firmware into adc-add-stm32l4xx-stm32g4xx" This reverts commit b11c297, reversing changes made to ed3051f. * Update analog.c Attempt fix for formatting CI error * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> * Update platforms/chibios/drivers/analog.c Co-authored-by: Joel Challis <[email protected]> --------- Co-authored-by: Joel Challis <[email protected]>
Description
These changes are based on @sigprof branch that he mentioned in a comment under #19922.
I've included his original changes that handle the dummy conversion to avoid ADC errors and also implemented the
pinToMux()
for both L4 and G4 series.Implemented a check for the default
ADC_SAMPLING_RATE
, defaulting toADC_SMPR_SMP_2P5
since it's the fastest available as per 'hal_adc_lld.h' in ChibiOS and datasheets for the L4 and G4.I removed the debug print he included since it's not needed.
Tested with G431CBU, and confirmed working with pins of
ADC1
andADC2
. Appreciate if others will test on some of the L4 MCUs supported in QMK, since I have no access to them as of now.Change of the documentation about ADC support in the STM series will follow when this approved.
Types of Changes
Issues Fixed or Closed by This PR
Checklist