diff options
Diffstat (limited to 'app/stm32f0xx_it.c')
-rw-r--r-- | app/stm32f0xx_it.c | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/app/stm32f0xx_it.c b/app/stm32f0xx_it.c new file mode 100644 index 0000000..9327bed --- /dev/null +++ b/app/stm32f0xx_it.c @@ -0,0 +1,249 @@ +/** + ****************************************************************************** + * @file Projects\Demonstration\stm32f0xx_it.c + * @author MCD Application Team + * @version V1.0.0 + * @date 17-January-2014 + * @brief Main Interrupt Service Routines. + * This file provides template for all exceptions handler and + * peripherals interrupt service routine. + ****************************************************************************** + * @attention + * + * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> + * + * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); + * You may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.st.com/software_license_agreement_liberty_v2 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ****************************************************************************** + */ + +/* Includes ------------------------------------------------------------------*/ +#include "stm32f0xx_it.h" +#include "stm32f0xx_conf.h" + +#include "ltimers.h" +#include "ltimers_config.h" + +#include "nixie_driver_config.h" +#include "nixie_driver_process.h" +#include "led_driver_process.h" +#include "led_driver_config.h" + +#include "tsl_types.h" +#include "tsl_user.h" +#include "tsl_time_stm32f0xx.h" + + +/** @addtogroup STM32F072B_DISCOVERY + * @{ + */ + +/* Private typedef -----------------------------------------------------------*/ +/* Private define ------------------------------------------------------------*/ +/* Private macro -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ + +/* Private function prototypes -----------------------------------------------*/ +/* Private functions ---------------------------------------------------------*/ + +/******************************************************************************/ +/* Cortex-M0 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 SVCall exception. + * @param None + * @retval None + * @ Используется в файле portasm.s + */ +//void SVC_Handler(void) +//{ +//} + +/** + * @brief This function handles PendSVC exception. + * @param None + * @retval None + * @ Используется в файле portasm.s + */ +//void PendSV_Handler(void) +//{ +//} + +/** + * @brief This function handles SysTick Handler. + * @param None + * @retval None + */ +//void SysTick_Handler(void) +//{ +// TimingDelay_Decrement(); +// TSL_tim_ProcessIT(); +//} + +/******************************************************************************/ +/* STM32F0xx 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_stm32f0xx.s). */ +/******************************************************************************/ + +// ---------------------------------------------------------------------------- +// Обработчик прерывания таймера общего назначения для тиков в 1 мс +// ---------------------------------------------------------------------------- +void LTIMER_IRQHandler ( void ) +{ + if ( TIM_GetITStatus ( LTIMER_TIMx, TIM_IT_Update ) != RESET ) + { + TIM_ClearITPendingBit ( LTIMER_TIMx, TIM_IT_Update ); + + ProcessLTimers (); + } +} + +void TIM17_handler(void) { LTIMER_IRQHandler(); } + + +// ---------------------------------------------------------------------------- +// Обработчик прерывания таймера для работы NixieDriver +// Это прерывание имеет самый высокий приоритет, чтобы обеспечить стабильную +// частоту динамической индикации ламп Nixie +// ---------------------------------------------------------------------------- +void NIX_DRIVER_TIM_IRQHandler ( void ) +{ + if ( TIM_GetITStatus ( NIX_DRIVER_TIMx, TIM_IT_Update ) != RESET ) + { + TIM_ClearITPendingBit ( NIX_DRIVER_TIMx, TIM_IT_Update ); + + ProcessNixieDriverFromISR (); + } +} + +void TIM16_handler(void) { NIX_DRIVER_TIM_IRQHandler(); } + + +// ---------------------------------------------------------------------------- +// Обработчик прерывания таймера для работы LED_Driver +// ---------------------------------------------------------------------------- +void LED_TIM_IRQHandler ( void ) +{ + if ( TIM_GetITStatus ( LED_TIMx, TIM_IT_Update ) != RESET ) + { + TIM_ClearITPendingBit ( LED_TIMx, TIM_IT_Update ); + + LEDDriverProcessFromISR (); + } +} + +void TIM3_handler(void) { LED_TIM_IRQHandler(); } + + +// ---------------------------------------------------------------------------- +// - поставить этому прерыванию наивысший приоритет, чтобы передавать 2 байта +// подряд гарантированно без промежутка времени (или не так важно? может ли +// между двумя байтами задержка повлиять на вывод данных на лампы?) +// ---------------------------------------------------------------------------- + +void NIX_SPIx_IRQHandler ( void ) +{ + /* SPI in Master Receiver mode--------------------------------------- */ + if ( SPI_I2S_GetITStatus ( NIX_SPIx, SPI_I2S_IT_TXE ) == SET ) + { + // Обязательно надо считать, чтобы сбросить флаг + SPI_I2S_ReceiveData16 ( NIX_SPIx ); + SPI_I2S_ITConfig ( NIX_SPIx, SPI_I2S_IT_TXE, DISABLE ); + //NixieDriverCheckDPPins(); + NIX_DRIVER_SET_ST_PIN; + } +} + +void SPI1_handler(void) { NIX_SPIx_IRQHandler(); } + + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +#ifdef LED_DRIVER +void LED_SPIx_IRQHandler ( void ) +{ + /* SPI in Master Receiver mode--------------------------------------- */ + if ( SPI_I2S_GetITStatus ( LED_SPIx, SPI_I2S_IT_RXNE ) == SET ) + { + //empty_data = SPI_I2S_ReceiveData16 ( LED_SPIx ); + // Обязательно надо считать, чтобы сбросить флаг + SPI_I2S_ReceiveData16 ( LED_SPIx ); + LED_ST_PIN_SET; + } +} + +void SPI2_handler(void) { LED_SPIx_IRQHandler(); } +#endif + + +// ---------------------------------------------------------------------------- +/** + * @brief This function handles Touch Sensing Controller Handler. + * @param None + * @retval None + */ +// ---------------------------------------------------------------------------- +extern __IO uint32_t Gv_EOA; + +void TSC_IRQHandler ( void ) +{ +#if TSLPRM_TSC_IODEF > 0 // Default = Input Floating + /* Set IO default in Output PP Low to discharge all capacitors */ + TSC->CR &= (uint32_t)(~(1 << 4)); +#endif + TSC->ICR |= 0x03; /* Clear EOAF and MCEF flags */ + Gv_EOA = 1; /* To inform the main loop routine of the End Of Acquisition */ +} + +void TSC_handler(void) { TSC_IRQHandler(); } + + +// ---------------------------------------------------------------------------- +// +// ---------------------------------------------------------------------------- +void TS_TIM_IRQHandler ( void ) +{ + TIM_ClearITPendingBit ( TS_TIMx, TIM_IT_Update ); + TSL_tim_ProcessIT(); +} + +void TIM15_handler(void) { TS_TIM_IRQHandler(); } + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |