mirror of https://github.com/Desuuuu/klipper.git
stm32: support stm32f401 adc_temperature sensor (#5572)
> The temperature sensor is internally connected to the ADC_IN18 > The TSVREFE bit must be set to enable the conversion of both internal channels: the ADC1_IN16 or ADC1_IN18 (temperature sensor) and the ADC1_IN17 (VREFINT). Ref.: https://www.st.com/resource/en/reference_manual/dm00096844-stm32f401xb-c-and-stm32f401xd-e-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf Signed-off-by: Kamil Trzciński <ayufan@ayufan.eu>
This commit is contained in:
parent
f2a5800cea
commit
0256967def
|
@ -28,7 +28,7 @@ static const uint8_t adc_pins[] = {
|
||||||
ADC_TEMPERATURE_PIN,
|
ADC_TEMPERATURE_PIN,
|
||||||
#elif CONFIG_MACH_STM32F2 || CONFIG_MACH_STM32F4x5
|
#elif CONFIG_MACH_STM32F2 || CONFIG_MACH_STM32F4x5
|
||||||
ADC_TEMPERATURE_PIN, 0x00, 0x00,
|
ADC_TEMPERATURE_PIN, 0x00, 0x00,
|
||||||
#elif CONFIG_MACH_STM32F446
|
#elif CONFIG_MACH_STM32F401 || CONFIG_MACH_STM32F446
|
||||||
0x00, 0x00, ADC_TEMPERATURE_PIN,
|
0x00, 0x00, ADC_TEMPERATURE_PIN,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -108,7 +108,9 @@ gpio_adc_setup(uint32_t pin)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pin == ADC_TEMPERATURE_PIN) {
|
if (pin == ADC_TEMPERATURE_PIN) {
|
||||||
#if !(CONFIG_MACH_STM32F1 || CONFIG_MACH_STM32F401)
|
#if CONFIG_MACH_STM32F401
|
||||||
|
ADC1_COMMON->CCR = ADC_CCR_TSVREFE;
|
||||||
|
#elif !CONFIG_MACH_STM32F1
|
||||||
ADC123_COMMON->CCR = ADC_CCR_TSVREFE;
|
ADC123_COMMON->CCR = ADC_CCR_TSVREFE;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue