Skip to content

Commit 2de4d59

Browse files
committed
stmhal: Fix write_timed function for DAC(2).
Addresses issue adafruit#617.
1 parent f905ebb commit 2de4d59

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

stmhal/dac.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,11 @@ mp_obj_t pyb_dac_write_timed(uint n_args, const mp_obj_t *args, mp_map_t *kw_arg
295295
DMA_Handle.Init.PeriphBurst = DMA_PBURST_SINGLE;
296296
HAL_DMA_Init(&DMA_Handle);
297297

298-
__HAL_LINKDMA(&DAC_Handle, DMA_Handle1, DMA_Handle);
298+
if (self->dac_channel == DAC_CHANNEL_1) {
299+
__HAL_LINKDMA(&DAC_Handle, DMA_Handle1, DMA_Handle);
300+
} else {
301+
__HAL_LINKDMA(&DAC_Handle, DMA_Handle2, DMA_Handle);
302+
}
299303

300304
DAC_Handle.Instance = DAC;
301305
DAC_Handle.State = HAL_DAC_STATE_RESET;

0 commit comments

Comments
 (0)