/**
* @brief  This function handles External lines 9 to 5 interrupt request.
* @param  None
* @retval None
*/
void EXTI9_5_IRQHandler(void)
{  
  /* Check the flag status of EXTI line */
  if(EXTI_GetFlagStatus(UP_BUTTON_V2_EXTI_LINE))
  {    
    Set_UPStatus();
    /* Clear the EXTI line flag */
    EXTI_ClearFlag(UP_BUTTON_V2_EXTI_LINE);
  }
  if(EXTI_GetFlagStatus(LEFT_BUTTON_V3_EXTI_LINE))
  {    
    Set_UPStatus();
    /* Clear the EXTI line flag */
    EXTI_ClearFlag(LEFT_BUTTON_V3_EXTI_LINE);
  }
  /* Check the flag status of EXTI line */
  if(EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE))
  {    
    Set_KeyStatus();
    /* Clear the EXTI line flag */
    EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
  }
  if(EXTI_GetITStatus(SCM_PS_BUTTON_EXTI_LINE))
  {
    Set_KeyStatus();
    /* Clear the EXTI line flag */
    EXTI_ClearITPendingBit(SCM_PS_BUTTON_EXTI_LINE);
  }
  
}
Example #2
0
/**
  * @brief  This function handles PPP interrupt request.
  * @param  None
  * @retval None
  */
void EXTI15_10_IRQHandler(void)
{
  /* Check if the Key push button has been pushed */
  if (EXTI_GetFlagStatus(KEY_BUTTON_EXTI_LINE) != RESET)
  {
    if ((ActionState == ACTION_NONE) && (RecieverMode == STATE_OFF))
    {
      ActionState = BUTTON_KEY;
    }

    /* Clear the interrupt pending bit */
    EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
  }

  /* Check if the Key push button has been pushed */
  if (EXTI_GetFlagStatus(TAMPER_BUTTON_EXTI_LINE) != RESET)
  {
    if ((ActionState == ACTION_NONE) && (RecieverMode == STATE_OFF))
    {
      ActionState = BUTTON_TAMPER;
    }

    /* Clear the interrupt pending bit */
    EXTI_ClearITPendingBit(TAMPER_BUTTON_EXTI_LINE);
  }
}
Example #3
0
void EXTI9_5_IRQHandler(void)
{
  if(EXTI_GetFlagStatus(EXTI_Line5)==1)
  {
    Exti5count++;
    if(Exti5count%2)
    {
      GPIO_SetBits(LED_3_6_GRP, LED5);
    }
    else 
    {
      GPIO_ResetBits(LED_3_6_GRP, LED5);
    }
    
    EXTI_ClearITPendingBit(EXTI_Line5);
  }
   if(EXTI_GetFlagStatus(EXTI_Line6)==1)
  {
    Exti6count++;
    if(Exti6count%2)
    {
      GPIO_SetBits(LED_3_6_GRP, LED6);
    }
    else 
    {
      GPIO_ResetBits(LED_3_6_GRP, LED6);
    }
   
    EXTI_ClearITPendingBit(EXTI_Line6);
  }
}
Example #4
0
/**
* @brief  This function handles External interrupt request (associated with Spirit GPIO 3).
* @param  None
* @retval None
*/
void M2S_GPIO_3_EXTI_IRQ_HANDLER(void)
{
  /* control the EXTI flag */
  if(EXTI_GetFlagStatus(M2S_GPIO_3_EXTI_LINE))
  {
    /* read the IRQ status bytes */
    SpiritIrqGetStatus(&xIrqStatus);
    
    /* set flags according to the raised IRQ*/
    if(xIrqStatus.IRQ_TX_DATA_SENT)
    {
      xTxDoneFlag = SET;
      SdkEvalLedToggle(LED1);
    }
    if(xIrqStatus.IRQ_RX_DATA_READY)
    {
      xRxDoneFlag = SET;
      SdkEvalLedToggle(LED2);
    }
    if(xIrqStatus.IRQ_RX_DATA_DISC)
    {
      SpiritCmdStrobeRx();
      SdkEvalLedToggle(LED3);
    }
    
    /* clear the EXTI flag */
    EXTI_ClearFlag(M2S_GPIO_3_EXTI_LINE);
  }
}
Example #5
0
void EXTI9_5_IRQHandler(void)
{

    if (EXTI_GetFlagStatus(EXTI_Line7) == SET)
    {
        EXTI_ClearITPendingBit(EXTI_Line7);
//        stepper_stop();//stepper_set_forward();
    }

    if (EXTI_GetFlagStatus(EXTI_Line9) == SET)
    {
        EXTI_ClearITPendingBit(EXTI_Line9);
//        stepper_stop();//stepper_set_backward();
    }

}
Example #6
0
void EXTI9_5_IRQHandler(void)
#endif /* USE_STM322xG_EVAL */
{
  static uint8_t FallingEdge = 0;
  
  /* Check if the interrupt source is the KEY EXTI line */
  if (EXTI_GetFlagStatus(KEY_BUTTON_EXTI_LINE) == SET)
  {
    /* Check if the push button is pushed or released (to ignore the button released event) */
    if (FallingEdge == 0)
    {
      /* Switch the output target between Speaker and Headphone */
      OutputState = (OutputState == OUTPUT_DEVICE_SPEAKER)? \
                    OUTPUT_DEVICE_HEADPHONE : OUTPUT_DEVICE_SPEAKER;
    
    /* Increment the variable to indicate that next interrupt corresponds to push
    button released event: Release event should be ignored */
    FallingEdge++;
    }
    else
    {
      /* Reset the variable to indicate that the next interrupt corresponds to push
      button pushed event. */
      FallingEdge = 0;
    }
    
    /* Clear the interrupt line flag */
    EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
  }
}
/**
 * ext irq handler
 *
 * Handles the gpio interrupt attached to a gpio pin.
 *
 * @param index
 */
