diff options
author | Damien George <damien.p.george@gmail.com> | 2018-04-24 12:07:59 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-04-24 12:07:59 +1000 |
commit | 8b91260169e03a530c956da2e64ab8d4fdf6f5f7 (patch) | |
tree | 3fccb184c3e210a7ccfcb6aee99703a5d5412941 | |
parent | 8a949ba599df740e6d0c9154619c6f83f2949924 (diff) |
stm32/dac: Support MCUs that don't have TIM4/5 and use new HAL macro.
-rw-r--r-- | ports/stm32/dac.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ports/stm32/dac.c b/ports/stm32/dac.c index 04acfb8aa..5423a2bff 100644 --- a/ports/stm32/dac.c +++ b/ports/stm32/dac.c @@ -105,10 +105,14 @@ STATIC uint32_t TIMx_Config(mp_obj_t timer) { // work out the trigger channel (only certain ones are supported) if (tim->Instance == TIM2) { return DAC_TRIGGER_T2_TRGO; + #if defined(TIM4) } else if (tim->Instance == TIM4) { return DAC_TRIGGER_T4_TRGO; + #endif + #if defined(TIM5) } else if (tim->Instance == TIM5) { return DAC_TRIGGER_T5_TRGO; + #endif #if defined(TIM6) } else if (tim->Instance == TIM6) { return DAC_TRIGGER_T6_TRGO; @@ -176,7 +180,7 @@ STATIC mp_obj_t pyb_dac_init_helper(pyb_dac_obj_t *self, size_t n_args, const mp #endif // stop anything already going on - __DMA1_CLK_ENABLE(); + __HAL_RCC_DMA1_CLK_ENABLE(); DMA_HandleTypeDef DMA_Handle; /* Get currently configured dma */ dma_init_handle(&DMA_Handle, self->tx_dma_descr, (void*)NULL); @@ -420,7 +424,7 @@ mp_obj_t pyb_dac_write_timed(size_t n_args, const mp_obj_t *pos_args, mp_map_t * dac_trigger = TIMx_Config(args[1].u_obj); } - __DMA1_CLK_ENABLE(); + __HAL_RCC_DMA1_CLK_ENABLE(); DMA_HandleTypeDef DMA_Handle; /* Get currently configured dma */ |