Exemplo n.º 1
0
//=========================================================================
//----- (000022EC) --------------------------------------------------------
__myevic__ void GPD_IRQHandler()
{
	if ( GPIO_GET_INT_FLAG( PD, GPIO_PIN_PIN7_Msk ) )
	{
		GPIO_CLR_INT_FLAG( PD, GPIO_PIN_PIN7_Msk );

		if ( gFlags.usb_attached )
		{
			BattProbeCount = 1;

			if ( gFlags.battery_charging )
			{
				Event = 13;
			}
		}
	}
	else if ( GPIO_GET_INT_FLAG( PD, GPIO_PIN_PIN1_Msk ) )
	{
		GPIO_CLR_INT_FLAG( PD, GPIO_PIN_PIN1_Msk );

		if ( gFlags.usb_attached && ( NumBatteries == 1 ) && ( BatteryVoltage >= 414 ) )
		{
			BattProbeCount = 1;

			if ( gFlags.battery_charging )
			{
				Event = 13;
			}
		}
	}
	else if ( GPIO_GET_INT_FLAG( PD, GPIO_PIN_PIN0_Msk ) )
	{
		GPIO_CLR_INT_FLAG( PD, GPIO_PIN_PIN0_Msk );

		if ( ISPRESA75W || ISVTCDUAL || ISCUBOID || ISCUBO200 || ISRX200S || ISRX23 || ISRX300 )
		{
			if ( gFlags.firing || gFlags.probing_ato )
			{
				if ( Event != 28 )
				{
					Event = 28;
					StopFire();
				}
			}
		}
	}
	else if ( GPIO_GET_INT_FLAG( PD, GPIO_PIN_PIN2_Msk|GPIO_PIN_PIN3_Msk ) )
	{
		GPIO_CLR_INT_FLAG( PD, GPIO_PIN_PIN2_Msk|GPIO_PIN_PIN3_Msk );

		if ( dfStatus.wakeonpm )
		{
			gFlags.wake_up = 1;
		}
	}
	else
	{
		PD->INTSRC = PD->INTSRC;
	}
}
//---------------------------------------------------------------------------------------------------------
// GPIO interrupt handler.
//---------------------------------------------------------------------------------------------------------
void GPAB_IRQHandler()
{
	#if(WAKEUP_GPIO_TRG_PA)
	GPIO_CLR_INT_FLAG( PA, GPIO_GET_INT_FLAG( PA, WAKEUP_GPIO_TRG_PA ) );
	#endif
	#if(WAKEUP_GPIO_TRG_PB)
	GPIO_CLR_INT_FLAG( PB, GPIO_GET_INT_FLAG( PB, WAKEUP_GPIO_TRG_PB ) );
	#endif

	NVIC_ClearPendingIRQ(GPAB_IRQn);
}
Exemplo n.º 3
0
void GPB_IRQHandler(void)
{
	int32_t mask;
	int32_t pin;
	uint8_t *RX_PORT_PINS = RX_PORTB_PINS;
	uint32_t cTime,dTime;
	static uint32_t edgeTime[8];
	
	mask = GPIO_GET_INT_FLAG(PB, BIT0|BIT1|BIT6|BIT3|BIT4|BIT5);

	if(mask) {
		GPIO_CLR_INT_FLAG(PB, mask);
	} 
	else {
		PB->INTSRC = PB->INTSRC;
		//printf("Un-expected interrupts.\n");
	}

	pin = PB0|(PB1<<1)|(PB6<<6)|(PB3<<3)|(PB4<<4)|(PB5<<5);

	cTime = micros();   
	
	RX_PIN_CHECK(0,AUX2PIN);
	RX_PIN_CHECK(1,AUX1PIN);
	RX_PIN_CHECK(2,YAWPIN);
	RX_PIN_CHECK(3,PITCHPIN);
	RX_PIN_CHECK(4,ROLLPIN);
	RX_PIN_CHECK(5,THROTTLEPIN);
	//printf("cTime:%d,dTime:%d\n",cTime,dTime);
}
Exemplo n.º 4
0
/**
 * @brief       External INT0 IRQ
 *
 * @param       None
 *
 * @return      None
 *
 * @details     The External INT0 default IRQ, declared in startup_M451Series.s.
 */
void EINT0_IRQHandler(void)
{

    /* To check if PA.0 external interrupt occurred */
    if(GPIO_GET_INT_FLAG(PA, BIT0))
    {
        GPIO_CLR_INT_FLAG(PA, BIT0);
        printf("PA.0 EINT0 occurred.\n");
    }

    /* To check if PD.2 external interrupt occurred */
    if(GPIO_GET_INT_FLAG(PD, BIT2))
    {
        GPIO_CLR_INT_FLAG(PD, BIT2);
        printf("PD.2 EINT0 occurred.\n");
    }

}
Exemplo n.º 5
0
/**
 * @brief       External INT1 IRQ
 *
 * @param       None
 *
 * @return      None
 *
 * @details     The External INT1 default IRQ, declared in startup_M451Series.s.
 */
void EINT1_IRQHandler(void)
{

    /* To check if PB.0 external interrupt occurred */
    if(GPIO_GET_INT_FLAG(PB, BIT0))
    {
        GPIO_CLR_INT_FLAG(PB, BIT0);
        printf("PB.0 EINT1 occurred.\n");
    }

}
Exemplo n.º 6
0
void GPAB_IRQHandler(void)
{
    /* To check if PB.3 interrupt occurred */
    if(GPIO_GET_INT_FLAG(PB, BIT3)) {
        GPIO_CLR_INT_FLAG(PB, BIT3);
        printf("PB.3 INT occurred.\n");
    } else {
        /* Un-expected interrupt. Just clear all PA, PB interrupts */
        PA->ISRC = PA->ISRC;
        PB->ISRC = PB->ISRC;
        printf("Un-expected interrupts.\n");
    }
}
Exemplo n.º 7
0
//----- (00002334) --------------------------------------------------------
__myevic__ void GPE_IRQHandler()
{
	if ( GPIO_GET_INT_FLAG( PE, GPIO_PIN_PIN0_Msk ) )
	{
		GPIO_CLR_INT_FLAG( PE, GPIO_PIN_PIN0_Msk );

		gFlags.wake_up = 1;
	}
	else
	{
		PE->INTSRC = PE->INTSRC;
	}
}
Exemplo n.º 8
0
void GPE_IRQHandler(void)
{
	/* To check if PE.0 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PE, BIT0))
	{
		GPIO_CLR_INT_FLAG(PE, BIT0);
		if(PE0 == 0)
			keyState |= 1 << 7;
		else if(PE0 == 1)
			keyState &= ~(1 << 7);
	}
	KeyDev.Input.data1.value = keyState;
	if(KeyDev.Input.data1.value > 0)
	{
		PA2 = 0;
	}
	else
	{
		PA2 = 1;
	}
}
Exemplo n.º 9
0
/**
 * Wakeup interrupt handler.
 */
void PWRWU_IRQHandler() {
	uint8_t i;
	const Sys_WakeupGPIO_t *gpio;

	if(!(CLK->PWRCTL & CLK_PWRCTL_PDWKIF_Msk)) {
		// Should never happen
		return;
	}

	// Set wakeup source
	for(i = 0; i < 4; i++) {
		gpio = &Sys_wakeupGPIO[i];
		if(GPIO_GET_INT_FLAG(gpio->port, 1 << gpio->pin) && (Sys_wakeupSource & gpio->wakeupMask)) {
			Sys_lastWakeupSource = gpio->wakeupMask;
			break;
		}
	}

	// Clear wakeup interrupt flag
	CLK->PWRCTL |= CLK_PWRCTL_PDWKIF_Msk;
}
Exemplo n.º 10
0
void GPC_IRQHandler(void)
{
	/* To check if PC.0 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT0))
	{
		GPIO_CLR_INT_FLAG(PC, BIT0);
		if(PC0 == 0)
			keyState |= 1;
		else if(PC0 == 1)
			keyState &= ~(1);
	}
	/* To check if PC.1 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT1))
	{
		GPIO_CLR_INT_FLAG(PC, BIT1);
		if(PC1 == 0)
			keyState |= 1 << 1;
		else if(PC1 == 1)
			keyState &= ~(1 << 1);
	}
	/* To check if PC.2 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT2))
	{
		GPIO_CLR_INT_FLAG(PC, BIT2);
		if(PC2 == 0)
			keyState |= 1 << 2;
		else if(PC2 == 1)
			keyState &= ~(1 << 2);
	}
	/* To check if PC.3 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT3))
	{
		GPIO_CLR_INT_FLAG(PC, BIT3);
		if(PC3 == 0)
			keyState |= 1 << 3;
		else if(PC3 == 1)
			keyState &= ~(1 << 3);
	}
	/* To check if PC.4 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT4))
	{
		GPIO_CLR_INT_FLAG(PC, BIT4);
		if(PC4 == 0)
			keyState |= 1 << 4;
		else if(PC4 == 1)
			keyState &= ~(1 << 4);
	}
	/* To check if PC.5 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT5))
	{
		GPIO_CLR_INT_FLAG(PC, BIT5);
		if(PC5 == 0)
			keyState |= 1 << 5;
		else if(PC5 == 1)
			keyState &= ~(1 << 5);
	}
	/* To check if PC.6 interrupt occurred */
	if(GPIO_GET_INT_FLAG(PC, BIT6))
	{
		GPIO_CLR_INT_FLAG(PC, BIT6);
		if(PC6 == 0)
			keyState |= 1 << 6;
		else if(PC6 == 1)
			keyState &= ~(1 << 6);
	}
	KeyDev.Input.data1.value = keyState;
	if(KeyDev.Input.data1.value > 0)
	{
		PA2 = 0;
	}
	else
	{
		PA2 = 1;
	}
}