static void
ext_irq_handler(int index)
{
    if (EXTI_GetFlagStatus(index) != RESET) {
        EXTI_ClearFlag(index);
        gpio_irq_handlers[index].isr(gpio_irq_handlers[index].arg);
    }
}
Example #8
0
/**
* @brief  This function handles External interrupt request (associated with the KEY_BUTTON).
* @param  None
* @retval None
*/
void KEY_BUTTON_EXTI_IRQ_HANDLER(void)
{
  /* Use this ISR to corrupt the data flow in order to stop the test */
  if(EXTI_GetFlagStatus(KEY_BUTTON_EXTI_LINE))
  {
    vectcBallBuff[14]=3;
    SdkEvalLedToggle(LED3);
    EXTI_ClearFlag(KEY_BUTTON_EXTI_LINE);
  }
}
Example #9
0
/**
  * @brief  This function handles EXTI9_5 interrupt request.
  * @param  None
  * @retval None
  */
void EXTI9_5_IRQHandler(void)
{
#if defined (USE_STM32100E_EVAL) || defined(USE_STM3210C_EVAL)  
  /* Check if the Key push button has been pushed */
  if (EXTI_GetFlagStatus(KEY_BUTTON_EXTI_LINE) != RESET)  
  {
    if (((ActionState == ACTION_NONE) && (DeviceMode == MASTER)) || ((LastMode == SLAVE) && (DeviceMode == SLAVE)))
    {
      ActionState = BUTTON_KEY;
    }
    
    /* Clear the interrupt pending bit */
    EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
  }
#endif /* USE_STM32100E_EVAL || USE_STM3210C_EVAL */
  
#ifdef USE_STM32L152D_EVAL
  /* Check if the Left push button has been pushed */
  if (EXTI_GetFlagStatus(LEFT_BUTTON_EXTI_LINE) != RESET)  
  {
    if (((ActionState == ACTION_NONE) && (DeviceMode == MASTER)) || ((LastMode == SLAVE) && (DeviceMode == SLAVE)))
    {
      ActionState = BUTTON_TAMPER;
    }
    
    /* Clear the interrupt pending bit */
    EXTI_ClearITPendingBit(LEFT_BUTTON_EXTI_LINE);
  }
  
  /* Check if the Right push button has been pushed */
  if (EXTI_GetFlagStatus(RIGHT_BUTTON_EXTI_LINE) != RESET)  
  {
    if (((ActionState == ACTION_NONE) && (DeviceMode == MASTER)) || ((LastMode == SLAVE) && (DeviceMode == SLAVE)))
    {
      ActionState = BUTTON_KEY;
    }
    
    /* Clear the interrupt pending bit */
    EXTI_ClearITPendingBit(RIGHT_BUTTON_EXTI_LINE);
  }
#endif /* USE_STM32L152D_EVAL */   
}
Example #10
0
void __attribute__ ((interrupt)) __cs3_isr_exti15_10(void)
{
    uint8_t i;
    uint32_t bitmask = (0x0001<<10);
    for(i=10;i<=15;i++)
    {
	if(RESET != EXTI_GetFlagStatus(bitmask))
	{
	    exti_isr[i]();
	}
	bitmask <<= 1;
    }
}
Example #11
0
/**
 * Obsluga przerwania przycisku TOGGLE
 *
 */
void EXTI0_1_IRQHandler() {

	// przycisk toggle
	if (EXTI_GetFlagStatus(EXTI_Line0)) {
		// wylaczenie dalszych przerwan az mina drgania stykow
		NVIC_DisableIRQ(EXTI0_1_IRQn);
		// ustawienie timera do odliczania czasu drgan
		timerKey1=sysTicks;
		// ustawienie flagi wcisniecia przycisku
		TOGGLE_Button=1;
		// wyczyszczenie flagi przerwania
		EXTI_ClearFlag(EXTI_Line0);
	}
}
Example #12
0
static int gpioh_get_int_flag( elua_int_id id, elua_int_resnum resnum, int clear )
{
  int flag = 0;
  u32 mask =  1 << exint_gpio_to_src( resnum );

  if( EXTI_GetFlagStatus( exti_line[ exint_gpio_to_src( resnum ) ] ) == SET )
  {
    if( id == INT_GPIO_POSEDGE )
      flag = ( EXTI->RTSR & mask ) != 0;
    else
      flag = ( EXTI->FTSR & mask ) != 0;
  }
  if( flag && clear )
    EXTI_ClearFlag( exti_line[ exint_gpio_to_src( resnum ) ] );
  return flag;
}
/**
* @brief  This function handles External lines 15 to 10 interrupt request.
* @param  None
* @retval None
*/
void EXTI15_10_IRQHandler(void)
{  
  /* Check the flag status of EXTI line 10 */
  if(EXTI_GetITStatus(M2S_GPIO_3_EXTI_LINE))
  {    
    WMBus_PhyInterruptHandler();
    /* Clear the EXTI line 10 flag */
    EXTI_ClearITPendingBit(M2S_GPIO_3_EXTI_LINE); 
  }
  /* Check the flag status of EXTI line */
  if(EXTI_GetFlagStatus(UP_BUTTON_V3_EXTI_LINE))
  {    
    Set_UPStatus();
    /* Clear the EXTI line flag */
    EXTI_ClearFlag(UP_BUTTON_V3_EXTI_LINE);
  }
}
Example #14
0
void M2S_GPIO_0_EXTI_IRQ_HANDLER(void)
{
  if(EXTI_GetFlagStatus(M2S_GPIO_0_EXTI_LINE))
  {
    SpiritIrqGetStatus(&xIrqStatus); // Get the IRQ status
          if(xIrqStatus.IRQ_RX_DATA_DISC)  // Check the SPIRIT1 RX_DATA_DISC IRQ flag 
        {
  //        SdkEvalLedToggle(LED_YELLOW);  // IRQ: Spirit1 RX data discarded (upon filtering)
        }
    // Check the SPIRIT TX_DATA_SENT IRQ flag
    if(xIrqStatus.IRQ_TX_DATA_SENT)
    {
      // Set the xTxDoneFlag to manage processing of this event in the main()  
      xTxDoneFlag = SET;
      SdkEvalLedToggle(LED_GREEN);
    }
    if(xIrqStatus.IRQ_TX_FIFO_ERROR)
    {
      //   
      xTxDoneFlag = SET;
//      SdkEvalLedToggle(LED_GREEN);
    }
    if(xIrqStatus.IRQ_RX_DATA_READY)
    {
      command_size = SpiritLinearFifoReadNumElementsRxFifo();  //get the size of received command
      SpiritSpiReadLinearFifo(command_size, command_buffer);    //read the buffer
      SpiritCmdStrobeFlushRxFifo();     //flush the RX fifo
      SdkEvalLedToggle(LED_YELLOW);
//      SpiritCmdStrobeRx();
      command_pending = 1;
    }
    
    // Clear the EXTI line flag
   
    EXTI_ClearFlag(M2S_GPIO_0_EXTI_LINE);
  }
} // end of M2S_GPIO_0_EXTI_IRQ_HANDLER()
Example #15
0
//===========================================
void EXTI1_IRQHandler(void)
{
	if(EXTI_GetFlagStatus(EXTI_Line1) == SET)
	{
		u8 i = 0,j = 0;
		static u8 sec_count = 0;
		static u16 bat_count = 0;
		static u8 current_sec = 0;
		
		sec_count ++;
		if(networkStatus != NETWORK_LOST)
		{
			connTimeout ++;
			if(connTimeout == CONNECTION_TIMEOUT)
			{
				networkStatus = NETWORK_LOST;
				event = EVENT_NETWORK_LOST;
				sysStatus |= SYSTEM_ERR_NETWORK;
				displayStatus(sysStatus);
				sendResponse(CMD_REQUEST_RECONNECT,CMD_REQUEST_RECONNECT);
				connTimeout = 0;
			}
		}
		else //network lost
		{
			if(!fEthernetHardReseted)
				{
					u32 i = 0;
					
					GPIO_InitTypeDef GPIO_InitStructure;
					GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
					GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
					GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
					GPIO_Init(GPIOB, &GPIO_InitStructure);
					GPIO_WriteBit(ETHERNET_RESET_PORT, ETHERNET_RESET_PIN,Bit_SET); 
					
					for(i=0;i<10000;i++) __NOP;
					
					GPIO_WriteBit(ETHERNET_RESET_PORT, ETHERNET_RESET_PIN,Bit_RESET);
					fEthernetHardReseted = true;
				}
		}
		

		// Check if SDC error in running time
		if(sysStatus & SYSTEM_ERR_SDC)
		{
			// Try to reinit SDC
			initSDC();
			// If SDC still not avaiable then reset system
			if(sysStatus & SYSTEM_ERR_SDC)
			{
				if(!fSdcErr)
					NVIC_SystemReset();
			}
			else
			{
				fSdcErr = false;
				displayStatus(sysStatus);
			}	
		}
		
		
		if(sec_count == 60)
		{
			sec_count = 0;
			bat_count ++;
			if(bat_count == 5)
			{
				u16 adc_value = 0;
				u32 battery_volt = 0;
				u32 power_volt = 0;
				
				adc_value = ADC_GetConversionValue(ADC1);
				battery_volt = ((adc_value*33*62/4096)/15);
				if(battery_volt < BATTERY_VOLT_EMPTY)
				{
					GPIO_WriteBit(CHARGE_PORT,CHARGE_PIN,Bit_RESET);
				}
				else if(battery_volt >= BATTERY_VOLT_FULL)
				{
					GPIO_WriteBit(CHARGE_PORT,CHARGE_PIN,Bit_SET);
				}
				adc_value = ADC_GetConversionValue(ADC2);
				power_volt = ((adc_value*33*62/4096)/15);
				if(power_volt < BATTERY_VOLT_FULL)
				{
					//sendWarning(WARNING_OUT_OF_POWER);
//					fWarning = true;
//					warning = WARNING_OUT_OF_POWER;
				}
				bat_count = 0;
			}
			rtS = DS1307_GetTime();
			for(i = 0;i<page->header.itemCount;i++)
			{
				PLAYLIST_ITEM* playlist = (PLAYLIST_ITEM*)page->popup[i].Info.data;
				
				if((playlist[0].header.dataType == PLAYLIST_CLOCK)||(playlist[0].header.dataType == PLAYLIST_TEMP))
					page->popup[i].Info.header.isUpdate = false;
			}
			
			sysTemp = Read_Temperature();
			if(sysTemp > wnConfig.maxTemp)
			{
				//sendWarning(WARNING_TOO_HOT);
				//fWarning = true;
				//warning = WARNING_TOO_HOT;
			}			
		}
		for(i = 0;i<page->header.itemCount;i++)
		{
			if(page->popup[i].Info.header.dataType == POPUP_PLAYLIST)
			{
				PLAYLIST_ITEM* playlist = (PLAYLIST_ITEM*)page->popup[i].Info.data;
				
				if((page->popup[i].Info.header.isUpdate)&&(page->popup[i].Info.header.countDown))
				{
					page->popup[i].Info.header.countDown --;
					if(!page->popup[i].Info.header.countDown)
						page->popup[i].Info.header.isUpdate = false;
				}
				for(j = 0;j<page->popup[i].Info.header.itemCount;j++)
				{
					if((playlist[j].TTL_count < 0xFFFF)&&(playlist[j].TTL_count>0))
						playlist[j].TTL_count --;					
				}
			}
		}
		EXTI_ClearFlag(EXTI_Line1);
	}
}