git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7937 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
261a2e7e8b
commit
0b7c0f050c
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue