mirror of https://github.com/ARMmbed/mbed-os.git
STM32: analog_out: Enable Buffer and switch
ADC1 channel2 and ADC2 of few targets only have an output switch and no buffer. This switch needs to be enabled, and also the buffer can be enabled in order to reduce the output impedance on output, and to drive external loads directly without having to add an external operational amplifier.pull/4529/head
parent
cdd581b244
commit
b51d676dc0
|
@ -87,8 +87,15 @@ void analogout_init(dac_t *obj, PinName pin) {
|
||||||
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
|
obj->handle.Instance = (DAC_TypeDef *)(obj->dac);
|
||||||
|
|
||||||
sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
|
sConfig.DAC_Trigger = DAC_TRIGGER_NONE;
|
||||||
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_DISABLE;
|
/* Enable both Buffer and Switch in the configuration,
|
||||||
|
* letting HAL layer in charge of selecting either one
|
||||||
|
* or the other depending on the actual DAC instance and
|
||||||
|
* channel being configured.
|
||||||
|
*/
|
||||||
|
sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
|
||||||
|
#if defined(DAC_OUTPUTSWITCH_ENABLE)
|
||||||
|
sConfig.DAC_OutputSwitch = DAC_OUTPUTSWITCH_ENABLE;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pin == PA_4) {
|
if (pin == PA_4) {
|
||||||
pa4_used = 1;
|
pa4_used = 1;
|
||||||
|
|
Loading…
Reference in New Issue