/** * @brief Main program. * @param None * @retval None */ int main(void) { uint32_t x; /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f072xb.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file */ /* initialization of the tables values for DAC signal generations */ for (x = 0; x < SIN1_ARRAY_SIZE; x++) { sin1_data[x] = (uint32_t) GenerateWave(INCREMENT1, DAC_AMPL_MAX); /* as the DAC buffer are enabled */ sin1_data[x] += sin1_data[x] << 16; } ConfigureGPIO(); ConfigureGPIOasAnalog(); ConfigureDAC(); ConfigureDMA(); ConfigureTIM7(); __WFI(); /* If an error occurs or the execution is stop by debugger, the wait mode is exited */ SysTick_Config(48000); /* 1ms config */ while (1) /* Infinite loop only reach in case of error */ { } }
/** * @brief Main program. * @param None * @retval None */ int main(void) { uint32_t x; /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f072xb.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file */ /* initialization of the tables values for DAC signal generations */ for (x = 0; x < SIN1_ARRAY_SIZE; x++) { sin1_data[x] = GenerateWave(INCREMENT1, DAC_AMPL_MAX); /* DAC 1 has its buffer enabled */ } ConfigureGPIOasAnalog(); ConfigureDAC(); x = 0; while (1) /* Infinite loop only reach in case of error */ { DAC->DHR12RD = (uint32_t)((sin1_data[x] << 16) + sin1_data[x]); x++; if (x >= SIN1_ARRAY_SIZE) { x = 0; } } }
/** * @brief Main program. * @param None * @retval None */ int main(void) { /*!< At this stage the microcontroller clock setting is already configured, this is done through SystemInit() function which is called from startup file (startup_stm32f072xb.s) before to branch to application main. To reconfigure the default setting of SystemInit() function, refer to system_stm32f0xx.c file */ ConfigureGPIOasAnalog(); ConfigureDAC(); ConfigureTIM7(); __WFI(); /* the wait mode should never be exited as not interrupt enabled*/ while(1); }