diff options
Diffstat (limited to 'tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask')
3 files changed, 0 insertions, 516 deletions
diff --git a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/main.c b/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/main.c deleted file mode 100644 index faa11de..0000000 --- a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/main.c +++ /dev/null @@ -1,219 +0,0 @@ -/** - ****************************************************************************** - * @file NVIC/IRQ_Mask/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" -#include "stm32_eval.h" - -/** @addtogroup STM32F10x_StdPeriph_Examples - * @{ - */ - -/** @addtogroup IRQ_Mask - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -void TIM_Config(void); - -/* 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 - */ - - /* Initialize Leds mounted on STM3210X-EVAL board */ - STM_EVAL_LEDInit(LED1); - STM_EVAL_LEDInit(LED2); - STM_EVAL_LEDInit(LED3); - STM_EVAL_LEDInit(LED4); - - /* Initialize the KEY and WAKEUP buttons mounted on STM3210X-EVAL board */ - STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_GPIO); - STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI); - - /* TIM configuration -------------------------------------------------------*/ - TIM_Config(); - - while (1) - { - /* Wait until KEY button is pressed. */ - while(STM_EVAL_PBGetState(BUTTON_KEY) == RESET) - { - } - while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET) - { - } - - /* This instruction raises the execution priority to 0. This prevents all - exceptions with configurable priority from activating, other than through - the HardFault fault escalation mechanism. */ - __disable_irq(); - - /* Turn LED4 ON */ - STM_EVAL_LEDOn(LED4); - - /* Wait until KEY button is pressed. */ - while(STM_EVAL_PBGetState(BUTTON_KEY) == RESET) - { - } - while(STM_EVAL_PBGetState(BUTTON_KEY) != RESET) - { - } - - /* This instruction will allow all exceptions with configurable priority to - be activated. */ - __enable_irq(); - - /* Turn LED4 OFF */ - STM_EVAL_LEDOff(LED4); - } -} - -/** - * @brief Configures the used Timers. - * @param None - * @retval None - */ -void TIM_Config(void) -{ - TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; - TIM_OCInitTypeDef TIM_OCInitStructure; - NVIC_InitTypeDef NVIC_InitStructure; - - /* Enable TIM2, TIM3 and TIM4 clocks */ - RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | - RCC_APB1Periph_TIM4, ENABLE); - - /* TIM2 configuration */ - TIM_TimeBaseStructure.TIM_Period = 0x4AF; - TIM_TimeBaseStructure.TIM_Prescaler = ((SystemCoreClock/1200) - 1); - TIM_TimeBaseStructure.TIM_ClockDivision = 0x0; - TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; - TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure); - TIM_OCStructInit(&TIM_OCInitStructure); - - /* Output Compare Timing Mode configuration: Channel1 */ - TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Timing; - TIM_OCInitStructure.TIM_Pulse = 0x0; - TIM_OC1Init(TIM2, &TIM_OCInitStructure); - - /* TIM3 configuration */ - TIM_TimeBaseStructure.TIM_Period = 0x95F; - TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); - - /* Output Compare Timing Mode configuration: Channel1 */ - TIM_OC1Init(TIM3, &TIM_OCInitStructure); - - /* TIM4 configuration */ - TIM_TimeBaseStructure.TIM_Period = 0xE0F; - TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); - - /* Output Compare Timing Mode configuration: Channel1 */ - TIM_OC1Init(TIM4, &TIM_OCInitStructure); - - /* Immediate load of TIM2,TIM3 and TIM4 Precaler values */ - TIM_PrescalerConfig(TIM2, ((SystemCoreClock/1200) - 1), TIM_PSCReloadMode_Immediate); - TIM_PrescalerConfig(TIM3, ((SystemCoreClock/1200) - 1), TIM_PSCReloadMode_Immediate); - TIM_PrescalerConfig(TIM4, ((SystemCoreClock/1200) - 1), TIM_PSCReloadMode_Immediate); - - /* Clear TIM2, TIM3 and TIM4 update pending flags */ - TIM_ClearFlag(TIM2, TIM_FLAG_Update); - TIM_ClearFlag(TIM3, TIM_FLAG_Update); - TIM_ClearFlag(TIM4, TIM_FLAG_Update); - - /* Configure two bits for preemption priority */ - NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); - - /* Enable the TIM2 Interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; - NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); - - /* Enable the TIM3 Interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; - NVIC_Init(&NVIC_InitStructure); - - /* Enable the TIM4 Interrupt */ - NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn; - NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; - NVIC_Init(&NVIC_InitStructure); - - /* Enable TIM2, TIM3 and TIM4 Update interrupts */ - TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE); - TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE); - TIM_ITConfig(TIM4, TIM_IT_Update, ENABLE); - - /* TIM2, TIM3 and TIM4 enable counters */ - TIM_Cmd(TIM2, ENABLE); - TIM_Cmd(TIM3, ENABLE); - TIM_Cmd(TIM4, ENABLE); -} - - -#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/NVIC/IRQ_Mask/stm32f10x_it.c b/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/stm32f10x_it.c deleted file mode 100644 index 54a55c6..0000000 --- a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/stm32f10x_it.c +++ /dev/null @@ -1,247 +0,0 @@ -/** - ****************************************************************************** - * @file NVIC/IRQ_Mask/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" -#include "stm32_eval.h" - -/** @addtogroup STM32F10x_StdPeriph_Examples - * @{ - */ - -/** @addtogroup IRQ_Mask - * @{ - */ - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -__IO uint32_t index = 0; - -/* 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 */ -/******************************************************************************/ - -/** - * @brief This function handles EXTI Lines 0 interrupt request. - * @param None - * @retval None - */ -void EXTI0_IRQHandler(void) -{ - if(EXTI_GetITStatus(WAKEUP_BUTTON_EXTI_LINE) != RESET) - { - if(index == 0) - { - /* Configure the BASEPRI register to 0x40 (Preemption priority = 1). - Only IRQ with higher preemption priority than 1 are permitted. - This will mask TIM3 and TIM4 IRQ from generation. */ - __set_BASEPRI(0x40); - index++; - } - else - { - /* Configure the BASEPRI register to 0x00 (Preemption priority = 0). - When this BASEPRI register is set to 0, it has no effect on the current - priority. - TIM2, TIM3 and TIM4 generation is controlled by NVIC priority registers. */ - __set_BASEPRI(0x00); - index = 0; - } - /* Clears the SEL Button EXTI line pending bits. */ - EXTI_ClearITPendingBit(WAKEUP_BUTTON_EXTI_LINE); - } -} - -/** - * @brief This function handles TIM2 global interrupt request. - * @param None - * @retval None - */ -void TIM2_IRQHandler(void) -{ - /* Clear TIM2 update interrupt */ - TIM_ClearITPendingBit(TIM2, TIM_IT_Update); - - /* Toggle LED1 */ - STM_EVAL_LEDToggle(LED1); -} - -/** - * @brief This function handles TIM3 global interrupt request. - * @param None - * @retval None - */ -void TIM3_IRQHandler(void) -{ - /* Clear TIM3 update interrupt */ - TIM_ClearITPendingBit(TIM3, TIM_IT_Update); - - /* Toggle LED2 */ - STM_EVAL_LEDToggle(LED2); -} - -/** - * @brief This function handles TIM4 global interrupt request. - * @param None - * @retval None - */ -void TIM4_IRQHandler(void) -{ - /* Clear TIM4 update interrupt */ - TIM_ClearITPendingBit(TIM4, TIM_IT_Update); - - /* Toggle LED3 */ - STM_EVAL_LEDToggle(LED3); -} - -/******************************************************************************/ -/* 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****/ diff --git a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/stm32f10x_it.h b/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/stm32f10x_it.h deleted file mode 100644 index cceaa0e..0000000 --- a/tmp/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/NVIC/IRQ_Mask/stm32f10x_it.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * @file NVIC/IRQ_Mask/stm32f10x_it.h - * @author MCD Application Team - * @version V3.5.0 - * @date 08-April-2011 - * @brief This file contains the headers of the interrupt handlers. - ****************************************************************************** - * @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> - ****************************************************************************** - */ - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef __STM32F10x_IT_H -#define __STM32F10x_IT_H - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f10x.h" - -/* Exported types ------------------------------------------------------------*/ -/* Exported constants --------------------------------------------------------*/ -/* Exported macro ------------------------------------------------------------*/ -/* Exported functions ------------------------------------------------------- */ - -void NMI_Handler(void); -void HardFault_Handler(void); -void MemManage_Handler(void); -void BusFault_Handler(void); -void UsageFault_Handler(void); -void SVC_Handler(void); -void DebugMon_Handler(void); -void PendSV_Handler(void); -void SysTick_Handler(void); -void EXTI0_IRQHandler(void); -void TIM2_IRQHandler(void); -void TIM3_IRQHandler(void); -void TIM4_IRQHandler(void); - -#endif /* __STM32F10x_IT_H */ - -/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |