File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
ports/atmel-samd/common-hal/analogio Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 36
36
#include "atmel_start_pins.h"
37
37
#include "hal/include/hal_dac_sync.h"
38
38
#include "hpl/gclk/hpl_gclk_base.h"
39
+ #include "peripheral_clk_config.h"
39
40
40
41
#ifdef SAMD21
41
42
#include "hpl/pm/hpl_pm_base.h"
@@ -65,16 +66,16 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self,
65
66
66
67
#ifdef SAMD51
67
68
hri_mclk_set_APBDMASK_DAC_bit (MCLK );
68
- // This clock should be <= 12 MHz, per datasheet section 47.6.3.
69
- hri_gclk_write_PCHCTRL_reg (GCLK , DAC_GCLK_ID , GCLK_PCHCTRL_GEN_GCLK5_Val | (1 << GCLK_PCHCTRL_CHEN_Pos ));
70
69
#endif
71
70
72
71
#ifdef SAMD21
73
72
_pm_enable_bus_clock (PM_BUS_APBC , DAC );
74
- // This clock should be <= 350kHz, per datasheet table 37-6.
75
- _gclk_enable_channel (DAC_GCLK_ID , GCLK_CLKCTRL_GEN_GCLK1_Val );
76
73
#endif
77
74
75
+ // SAMD21: This clock should be <= 12 MHz, per datasheet section 47.6.3.
76
+ // SAMD51: This clock should be <= 350kHz, per datasheet table 37-6.
77
+ _gclk_enable_channel (DAC_GCLK_ID , CONF_GCLK_DAC_SRC );
78
+
78
79
// Don't double init the DAC on the SAMD51 when both outputs are in use. We use the free state
79
80
// of each output pin to determine DAC state.
80
81
int32_t result = ERR_NONE ;
You can’t perform that action at this time.
0 commit comments