From f180c606d8485911240ba5441cbd1ca5a9a5d56a Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 3 May 2015 12:49:42 +0000 Subject: DAC dual mode, to be tested. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7946 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- .../debug/STM32F4xx-DAC_DUAL (OpenOCD, Flash and Run).launch | 2 +- testhal/STM32/STM32F4xx/DAC_DUAL/main.c | 11 +++++++---- testhal/STM32/STM32F4xx/DAC_DUAL/mcuconf.h | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'testhal/STM32') diff --git a/testhal/STM32/STM32F4xx/DAC_DUAL/debug/STM32F4xx-DAC_DUAL (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32F4xx/DAC_DUAL/debug/STM32F4xx-DAC_DUAL (OpenOCD, Flash and Run).launch index a6cdd3e04..cf2bb94e6 100644 --- a/testhal/STM32/STM32F4xx/DAC_DUAL/debug/STM32F4xx-DAC_DUAL (OpenOCD, Flash and Run).launch +++ b/testhal/STM32/STM32F4xx/DAC_DUAL/debug/STM32F4xx-DAC_DUAL (OpenOCD, Flash and Run).launch @@ -33,7 +33,7 @@ - + diff --git a/testhal/STM32/STM32F4xx/DAC_DUAL/main.c b/testhal/STM32/STM32F4xx/DAC_DUAL/main.c index e57d8a3f2..b6d46b284 100644 --- a/testhal/STM32/STM32F4xx/DAC_DUAL/main.c +++ b/testhal/STM32/STM32F4xx/DAC_DUAL/main.c @@ -89,11 +89,11 @@ 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_DUAL }; static const DACConversionGroup dacgrpcfg1 = { - num_channels: 1U, + num_channels: 2U, end_cb: end_cb1, error_cb: error_cb1, trigger: DAC_TRG(0) @@ -125,10 +125,11 @@ int main(void) { chSysInit(); /* - * Starting DAC1 driver, setting up the output pin as analog as suggested + * Starting DAC1 driver, setting up the output pins as analog as suggested * by the Reference Manual. */ palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_ANALOG); + palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_ANALOG); dacStart(&DACD1, &dac1cfg1); /* @@ -138,8 +139,10 @@ int main(void) { /* * Starting a continuous conversion. + * Note, the buffer size is divided by two because two elements are fetched + * for each transfer. */ - dacStartConversion(&DACD1, &dacgrpcfg1, dac_buffer, DAC_BUFFER_SIZE); + dacStartConversion(&DACD1, &dacgrpcfg1, dac_buffer, DAC_BUFFER_SIZE / 2U); gptStartContinuous(&GPTD6, 2U); /* diff --git a/testhal/STM32/STM32F4xx/DAC_DUAL/mcuconf.h b/testhal/STM32/STM32F4xx/DAC_DUAL/mcuconf.h index a6bc10980..d16ac4194 100644 --- a/testhal/STM32/STM32F4xx/DAC_DUAL/mcuconf.h +++ b/testhal/STM32/STM32F4xx/DAC_DUAL/mcuconf.h @@ -93,9 +93,9 @@ /* * DAC driver system settings. */ -#define STM32_DAC_DUAL_MODE FALSE +#define STM32_DAC_DUAL_MODE TRUE #define STM32_DAC_USE_DAC1_CH1 TRUE -#define STM32_DAC_USE_DAC1_CH2 TRUE +#define STM32_DAC_USE_DAC1_CH2 FALSE #define STM32_DAC1_CH1_IRQ_PRIORITY 10 #define STM32_DAC1_CH2_IRQ_PRIORITY 10 #define STM32_DAC1_CH1_DMA_PRIORITY 2 -- cgit v1.2.3