aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-05-02 12:57:07 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-05-02 12:57:07 +0000
commit0b7c0f050c5ad42a55fc3635d6ae44bda5bfe049 (patch)
tree189d599082a9d2bc68a16d0b2e1033bfd22cf766 /testhal/STM32
parent261a2e7e8bfd6f7234f9b4a63a7f029656263165 (diff)
downloadChibiOS-0b7c0f050c5ad42a55fc3635d6ae44bda5bfe049.tar.gz
ChibiOS-0b7c0f050c5ad42a55fc3635d6ae44bda5bfe049.tar.bz2
ChibiOS-0b7c0f050c5ad42a55fc3635d6ae44bda5bfe049.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7937 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32')
-rw-r--r--testhal/STM32/STM32F4xx/DAC/halconf.h2
-rw-r--r--testhal/STM32/STM32F4xx/DAC/main.c22
-rw-r--r--testhal/STM32/STM32F4xx/DAC/mcuconf.h2
3 files changed, 22 insertions, 4 deletions
diff --git a/testhal/STM32/STM32F4xx/DAC/halconf.h b/testhal/STM32/STM32F4xx/DAC/halconf.h
index a065d771d..28bd0e52d 100644
--- a/testhal/STM32/STM32F4xx/DAC/halconf.h
+++ b/testhal/STM32/STM32F4xx/DAC/halconf.h
@@ -69,7 +69,7 @@
* @brief Enables the GPT subsystem.
*/
#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
-#define HAL_USE_GPT FALSE
+#define HAL_USE_GPT TRUE
#endif
/**
diff --git a/testhal/STM32/STM32F4xx/DAC/main.c b/testhal/STM32/STM32F4xx/DAC/main.c
index 7371cbb2d..d35d42b83 100644
--- a/testhal/STM32/STM32F4xx/DAC/main.c
+++ b/testhal/STM32/STM32F4xx/DAC/main.c
@@ -90,6 +90,17 @@ static const DACConversionGroup daccfg1 = {
trigger: DAC_TRG(0)
};
+
+/*
+ * GPT2 configuration.
+ */
+static const GPTConfig gpt6cfg1 = {
+ frequency: 1000000U,
+ callback: NULL,
+ cr2: TIM_CR2_MMS_1, /* MMS = 010 = TRGO on Update Event. */
+ dier: 0U
+};
+
/*
* Application entry point.
*/
@@ -106,16 +117,22 @@ int main(void) {
chSysInit();
/*
- * Starting DAC driver, setting up the output pin as analog as suggested
+ * Starting DAC1 driver, setting up the output pin as analog as suggested
* by the Reference Manual.
*/
palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_ANALOG);
dacStart(&DACD1, NULL);
/*
- * Starting a continous conversion.
+ * Starting GPT6 driver, it is used for triggering the DAC.
+ */
+ gptStart(&GPTD6, &gpt6cfg1);
+
+ /*
+ * Starting a continuous conversion.
*/
dacStartConversion(&DACD1, &daccfg1, dac_buffer, DAC_BUFFER_SIZE);
+ gptStartContinuous(&GPTD6, 2U);
/*
* Normal main() thread activity, if the button is pressed then the I2s
@@ -123,6 +140,7 @@ int main(void) {
*/
while (true) {
if (palReadPad(GPIOA, GPIOA_BUTTON)) {
+ gptStopTimer(&GPTD6);
dacStopConversion(&DACD1);
}
chThdSleepMilliseconds(500);
diff --git a/testhal/STM32/STM32F4xx/DAC/mcuconf.h b/testhal/STM32/STM32F4xx/DAC/mcuconf.h
index 419775ba1..a6bc10980 100644
--- a/testhal/STM32/STM32F4xx/DAC/mcuconf.h
+++ b/testhal/STM32/STM32F4xx/DAC/mcuconf.h
@@ -129,7 +129,7 @@
#define STM32_GPT_USE_TIM3 FALSE
#define STM32_GPT_USE_TIM4 FALSE
#define STM32_GPT_USE_TIM5 FALSE
-#define STM32_GPT_USE_TIM6 FALSE
+#define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 FALSE
#define STM32_GPT_USE_TIM8 FALSE
#define STM32_GPT_USE_TIM9 FALSE