diff options
-rw-r--r-- | os/hal/ports/STM32/LLD/DACv1/dac_lld.c | 5 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/DACv1/dac_lld.h | 4 | ||||
-rw-r--r-- | testhal/STM32/STM32F4xx/DAC/Makefile | 2 | ||||
-rw-r--r-- | testhal/STM32/STM32F4xx/DAC/debug/STM32F4xx-DAC (OpenOCD, Flash and Run).launch | 2 | ||||
-rw-r--r-- | testhal/STM32/STM32F4xx/DAC/main.c | 1 |
5 files changed, 10 insertions, 4 deletions
diff --git a/os/hal/ports/STM32/LLD/DACv1/dac_lld.c b/os/hal/ports/STM32/LLD/DACv1/dac_lld.c index 6aabd7f34..8fc51ae88 100644 --- a/os/hal/ports/STM32/LLD/DACv1/dac_lld.c +++ b/os/hal/ports/STM32/LLD/DACv1/dac_lld.c @@ -251,10 +251,11 @@ void dac_lld_start(DACDriver *dacp) { #if STM32_DAC_DUAL_MODE == FALSE
dacp->params->dac->CR &= dacp->params->regmask;
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
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
}
}
diff --git a/os/hal/ports/STM32/LLD/DACv1/dac_lld.h b/os/hal/ports/STM32/LLD/DACv1/dac_lld.h index ddfafc256..a62852c51 100644 --- a/os/hal/ports/STM32/LLD/DACv1/dac_lld.h +++ b/os/hal/ports/STM32/LLD/DACv1/dac_lld.h @@ -365,6 +365,10 @@ typedef struct { typedef struct {
/* End of the mandatory fields.*/
/**
+ * @brief Initial output on DAC channels.
+ */
+ dacsample_t init;
+ /**
* @brief DAC data holding register mode.
*/
dacdhrmode_t datamode;
diff --git a/testhal/STM32/STM32F4xx/DAC/Makefile b/testhal/STM32/STM32F4xx/DAC/Makefile index 3fec9da36..2a762abc4 100644 --- a/testhal/STM32/STM32F4xx/DAC/Makefile +++ b/testhal/STM32/STM32F4xx/DAC/Makefile @@ -5,7 +5,7 @@ # Compiler options here.
ifeq ($(USE_OPT),)
- USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
+ USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16
endif
# C specific options here (added to USE_OPT).
diff --git a/testhal/STM32/STM32F4xx/DAC/debug/STM32F4xx-DAC (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32F4xx/DAC/debug/STM32F4xx-DAC (OpenOCD, Flash and Run).launch index bb8c1ea60..8a1fa9311 100644 --- a/testhal/STM32/STM32F4xx/DAC/debug/STM32F4xx-DAC (OpenOCD, Flash and Run).launch +++ b/testhal/STM32/STM32F4xx/DAC/debug/STM32F4xx-DAC (OpenOCD, Flash and Run).launch @@ -33,7 +33,7 @@ <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.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.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"/>
diff --git a/testhal/STM32/STM32F4xx/DAC/main.c b/testhal/STM32/STM32F4xx/DAC/main.c index 469132559..e57d8a3f2 100644 --- a/testhal/STM32/STM32F4xx/DAC/main.c +++ b/testhal/STM32/STM32F4xx/DAC/main.c @@ -88,6 +88,7 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) { }
static const DACConfig dac1cfg1 = {
+ init: 2047U,
datamode: DAC_DHRM_12BIT_RIGHT
};
|