stm32/dac: Deinit all DACs on soft reset.
DAC timed functions continue to run after a soft reset cycle, using collected memory in the case of write_timed.
This commit is contained in:
parent
c1841c2d45
commit
a00e1e5735
|
@ -131,6 +131,13 @@ STATIC void dac_deinit(uint32_t dac_channel) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void dac_deinit_all(void) {
|
||||
dac_deinit(DAC_CHANNEL_1);
|
||||
#if !defined(STM32L452xx)
|
||||
dac_deinit(DAC_CHANNEL_2);
|
||||
#endif
|
||||
}
|
||||
|
||||
STATIC void dac_config_channel(uint32_t dac_channel, uint32_t trig, uint32_t outbuf) {
|
||||
DAC->CR &= ~(DAC_CR_EN1 << dac_channel);
|
||||
uint32_t cr_off = DAC_CR_DMAEN1 | DAC_CR_MAMP1 | DAC_CR_WAVE1 | DAC_CR_TSEL1 | DAC_CR_TEN1;
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
|
||||
extern const mp_obj_type_t pyb_dac_type;
|
||||
|
||||
void dac_deinit_all(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_STM32_DAC_H
|
||||
|
|
|
@ -654,6 +654,9 @@ soft_reset_exit:
|
|||
#if MICROPY_HW_ENABLE_CAN
|
||||
can_deinit_all();
|
||||
#endif
|
||||
#if MICROPY_HW_ENABLE_DAC
|
||||
dac_deinit_all();
|
||||
#endif
|
||||
machine_deinit();
|
||||
|
||||
#if MICROPY_PY_THREAD
|
||||
|
|
Loading…
Reference in New Issue