Skip to content

Commit 01a1aa3

Browse files
authored
Merge pull request #1326 from ABOSTM/DAC_FIXES
DAC fixes
2 parents 6ec82f6 + 7ac20ed commit 01a1aa3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

libraries/SrcWrapper/src/stm32/analog.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,6 @@ void dac_write_value(PinName pin, uint32_t value, uint8_t do_init)
389389
return;
390390
}
391391
if (do_init == 1) {
392-
393-
if (HAL_DAC_DeInit(&DacHandle) != HAL_OK) {
394-
/* DeInitialization Error */
395-
return;
396-
}
397-
398392
/*##-1- Configure the DAC peripheral #######################################*/
399393
g_current_pin = pin;
400394
if (HAL_DAC_Init(&DacHandle) != HAL_OK) {
@@ -404,6 +398,9 @@ void dac_write_value(PinName pin, uint32_t value, uint8_t do_init)
404398

405399
dacChannelConf.DAC_Trigger = DAC_TRIGGER_NONE;
406400
dacChannelConf.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
401+
#if defined(DAC_OUTPUTSWITCH_ENABLE)
402+
dacChannelConf.DAC_OutputSwitch = DAC_OUTPUTSWITCH_ENABLE;
403+
#endif
407404
/*##-2- Configure DAC channel1 #############################################*/
408405
if (HAL_DAC_ConfigChannel(&DacHandle, &dacChannelConf, dacChannel) != HAL_OK) {
409406
/* Channel configuration Error */

0 commit comments

Comments
 (0)