Improved DAC initialization.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7942 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
2de1b8e40f
commit
f7361859b0
|
@ -251,10 +251,11 @@ void dac_lld_start(DACDriver *dacp) {
|
||||||
#if STM32_DAC_DUAL_MODE == FALSE
|
#if STM32_DAC_DUAL_MODE == FALSE
|
||||||
dacp->params->dac->CR &= dacp->params->regmask;
|
dacp->params->dac->CR &= dacp->params->regmask;
|
||||||
dacp->params->dac->CR |= DAC_CR_EN1 << dacp->params->regshift;
|
dacp->params->dac->CR |= DAC_CR_EN1 << dacp->params->regshift;
|
||||||
*(&dacp->params->dac->DHR12R1 + dacp->params->dataoffset) = 0U;
|
dac_lld_put_channel(dacp, 0U, dacp->config->init);
|
||||||
#else
|
#else
|
||||||
dacp->params->dac->CR = DAC_CR_EN2 | DAC_CR_EN1;
|
dacp->params->dac->CR = DAC_CR_EN2 | DAC_CR_EN1;
|
||||||
dacp->params->dac->DHR12RD = 0U;
|
dac_lld_put_channel(dacp, 0U, dacp->config->init);
|
||||||
|
dac_lld_put_channel(dacp, 1U, dacp->config->init);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,6 +364,10 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* End of the mandatory fields.*/
|
/* End of the mandatory fields.*/
|
||||||
|
/**
|
||||||
|
* @brief Initial output on DAC channels.
|
||||||
|
*/
|
||||||
|
dacsample_t init;
|
||||||
/**
|
/**
|
||||||
* @brief DAC data holding register mode.
|
* @brief DAC data holding register mode.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
# Compiler options here.
|
# Compiler options here.
|
||||||
ifeq ($(USE_OPT),)
|
ifeq ($(USE_OPT),)
|
||||||
USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
|
USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# C specific options here (added to USE_OPT).
|
# C specific options here (added to USE_OPT).
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
|
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="CR2-adc-adcp-adc_lld_start_conversion-(format)" val="4"/><content id="CR2-adc-null-port_wait_for_interrupt-(format)" val="4"/><content id="cr2-adc_lld_start_conversion-(format)" val="4"/></contentList>"/>
|
<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><contentList><content id="cr2-adc_lld_start_conversion-(format)" val="4"/><content id="CR2-adc-null-port_wait_for_interrupt-(format)" val="4"/><content id="CR2-adc-adcp-adc_lld_start_conversion-(format)" val="4"/></contentList>"/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
|
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <globalVariableList/> "/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList/> "/>
|
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <memoryBlockExpressionList/> "/>
|
||||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
|
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>
|
||||||
|
|
|
@ -88,6 +88,7 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const DACConfig dac1cfg1 = {
|
static const DACConfig dac1cfg1 = {
|
||||||
|
init: 2047U,
|
||||||
datamode: DAC_DHRM_12BIT_RIGHT
|
datamode: DAC_DHRM_12BIT_RIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue