From f67bac27d3e4c9d04ef2da19c5a011617abf5bca Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 25 Apr 2016 13:46:38 +0000 Subject: Fixed bug #734. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9363 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c | 16 ++++++++++++++-- readme.txt | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c b/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c index d528718ef..2e22581ed 100644 --- a/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c +++ b/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.c @@ -335,7 +335,11 @@ void dac_lld_put_channel(DACDriver *dacp, case DAC_DHRM_12BIT_RIGHT_DUAL: #endif if (channel == 0U) { +#if STM32_DAC_DUAL_MODE dacp->params->dac->DHR12R1 = (uint32_t)sample; +#else + *(&dacp->params->dac->DHR12R1 + dacp->params->dataoffset) = (uint32_t)sample; +#endif } else { dacp->params->dac->DHR12R2 = (uint32_t)sample; @@ -346,7 +350,11 @@ void dac_lld_put_channel(DACDriver *dacp, case DAC_DHRM_12BIT_LEFT_DUAL: #endif if (channel == 0U) { +#if STM32_DAC_DUAL_MODE dacp->params->dac->DHR12L1 = (uint32_t)sample; +#else + *(&dacp->params->dac->DHR12L1 + dacp->params->dataoffset) = (uint32_t)sample; +#endif } else { dacp->params->dac->DHR12L2 = (uint32_t)sample; @@ -357,10 +365,14 @@ void dac_lld_put_channel(DACDriver *dacp, case DAC_DHRM_8BIT_RIGHT_DUAL: #endif if (channel == 0U) { - dacp->params->dac->DHR8R1 = (uint32_t)sample; +#if STM32_DAC_DUAL_MODE + dacp->params->dac->DHR8R1 = (uint32_t)sample; +#else + *(&dacp->params->dac->DHR8R1 + dacp->params->dataoffset) = (uint32_t)sample; +#endif } else { - dacp->params->dac->DHR8R2 = (uint32_t)sample; + dacp->params->dac->DHR8R2 = (uint32_t)sample; } break; default: diff --git a/readme.txt b/readme.txt index e889a14e8..825e54b07 100644 --- a/readme.txt +++ b/readme.txt @@ -110,9 +110,11 @@ - NIL: Merged NIL2. - NIL: Added STM32F7 demo. - HAL: Fixed missing SDC initialization in RT-STM32F103-OLIMEX_STM32_P103 demo - (bug #735)(backported to 16.1.4). + (bug #735)(backported to 16.1.5). +- HAL: Fixed STM32 dac bug when using only channel 2 in direct mode (bug #734) + (backported to 3.0.6 and 16.1.5). - HAL: Fixed PAL lines support not working for STM32 GPIOv1 (bug #730) - (backported to 16.1.4). + (backported to 16.1.5). - RT: Fixed bug in chSchPreemption() function (bug #728)(backported to 2.6.10, 3.0.6 and 16.1.5). - HAL: Fixed prescaler not initialized in STM32 ADCv1 (bug #725) -- cgit v1.2.3