diff --git a/os/hal/ports/STM32/LLD/DACv1/dac_lld.c b/os/hal/ports/STM32/LLD/DACv1/dac_lld.c index 91943ecde..536598c8a 100644 --- a/os/hal/ports/STM32/LLD/DACv1/dac_lld.c +++ b/os/hal/ports/STM32/LLD/DACv1/dac_lld.c @@ -249,7 +249,9 @@ void dac_lld_start(DACDriver *dacp) { channel = 1; } #endif - + /* Copying user configuration into cr */ + dacp->params->dac->CR = dacp->config->cr; + /* Enabling DAC in SW triggering mode initially, initializing data to zero.*/ #if STM32_DAC_DUAL_MODE == FALSE diff --git a/os/hal/ports/STM32/LLD/DACv1/dac_lld.h b/os/hal/ports/STM32/LLD/DACv1/dac_lld.h index de21bda63..4d4c30102 100644 --- a/os/hal/ports/STM32/LLD/DACv1/dac_lld.h +++ b/os/hal/ports/STM32/LLD/DACv1/dac_lld.h @@ -371,6 +371,10 @@ typedef struct { * @brief DAC data holding register mode. */ dacdhrmode_t datamode; + /** + * @brief DAC control register. + */ + uint32_t cr; } DACConfig; /** diff --git a/readme.txt b/readme.txt index 8ef42b3f3..6625694d2 100644 --- a/readme.txt +++ b/readme.txt @@ -73,6 +73,7 @@ ***************************************************************************** *** 16.1.6 *** +- HAL: Added CR field to DAC configuration in STM32 port (bug #803). - HAL: Fixed wrong initialization for DACD4 in STM32 port (bug #802). - HAL: Fixed tab instead of space in dac driver (bug #801). - HAL: Fixed missing GPT and DAC in STM32F07/?9x mcuconf (bug #800). diff --git a/testhal/STM32/STM32F3xx/DAC/main.c b/testhal/STM32/STM32F3xx/DAC/main.c index 00b8afc5d..c9a78cd33 100644 --- a/testhal/STM32/STM32F3xx/DAC/main.c +++ b/testhal/STM32/STM32F3xx/DAC/main.c @@ -89,7 +89,8 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) { static const DACConfig dac1cfg1 = { .init = 2047U, - .datamode = DAC_DHRM_12BIT_RIGHT + .datamode = DAC_DHRM_12BIT_RIGHT, + .cr = 0 }; static const DACConversionGroup dacgrpcfg1 = { diff --git a/testhal/STM32/STM32F4xx/DAC/main.c b/testhal/STM32/STM32F4xx/DAC/main.c index 1e8ce9a3f..8f7b41253 100644 --- a/testhal/STM32/STM32F4xx/DAC/main.c +++ b/testhal/STM32/STM32F4xx/DAC/main.c @@ -89,7 +89,8 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) { static const DACConfig dac1cfg1 = { .init = 2047U, - .datamode = DAC_DHRM_12BIT_RIGHT + .datamode = DAC_DHRM_12BIT_RIGHT, + .cr = 0 }; static const DACConversionGroup dacgrpcfg1 = { diff --git a/testhal/STM32/STM32F4xx/DAC_DUAL/main.c b/testhal/STM32/STM32F4xx/DAC_DUAL/main.c index bf90f72a6..0c96583eb 100644 --- a/testhal/STM32/STM32F4xx/DAC_DUAL/main.c +++ b/testhal/STM32/STM32F4xx/DAC_DUAL/main.c @@ -89,7 +89,8 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) { static const DACConfig dac1cfg1 = { .init = 2047U, - .datamode = DAC_DHRM_12BIT_RIGHT_DUAL + .datamode = DAC_DHRM_12BIT_RIGHT_DUAL, + .cr = 0 }; static const DACConversionGroup dacgrpcfg1 = { diff --git a/testhal/STM32/STM32L1xx/DAC/main.c b/testhal/STM32/STM32L1xx/DAC/main.c index beb04e574..f7eb9bff3 100644 --- a/testhal/STM32/STM32L1xx/DAC/main.c +++ b/testhal/STM32/STM32L1xx/DAC/main.c @@ -89,7 +89,8 @@ static void error_cb1(DACDriver *dacp, dacerror_t err) { static const DACConfig dac1cfg1 = { .init = 2047U, - .datamode = DAC_DHRM_12BIT_RIGHT + .datamode = DAC_DHRM_12BIT_RIGHT, + .cr = 0 }; static const DACConversionGroup dacgrpcfg1 = {