1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/drivers
Sergey Vlasov 65c9752762
Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403)
* Fix default ADC_RESOLUTION for ADCv3 (and ADCv4)

Recent ChibiOS update removed ADC_CFGR1_RES_10BIT from the ADCv3 headers
(that macro should not have been there, because ADCv3 has CFGR instead of
CFGR1).  Fix the default value for ADC_RESOLUTION to use ADC_CFGR_RES_10BITS
if it is defined (that name is used for ADCv3 and ADCv4).

* Update ADC docs to match the actually used resolution

ADC driver for ChibiOS actually uses the 10-bit resolution by default
(probably to match AVR); fix the documentation accordingly.  Also add
both ADC_CFGR_RES_10BITS and ADC_CFGR1_RES_10BIT constants (these names
differ according to the ADC implementation in the particular MCU).

* Fix pinToMux() for B12 and B13 on STM32F3xx

Testing on STM32F303CCT6 revealed that the ADC mux values for B12 and
B13 pins were wrong.

* Add support for all possible analog pins on STM32F1xx

Added ADC mux values for pins A0...A7, B0, B1, C0...C5 on STM32F1xx
(they are the same at least for STM32F103x8 and larger F103 devices, and
also F102, F105, F107 families).  Actually tested on STM32F103C8T6
(therefore pins C0...C5 were not tested).

Pins F6...F10, which are present on STM32F103x[C-G] in 144-pin packages,
cannot be supported at the moment, because those pins are connected only
to ADC3, but the ChibiOS ADC driver for STM32F1xx supports only ADC1.

* Add support for all possible analog pins on STM32F4xx

Added ADC mux values for pins A0...A7, B0, B1, C0...C5 and optionally
F3...F10 (if STM32_ADC_USE_ADC3 is enabled).  These mux values are
apparently the same for all F4xx devices, except some smaller devices may
not have ADC3.

Actually tested on STM32F401CCU6, STM32F401CEU6, STM32F411CEU6 (using
various WeAct “Blackpill” boards); only pins A0...A7, B0, B1 were tested.

Pins F3...F10 are inside `#if STM32_ADC_USE_ADC3` because some devices
which don't have ADC3 also don't have the GPIOF port, therefore the code
which refers to Fx pins does not compile.

* Fix STM32F3xx ADC mux table in documentation

The ADC driver documentation had some errors in the mux table for STM32F3xx.
Fix this table to match the datasheet and the actual code (mux settings for
B12 and B13 were also tested on a real STM32F303CCT6 chip).

* Add STM32F1xx ADC pins to the documentation

* Add STM32F4xx ADC pins to the documentation
2021-04-25 11:15:37 +10:00
..
apa102 Rewrite APA102 support (#10894) 2020-12-30 00:28:49 +00:00
avr Merge remote-tracking branch 'origin/master' into develop 2021-02-08 21:33:45 +00:00
chibios Update ADC driver for STM32F1xx, STM32F3xx, STM32F4xx (#12403) 2021-04-25 11:15:37 +10:00
eeprom Add i2c 24LC64 eeprom (#11200) 2020-12-14 05:50:50 +11:00
gpio Increase matrix scanning speed on xd84 (#7517) 2019-12-03 19:39:21 +00:00
haptic Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00
issi LED Matrix: rename LED_DRIVER_LED_COUNT to DRIVER_LED_TOTAL (#11858) 2021-02-15 11:55:13 +11:00
oled Format code according to conventions (#12381) 2021-03-25 23:44:37 +11:00
qwiic Fixup Satisfaction75 bootprocess. (#12621) 2021-04-19 13:08:01 +10:00
ugfx/gdisp Ensure single newline at EOF for core files (#11310) 2020-12-28 04:36:32 +11:00
usbpd.h Add support for analog USBPD on STM32G4xx. (#11824) 2021-02-15 08:56:13 +11:00
ws2812.h qmk cformat (#9500) 2020-06-22 11:21:48 +10:00