Skip to content

Fix DAC for F103RF and RG #1040

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

Merged
merged 2 commits into from
Apr 21, 2020
Merged

Fix DAC for F103RF and RG #1040

merged 2 commits into from
Apr 21, 2020

Conversation

MCUdude
Copy link
Contributor

@MCUdude MCUdude commented Apr 20, 2020

These lines prevented the DAC implementation from working on F103RF and F103RG.
Note that the definition is located in PeripheralPins.c.

Implementation is located in PeripheralPins.c
@fpistm
Copy link
Member

fpistm commented Apr 20, 2020

The define have to be in the variant

@MCUdude
Copy link
Contributor Author

MCUdude commented Apr 21, 2020

There's an ifdef here:

#if defined(STM32F103xE) || defined(STM32F103xG)
#ifdef HAL_DAC_MODULE_ENABLED
WEAK const PinMap PinMap_DAC[] = {
{PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1
{PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2
{NC, NP, 0}
};
#endif
#endif

But this means we'll have to manually have to enable HAL_ADC_MODULE_ENABLED and HAL_DAC_MODULE_ENABLED? if so, where is HAL_ADC_MODULE_ENABLED defined?

@fpistm
Copy link
Member

fpistm commented Apr 21, 2020

ADC is defined by default for all as all have an ADC.
DAC is not defined by default so it have to be defined for those which have DAC.
In the peripheral pins, this is not the definition, so if you remove it from variant DAC will not be usable unless user define it thanks build_opt.h or hal_conf_extra.h.

@fpistm fpistm added the fix 🩹 Bug fix label Apr 21, 2020
@fpistm fpistm added this to the 1.9.0 milestone Apr 21, 2020
@fpistm fpistm merged commit c32c2c7 into stm32duino:master Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants