diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-01-25 22:23:13 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-01-25 22:23:17 +0100 |
commit | 2fff65aed2477a503c72629d27e2a330d30c02d1 (patch) | |
tree | 96fd9f2f8151e266c0cf8563a714d7bab8aa7cb0 /tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave | |
parent | 41fdd2b1f35bcb4224fdb8fee2b959e09d1f5916 (diff) | |
download | stm32f103-playground-2fff65aed2477a503c72629d27e2a330d30c02d1.tar.gz stm32f103-playground-2fff65aed2477a503c72629d27e2a330d30c02d1.tar.bz2 stm32f103-playground-2fff65aed2477a503c72629d27e2a330d30c02d1.tar.xz stm32f103-playground-2fff65aed2477a503c72629d27e2a330d30c02d1.zip |
o Seemingly working Mutexes.
o Dropping the privileged/unprivileged split for now.
Diffstat (limited to 'tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave')
3 files changed, 0 insertions, 457 deletions
diff --git a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/main.c b/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/main.c deleted file mode 100644 index 7b5773d..0000000 --- a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/main.c +++ /dev/null @@ -1,184 +0,0 @@ -/** - ****************************************************************************** - * @file DAC/TwoChannels_TriangleWave/main.c - * @author MCD Application Team - * @version V3.5.0 - * @date 08-April-2011 - * @brief Main program body. - ****************************************************************************** - * @attention - * - * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS - * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE - * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY - * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING - * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE - * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. - * - * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f10x.h" - -/** @addtogroup STM32F10x_StdPeriph_Examples - * @{ - */ - -/** @addtogroup DAC_TwoChannels_TriangleWave - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Init Structure definition */ -DAC_InitTypeDef DAC_InitStructure; -TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -void RCC_Configuration(void); -void GPIO_Configuration(void); -void Delay(__IO uint32_t nCount); - -/* Private functions ---------------------------------------------------------*/ - -/** - * @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_stm32f10x_xx.s) before to branch to application main. - To reconfigure the default setting of SystemInit() function, refer to - system_stm32f10x.c file - */ - - /* System Clocks Configuration */ - RCC_Configuration(); - - /* Once the DAC channel is enabled, the corresponding GPIO pin is automatically - connected to the DAC converter. In order to avoid parasitic consumption, - the GPIO pin should be configured in analog */ - GPIO_Configuration(); - - /* TIM2 Configuration */ - TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); - TIM_TimeBaseStructure.TIM_Period = 0xF; - TIM_TimeBaseStructure.TIM_Prescaler = 0xF; - TIM_TimeBaseStructure.TIM_ClockDivision = 0x0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); - - /* TIM2 TRGO selection */ - TIM_SelectOutputTrigger(TIM2, TIM_TRGOSource_Update); - - /* DAC channel1 Configuration */ - DAC_InitStructure.DAC_Trigger = DAC_Trigger_T2_TRGO; - DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_Triangle; - DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_TriangleAmplitude_2047; - DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable; - DAC_Init(DAC_Channel_1, &DAC_InitStructure); - - /* DAC channel2 Configuration */ - DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_TriangleAmplitude_1023; - DAC_Init(DAC_Channel_2, &DAC_InitStructure); - - /* Enable DAC Channel1: Once the DAC channel1 is enabled, PA.04 is - automatically connected to the DAC converter. */ - DAC_Cmd(DAC_Channel_1, ENABLE); - - /* Enable DAC Channel2: Once the DAC channel2 is enabled, PA.05 is - automatically connected to the DAC converter. */ - DAC_Cmd(DAC_Channel_2, ENABLE); - - /* Set DAC dual channel DHR12RD register */ - DAC_SetDualChannelData(DAC_Align_12b_R, 0x100, 0x100); - - /* TIM2 enable counter */ - TIM_Cmd(TIM2, ENABLE); - - while (1) - { - } -} - -/** - * @brief Configures the different system clocks. - * @param None - * @retval None - */ -void RCC_Configuration(void) -{ - /* Enable peripheral clocks ------------------------------------------------*/ - /* GPIOA Periph clock enable */ - RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); - /* DAC Periph clock enable */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE); - /* TIM2 Periph clock enable */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE); -} - -/** - * @brief Configures the different GPIO ports. - * @param None - * @retval None - */ -void GPIO_Configuration(void) -{ - GPIO_InitTypeDef GPIO_InitStructure; - - /* Once the DAC channel is enabled, the corresponding GPIO pin is automatically - connected to the DAC converter. In order to avoid parasitic consumption, - the GPIO pin should be configured in analog */ - GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_5; - GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN; - GPIO_Init(GPIOA, &GPIO_InitStructure); -} - -/** - * @brief Inserts a delay time. - * @param nCount: specifies the delay time length. - * @retval None - */ -void Delay(__IO uint32_t nCount) -{ - for(; nCount != 0; nCount--); -} - -#ifdef USE_FULL_ASSERT - -/** - * @brief Reports the name of the source file and the source line number - * where the assert_param error has occurred. - * @param file: pointer to the source file name - * @param line: assert_param error line source number - * @retval None - */ -void assert_failed(uint8_t* file, uint32_t line) -{ - /* User can add his own implementation to report the file name and line number, - ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ - - /* Infinite loop */ - while (1) - { - } -} - -#endif - -/** - * @} - */ - -/** - * @} - */ - -/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ diff --git a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/readme.txt b/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/readme.txt deleted file mode 100644 index fb3dd97..0000000 --- a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/readme.txt +++ /dev/null @@ -1,105 +0,0 @@ -/** - @page DAC_TwoChannels_TriangleWave DAC two channels triangle wave example - - @verbatim - ******************** (C) COPYRIGHT 2011 STMicroelectronics ******************* - * @file DAC/TwoChannels_TriangleWave/readme.txt - * @author MCD Application Team - * @version V3.5.0 - * @date 08-April-2011 - * @brief Description of the DAC two channels triangle wave example. - ****************************************************************************** - * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS - * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE - * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY - * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING - * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE - * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. - ****************************************************************************** - @endverbatim - -@par Example Description - -This example describes how to use two DAC channels to generate two different -signals with triangle waves on each DAC Channel output. - -DAC channels conversion are configured to be triggered by TIM2 TRGO with triangle -wave generation. 12bit right data alignment is selected since we choose to access -both DAC_DHR12R1 and DAC_DHR12R2 registers. -A triangle amplitude of 2047 is selected for DAC channel1 and 1023 for DAC channel2. -Both DAC channels are then enabled. DAC Channel1 DHR12R1 and DAC channel2 DHR12R2 -registers are set to have a base output voltage of VREF/16 on each output. - -Once TIM2 is enabled, each TIM2 TRGO update event trigger both DAC channels start -of conversion. The triangle counter is incremented, added to the base value and -applied to the corresponding DAC channel output. The same calculation is repeated -on each trigger. -The triangle waves can be visualized by connecting both PA.04 and PA.05 pins to -an oscilloscope. - - -@par Directory contents - - - DAC/TwoChannels_TriangleWave/stm32f10x_conf.h Library Configuration file - - DAC/TwoChannels_TriangleWave/stm32f10x_it.c Interrupt handlers - - DAC/TwoChannels_TriangleWave/stm32f10x_it.h Header for stm32f10x_it.c - - DAC/TwoChannels_TriangleWave/main.c Main program - - DAC/TwoChannels_TriangleWave/system_stm32f10x.c STM32F10x system source file - -@par Hardware and Software environment - - - This example runs on STM32F10x Connectivity line, High-Density, XL-Density, - Medium-Density Value line, High-Density Value line and Low-Density Value - line Devices. - - - This example has been tested with STMicroelectronics STM32100B-EVAL - (Medium-Density Value line), STM3210C-EVAL (Connectivity line), STM32100E-EVAL - (High-Density Value line) and STM3210E-EVAL (High-Density and XL-Density) - evaluation boards and can be easily tailored to any other supported device - and development board. - - - STM32100B-EVAL Set-up - - Connect PA.04 and PA.05 pins to an oscilloscope - @note JP2 should be open - - - STM3210C-EVAL Set-up - - Only PA.04 can be monitored on an oscilloscope, PA.05 is used by other - module (Motor control connector) that prevents to have DAC channel output - on it. However, if you don't use Motor control connector, you can remove - the 0ohm resistor R84 and thus PA.05 can be used for DAC output. - @note Make shure that jumper JP15 is open. - - - STM3210E-EVAL Set-up - - Connect PA.04 and PA.05 pins to an oscilloscope - - - STM32100E-EVAL Set-up - - Connect PA.04 and PA.05 pins to an oscilloscope - -@par How to use it ? - -In order to make the program work, you must do the following : - - Copy all source files from this example folder to the template folder under - Project\STM32F10x_StdPeriph_Template - - Open your preferred toolchain - - Rebuild all files and load your image into target memory - - Run the example - -@note - - Low-density Value line devices are STM32F100xx microcontrollers where the - Flash memory density ranges between 16 and 32 Kbytes. - - Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx - microcontrollers where the Flash memory density ranges between 16 and 32 Kbytes. - - Medium-density Value line devices are STM32F100xx microcontrollers where - the Flash memory density ranges between 64 and 128 Kbytes. - - Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx - microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes. - - High-density Value line devices are STM32F100xx microcontrollers where - the Flash memory density ranges between 256 and 512 Kbytes. - - High-density devices are STM32F101xx and STM32F103xx microcontrollers where - the Flash memory density ranges between 256 and 512 Kbytes. - - XL-density devices are STM32F101xx and STM32F103xx microcontrollers where - the Flash memory density ranges between 512 and 1024 Kbytes. - - Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers. - - * <h3><center>© COPYRIGHT 2011 STMicroelectronics</center></h3> - */ diff --git a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/stm32f10x_it.c b/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/stm32f10x_it.c deleted file mode 100644 index b38697d..0000000 --- a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/DAC/TwoChannels_TriangleWave/stm32f10x_it.c +++ /dev/null @@ -1,168 +0,0 @@ -/** - ****************************************************************************** - * @file DAC/TwoChannels_TriangleWave/stm32f10x_it.c - * @author MCD Application Team - * @version V3.5.0 - * @date 08-April-2011 - * @brief Main Interrupt Service Routines. - * This file provides template for all exceptions handler and peripherals - * interrupt service routine. - ****************************************************************************** - * @attention - * - * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS - * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE - * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY - * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING - * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE - * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. - * - * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> - ****************************************************************************** - */ - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f10x_it.h" - -/** @addtogroup STM32F10x_StdPeriph_Examples - * @{ - */ - -/** @addtogroup DAC_TwoChannels_TriangleWave - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -/* Private functions ---------------------------------------------------------*/ - -/******************************************************************************/ -/* Cortex-M3 Processor Exceptions Handlers */ -/******************************************************************************/ - - -/** - * @brief This function handles NMI exception. - * @param None - * @retval None - */ -void NMI_Handler(void) -{ -} - -/** - * @brief This function handles Hard Fault exception. - * @param None - * @retval None - */ -void HardFault_Handler(void) -{ - /* Go to infinite loop when Hard Fault exception occurs */ - while (1) - { - } -} - -/** - * @brief This function handles Memory Manage exception. - * @param None - * @retval None - */ -void MemManage_Handler(void) -{ - /* Go to infinite loop when Memory Manage exception occurs */ - while (1) - { - } -} - -/** - * @brief This function handles Bus Fault exception. - * @param None - * @retval None - */ -void BusFault_Handler(void) -{ - /* Go to infinite loop when Bus Fault exception occurs */ - while (1) - { - } -} - -/** - * @brief This function handles Usage Fault exception. - * @param None - * @retval None - */ -void UsageFault_Handler(void) -{ - /* Go to infinite loop when Usage Fault exception occurs */ - while (1) - { - } -} - -/** - * @brief This function handles SVCall exception. - * @param None - * @retval None - */ -void SVC_Handler(void) -{ -} - -/** - * @brief This function handles Debug Monitor exception. - * @param None - * @retval None - */ -void DebugMon_Handler(void) -{ -} - -/** - * @brief This function handles PendSV_Handler exception. - * @param None - * @retval None - */ -void PendSV_Handler(void) -{ -} - -/** - * @brief This function handles SysTick Handler. - * @param None - * @retval None - */ -void SysTick_Handler(void) -{ -} - -/******************************************************************************/ -/* STM32F10x Peripherals Interrupt Handlers */ -/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ -/* available peripheral interrupt handler's name please refer to the startup */ -/* file (startup_stm32f10x_xx.s). */ -/******************************************************************************/ - -/** - * @brief This function handles PPP interrupt request. - * @param None - * @retval None - */ -/*void PPP_IRQHandler(void) -{ -}*/ - -/** - * @} - */ - -/** - * @} - */ - -/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |