void PORTCD_IRQHandler(void)
#endif
{
    /* Clear interrupt flag.*/
    PORT_HAL_ClearPortIntFlag(PORTC_BASE_PTR);
    PORT_HAL_ClearPortIntFlag(PORTD_BASE_PTR);
    
    /* Invoke PHY IRQ handler specific function */
    SMARTCARD_DRV_NCN8025IRQHandler(BOARD_SMARTCARD_UART_INSTANCE);
}
예제 #2
0
파일: Events.c 프로젝트: Btar/HEXIWEAR
void PORTC_IRQHandler(void)
{
	PORT_HAL_ClearPortIntFlag(PORTC_BASE_PTR);

	watch_CheckBatteryStatus();

	RTC_UpdateAlarm();

	if ( true == FXOS_IsTapEnabled() )
	{
		switch ( power_GetCurrentMode() )
		{
			case POWER_CURRENT_MODE_NORMAL:
			{
				// regular work mode, do nothing
				break;
			}

			// if we were in shallow sleep mode, just turn the OLED ON
			case POWER_CURRENT_MODE_SLEEP_SHALLOW:
			{
				HostInterface_SetWakingTouch();
				power_SetCurrentMode( POWER_CURRENT_MODE_NORMAL );
				break;
			}

			case POWER_CURRENT_MODE_SLEEP_TOTAL:
			{
				HostInterface_SetWakingTouch();
				power_SetCurrentMode( POWER_CURRENT_MODE_NORMAL );

				if ( POWER_STATUS_SUCCESS != power_SetWakeSource( POWER_WAKE_SRC_USER ) )
				{
					asm("nop");
				}
				break;
			}

			/**
			 * special consideration is also required for the sensor tag sleep mode,
			 * since we might not be actually sleeping when UART interrupt occurs
			 */

			case POWER_CURRENT_MODE_SLEEP_SENSOR_TAG:
			{
				HostInterface_SetWakingTouch();
				power_SetCurrentMode( POWER_CURRENT_MODE_NORMAL );

				if ( POWER_STATUS_SUCCESS == power_SetWakeSource( POWER_WAKE_SRC_USER ) )
				{
				}
				else
				{
					asm("nop");
				}
				break;
			}
		}
	}
}
예제 #3
0
파일: Events.c 프로젝트: Btar/HEXIWEAR
void PORTD_IRQHandler(void)
{
  PORT_HAL_ClearPortIntFlag(PORTD_BASE_PTR);

  if(haptic_MutexLock(0) == kStatus_OSA_Success)
  {
	  GPIO_DRV_ClearPinOutput( KW40_GPIO );
	  OSA_TimeDelay(1);
	  GPIO_DRV_SetPinOutput( KW40_GPIO );
	  haptic_MutexUnlock();
  }
}
예제 #4
0
/*!
 * @brief gpio IRQ handler with the same name in startup code
 */
void BOARD_SDHC_CD_GPIO_IRQ_HANDLER(void)
{
    PORT_Type * gpioBase = g_portBase[GPIO_EXTRACT_PORT(kGpioSdhc0Cd)];
    uint32_t pin = GPIO_EXTRACT_PIN(kGpioSdhc0Cd);

    if(PORT_HAL_GetPortIntFlag(gpioBase) == (1 << pin))
    {
        sdhc_card_detection();
    }
    /* Clear interrupt flag.*/
    PORT_HAL_ClearPortIntFlag(gpioBase);
}
예제 #5
0
/*!
 * @brief gpio IRQ handler with the same name in startup code
 */
void SDCARD_CD_GPIO_IRQ_HANDLER(void)
{
    PORT_Type * gpioBase = g_portBase[GPIO_EXTRACT_PORT(kGpioSdcardCardDetection)];
    uint32_t pin = GPIO_EXTRACT_PIN(kGpioSdcardCardDetection);

    if(PORT_HAL_GetPortIntFlag(gpioBase) == (1 << pin))
    {
        spiSDcard_card_detection();
    }
    /* Clear interrupt flag.*/
    PORT_HAL_ClearPortIntFlag(gpioBase);
}
void PTx_IRQHandler(void)
{
    for(uint32_t i=0; i < PORT_INSTANCE_COUNT; i++)
    {
        if (CLOCK_SYS_GetPortGateCmd(i))
        {
            /* Add user-defined ISR for PORT. */

            /* Clear interrupt flag.*/
            PORT_HAL_ClearPortIntFlag(g_portBase[i]);
        }
    }
}
예제 #7
0
파일: Events.c 프로젝트: mmittek/EFI
/*
** ===================================================================
**     Interrupt handler : PORTC_IRQHandler
**
**     Description :
**         User interrupt service routine. 
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void PORTC_IRQHandler(void)
{
	if (GPIO_DRV_IsPinIntPending(VRS0)) {
			//GPIO_DRV_ClearPinOutput(PTE24);
			ECU_VRS0_Event();
	}

	if(GPIO_DRV_IsPinIntPending(VRS1)) {
		//GPIO_DRV_SetPinOutput(PTE24);
//		  GPIO_DRV_TogglePinOutput( PTE24 );
		ECU_VRS1_Event();

	}

	/* Clear interrupt flag.*/
  PORT_HAL_ClearPortIntFlag(PORTC_BASE_PTR);
  /* Write your code here ... */
}
예제 #8
0
파일: main.c 프로젝트: TheDukeZip/ahabadge
void PORTA_IRQHandler(void)
{
    /* Clear interrupt flag.*/
    PORT_HAL_ClearPortIntFlag(PORTA_BASE_PTR);

    if (GPIO_DRV_ReadPinInput(g_switch1.pinName)) {
        TPM_DRV_PwmStop(0, &param, 3);
        PIT_DRV_StopTimer(0, 0);
    } else {
        position = 0;
        PIT_DRV_StartTimer(0, 0);
    }

    if (GPIO_DRV_ReadPinInput(g_switch2.pinName)) {
        LPUART_DRV_AbortSendingData(1);
        laser_on = 0;
    } else {
        laser_on = 1;
    }

    if (!GPIO_DRV_ReadPinInput(g_switchUp.pinName)) {
        txBuff[0] = 'R';
    }
    if (!GPIO_DRV_ReadPinInput(g_switchLeft.pinName)) {
        txBuff[0] = 'G';
    }
    if (!GPIO_DRV_ReadPinInput(g_switchRight.pinName)) {
        txBuff[0] = 'B';
    }
    if (!GPIO_DRV_ReadPinInput(g_switchDown.pinName)) {
        txBuff[0] = 'T';
    }
    if (!GPIO_DRV_ReadPinInput(g_switchSelect.pinName)) {
        cue_next_image = 1;
    }
}
예제 #9
0
파일: main.c 프로젝트: cjc1029nice/ksdk
/*!
 * @brief IRQ handler for switch/button.
 */
void BOARD_SW_LLWU_IRQ_HANDLER(void)
{
    PORT_HAL_ClearPortIntFlag(BOARD_SW_LLWU_BASE);
}
예제 #10
0
파일: Events.c 프로젝트: Btar/HEXIWEAR
void PORTB_IRQHandler(void)
{
  PORT_HAL_ClearPortIntFlag(PORTB_BASE_PTR);
  /* Write your code here ... */
}
예제 #11
0
파일: lab2.c 프로젝트: EmbeddedRepo/FTF_15
void PORTC_IRQHandler(void)
{
	// Clear the interrupt flag.
    PORT_HAL_ClearPortIntFlag(PORTC);
}
예제 #12
0
파일: Events.c 프로젝트: Btar/HEXIWEAR
void PORTD_IRQHandler(void)
{
	PORT_HAL_ClearPortIntFlag(PORTD_BASE_PTR);
}
예제 #13
0
파일: Events.c 프로젝트: Btar/HEXIWEAR
void PORTB_IRQHandler(void)
{
  PORT_HAL_ClearPortIntFlag(PORTB_BASE_PTR);
  MotionDetect();
}
//PTD2_UART_rx, PTD3_UART_tx
//PTC1,2,3,4
int main (void)
{
    memcpy(packet_upper_PC.trans_header, trans_header_table, sizeof(trans_header_table));
    // RX buffers
    //! @param receiveBuff Buffer used to hold received data
    uint8_t receiveBuff;

    // Initialize standard SDK demo application pins
    hardware_init();
    OSA_Init();
    // Call this function to initialize the console UART. This function
    // enables the use of STDIO functions (printf, scanf, etc.)
    dbg_uart_init();

/*Start***FTM Init*************************************************************/
    memset(&ftmInfo, 0, sizeof(ftmInfo));
    ftmInfo.syncMethod = kFtmUseSoftwareTrig;
    FTM_DRV_Init(0, &ftmInfo);
/*End*****FTM Init*************************************************************/

    // Print the initial banner
    PRINTF("\r\nHello World!\n\n\r");

    LED2_EN;    LED3_EN;    LED4_EN;    LED5_EN;
    LED2_OFF;   LED3_OFF;   LED4_OFF;   LED5_OFF;

    I2C_fxos8700Init();
    I2C_l3g4200dInit();

    FTM_DRV_PwmStart(0, &ftmParam0, 0);
    FTM_DRV_PwmStart(0, &ftmParam1, 1);
    FTM_DRV_PwmStart(0, &ftmParam2, 2);
    FTM_DRV_PwmStart(0, &ftmParam3, 3);
    FTM_HAL_SetSoftwareTriggerCmd(g_ftmBaseAddr[0], true);

        // Hwtimer initialization
    if (kHwtimerSuccess != HWTIMER_SYS_Init(&hwtimer, &HWTIMER_LL_DEVIF, HWTIMER_LL_ID, 5, NULL))
    {
        PRINTF("\r\nError: hwtimer initialization.\r\n");
    }
    if (kHwtimerSuccess != HWTIMER_SYS_SetPeriod(&hwtimer, HWTIMER_LL_SRCCLK, HWTIMER_PERIOD))
    {
        PRINTF("\r\nError: hwtimer set period.\r\n");
    }
//    if (kHwtimerSuccess != HWTIMER_SYS_RegisterCallback(&hwtimer, hwtimer_callback, NULL))
//    {
//        PRINTF("\r\nError: hwtimer callback registration.\r\n");
//    }
//    if (kHwtimerSuccess != HWTIMER_SYS_Start(&hwtimer))
//    {
//        PRINTF("\r\nError: hwtimer start.\r\n");
//    }
    
    /* A write of any value to current value register clears the field to 0, and also clears the SYST_CSR COUNTFLAG bit to 0. */
    SysTick->VAL = 0U;
    /* Run timer and disable interrupt */
    SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk ;//| SysTick_CTRL_TICKINT_Msk;

    GPIO_DRV_Init(remoteControlPins,NULL);
//    GPIO_DRV_Init(fxos8700IntPins,NULL);
//    I2C_fxos8700AutoCalibration(); //cannot work , shit!
    
/*Start PIT init***************/    
    // Structure of initialize PIT channel No.0
    pit_user_config_t chn0Confg = {
      .isInterruptEnabled = true,
      .isTimerChained = false,
      .periodUs = 20000u //1000000 us
    };
    
    // Structure of initialize PIT channel No.1
    pit_user_config_t chn1Confg = {
      .isInterruptEnabled = true,
      .isTimerChained = false,
      .periodUs = 2000000u
    };  
    
    // Init pit module and enable run in debug
    PIT_DRV_Init(BOARD_PIT_INSTANCE, false);
    
    // Initialize PIT timer instance for channel 0 and 1
    PIT_DRV_InitChannel(BOARD_PIT_INSTANCE, 0, &chn0Confg);
//    PIT_DRV_InitChannel(BOARD_PIT_INSTANCE, 1, &chn1Confg);
    
    // Start channel 0
//    printf ("\n\rStarting channel No.0 ...");
    PIT_DRV_StartTimer(BOARD_PIT_INSTANCE, 0);
    
    // Start channel 1
//    printf ("\n\rStarting channel No.1 ...");
//    PIT_DRV_StartTimer(BOARD_PIT_INSTANCE, 1);
    
/*End PIT init***************/   

//    NVIC_SetPriority(SysTick_IRQn, 3);
//    NVIC_SetPriority(PORTB_IRQn,0);
    while(1)
    {
///*Start************Remote Controller Unlock *************/      
//      if(isRCunlock == true)
//      {    
//        LED3_ON;
//      }
//      else
//      {    
//        LED3_OFF;
//      }
//      static uint32_t unlock_times = 0;
//      static uint32_t lock_times = 0;
//      PRINTF("ThrottleValue = %6d ,YawValue = %6d \r\n" ,remoteControlValue[kThrottle],remoteControlValue[kYaw]);
//      if(isRCunlock == false)
//      {
//        if((remoteControlValue[kThrottle] < RC_THRESHOLD_L) && (remoteControlValue[kYaw] > RC_THRESHOLD_H))
//        {
//          unlock_times++;
//        }
//        else
//        {
//          unlock_times = 0;
//        }
//        if(unlock_times > 6)
//        {
//          isRCunlock = true; 
//        }
//      }
//      else
//      {
//        if((remoteControlValue[kThrottle] < RC_THRESHOLD_L) && (remoteControlValue[kYaw] < RC_THRESHOLD_L))
//        {
//          lock_times++;
//        }
//        else
//        {
//          lock_times = 0;
//        }
//        if(lock_times > 4)
//        {
//          isRCunlock = false;
//        }
//      }
///*End************Remote Controller Unlock *************/          

//      LED2_ON;
//      OSA_TimeDelay(200);
//      LED3_ON;
//      OSA_TimeDelay(200);
//      LED4_ON;
//      OSA_TimeDelay(200);
      LED5_ON;
      OSA_TimeDelay(100);

//      LED2_OFF;
//      OSA_TimeDelay(200);
//      LED3_OFF;
//      OSA_TimeDelay(200);
//      LED4_OFF;
//      OSA_TimeDelay(200);
      LED5_OFF;
      OSA_TimeDelay(100);
    }
}

volatile bool isRCunlock = false;
//below define value is in quad_common.h
//#define RC_THRESHOLD_H (220000U)
//#define RC_THRESHOLD_L (140000U)
//#define RC_THRESHOLD_ERROR (300000U)//由于IO采两个边沿中断,有可能算成低电平的时间,所以做一个剔除算法。
//#define HW_DIVIDER (2400000U) 
////120M core clock , 2400000 / 120 000 000 = 0.02 s , 50Hz , 
////遥控器信号 50Hz , 范围1~2ms,周期20ms,1.5ms中值.对应 120 000 - 240 000
void PORTB_IRQHandler(void)
{
  uint32_t intFlag = PORT_HAL_GetPortIntFlag(PORTB_BASE);
  uint32_t i =  0;
  uint32_t value = 0;
  static  uint32_t remoteControlValue1st[8] = {0};
  static  uint32_t remoteControlValue2nd[8] = {0};
  static  uint32_t remoteControlValueFlag[8] = {0};
  for(i=0 ; i<8;i++)
  {
    if (intFlag & (1 << remoteControlPinNum[i]))
    {
      if (remoteControlValueFlag[i] == 0)
      {
        remoteControlValue1st[i] = (SysTick->VAL);
        remoteControlValueFlag[i] = 1;
      }
      else
      {
        remoteControlValueFlag[i] = 0;
        remoteControlValue2nd[i] = (SysTick->VAL);
        if ( remoteControlValue1st[i] > remoteControlValue2nd[i] )
        { 
          value = remoteControlValue1st[i] - remoteControlValue2nd[i];
        }
        else
        {
          value = remoteControlValue1st[i] + HW_DIVIDER - remoteControlValue2nd[i];//hwtimer.divider
        }
        if( value > RC_THRESHOLD_ERROR)
        {
          remoteControlValueFlag[i] = 1;
          remoteControlValue1st[i] = (SysTick->VAL);
        }
        else
        {
          remoteControlValue[i] = value;
//          if(((remoteControlValue[3] <180000) ||(remoteControlValue[3] > 190000))&&remoteControlValue[3]> 100)
//            LED4_ON;
        }
      }
    }
    PORT_HAL_ClearPinIntFlag(PORTB_BASE,remoteControlPinNum[i]);
  }
  /* Clear interrupt flag.*/
 //   PORT_HAL_ClearPortIntFlag(PORTB_BASE);
}


void PORTE_IRQHandler(void)
{
  uint32_t intFlag = PORT_HAL_GetPortIntFlag(PORTE_BASE);
  if (intFlag & (1 << 11))
  {
    isFXOS8700Int1Trigger = true;
      PRINTF("\r\n PTE11 irq");
  }

  /* Clear interrupt flag.*/
  PORT_HAL_ClearPortIntFlag(PORTE_BASE);
}
/* gpio IRQ handler with the same name in startup code. */
void PORTB_IRQHandler(void)
{
    /* Clear interrupt flag.*/
    PORT_HAL_ClearPortIntFlag(PORTB_BASE_PTR);
}
/* gpio IRQ handler with the same name in startup code. */
void PORTBC_IRQHandler(void)
{
    /* Clear interrupt flag.*/
    if(PORT_HAL_GetPortIntFlag(PORTB_BASE))  PORT_HAL_ClearPortIntFlag(PORTB_BASE);
    if(PORT_HAL_GetPortIntFlag(PORTC_BASE))  PORT_HAL_ClearPortIntFlag(PORTC_BASE);
}