Commit db4190bc authored by Luiz-Fernando Lavado-Villa's avatar Luiz-Fernando Lavado-Villa
Browse files

Changed the dac configuration

parent 021fcfe8
......@@ -54,32 +54,51 @@ void owntech_dac_dac1_dac3_current_mode_init()
const struct device* dac1 = device_get_binding(DAC1_LABEL);
const struct device* dac3 = device_get_binding(DAC3_LABEL);
dac_function_config_t function_config =
dac_function_config_t function_config_dac1 =
{
.dac_function = dac_function_sawtooth,
.trigger_source = LL_DAC_TRIG_EXT_HRTIM_RST_TRG1,
.step_trigger_source = LL_DAC_TRIG_EXT_HRTIM_STEP_TRG1,
.polarity = LL_DAC_SAWTOOTH_POLARITY_DECREMENT,
.reset_data = 4000,
.step_data = 200
.reset_data = 2200,
.step_data = 31
};
dac_pin_config_t pin_config =
dac_function_config_t function_config_dac3 =
{
.dac_function = dac_function_sawtooth,
.trigger_source = LL_DAC_TRIG_EXT_HRTIM_RST_TRG1,
.step_trigger_source = LL_DAC_TRIG_EXT_HRTIM_STEP_TRG1,
.polarity = LL_DAC_SAWTOOTH_POLARITY_DECREMENT,
.reset_data = 2200,
.step_data = 31
};
dac_pin_config_t pin_config_internal =
{
.pin_connect = LL_DAC_OUTPUT_CONNECT_INTERNAL,
.pin_buffer_enable = LL_DAC_OUTPUT_BUFFER_DISABLE
};
dac_pin_config_t pin_config_internal_and_gpio =
{
.pin_connect = LL_DAC_OUTPUT_CONNECT_INTERNAL,
.pin_buffer_enable = LL_DAC_OUTPUT_BUFFER_ENABLE
};
// DAC 1
dac_set_function(dac1, 1, &function_config);
dac_pin_configure(dac1, 1, &pin_config);
dac_set_function(dac1, 1, &function_config_dac1);
dac_pin_configure(dac1, 1, &pin_config_internal_and_gpio);
dac_start(dac1, 1);
// DAC 3
function_config.trigger_source = LL_DAC_TRIG_EXT_HRTIM_RST_TRG2;
function_config.step_trigger_source = LL_DAC_TRIG_EXT_HRTIM_STEP_TRG2;
function_config_dac3.trigger_source = LL_DAC_TRIG_EXT_HRTIM_RST_TRG2;
function_config_dac3.step_trigger_source = LL_DAC_TRIG_EXT_HRTIM_STEP_TRG2;
dac_set_function(dac3, 1, &function_config);
dac_pin_configure(dac3, 1, &pin_config);
dac_set_function(dac3, 1, &function_config_dac3);
dac_pin_configure(dac3, 1, &pin_config_internal);
dac_start(dac3, 1);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment