コード例 #1
0
ファイル: usbd_conf.c プロジェクト: MrZANE42/verisure1512
/**
  * @brief  Suspend callback.
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
  if(hpcd->Instance == USB_OTG_HS)
  {
#ifdef USE_USB_HS_IN_FS
    __HAL_PCD_GATE_PHYCLOCK(hpcd);
    USBD_LL_Suspend(hpcd->pData);
    
    /*Enter in STOP mode */
    if (hpcd->Init.low_power_enable)
    {
      /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
      SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
    }
#endif
  }
  else
  {  
    __HAL_PCD_GATE_PHYCLOCK(hpcd);
    USBD_LL_Suspend(hpcd->pData);
    
    /*Enter in STOP mode */
    if (hpcd->Init.low_power_enable)
    {   
      /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
      SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
    }  
  }
}
コード例 #2
0
/**
  * @brief  HAL_PCDEx_LPM_Callback : Send LPM message to user layer
  * @param  hpcd: PCD handle
  * @param  msg: LPM message
  * @retval HAL status
  */
void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg)
{
  switch ( msg)
  {
  case PCD_LPM_L0_ACTIVE:
    if (hpcd->Init.low_power_enable)
    {
      SystemClock_Config();

      /* Reset SLEEPDEEP bit of Cortex System Control Register */
      SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
    }
    __HAL_PCD_UNGATE_PHYCLOCK(hpcd);
    USBD_LL_Resume(hpcd->pData);
    break;

  case PCD_LPM_L1_ACTIVE:
    __HAL_PCD_GATE_PHYCLOCK(hpcd);
    USBD_LL_Suspend(hpcd->pData);

    /*Enter in STOP mode */
    if (hpcd->Init.low_power_enable)
    {
      /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
      SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
    }
    break;
  }
}
コード例 #3
0
/**
  * @brief  Suspend callback.
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
   __IO uint32_t i=0;
  
  if(hpcd->Instance == USB_OTG_HS)
  {
    __HAL_USB_OTG_HS_WAKEUP_EXTI_DISABLE_IT();
    
    __HAL_PCD_GATE_PHYCLOCK(hpcd);
    
    /* Wait timeout of 6 ULPI PHY clock ~= 18 cpu clocks */
    for (i=0; i<18; i++)
    {
      __NOP();
    }
    
    if (__HAL_PCD_IS_PHY_SUSPENDED(hpcd))  /* when set then false resume condition*/
    {
      __HAL_USB_OTG_HS_WAKEUP_EXTI_CLEAR_FLAG();
      __HAL_USB_OTG_HS_WAKEUP_EXTI_ENABLE_IT(); 
      
      USBD_LL_Suspend(hpcd->pData);
      
      /*Enter in STOP mode */
      if (hpcd->Init.low_power_enable)
      {
        /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
        SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
      }
    }
  }
  else
  {
    __HAL_PCD_GATE_PHYCLOCK(hpcd);
    USBD_LL_Suspend(hpcd->pData);
    
    /*Enter in STOP mode */
    if (hpcd->Init.low_power_enable)
    {
      /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
      SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
    }
  }
}
コード例 #4
0
/**
  * @brief  Suspend callback.
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
  /* Inform USB library that core enters in suspend Mode */
  USBD_LL_Suspend(hpcd->pData);
 
  /*Enter in STOP mode */
  if (hpcd->Init.low_power_enable)
  {
    /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
    SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
  }
}
コード例 #5
0
ファイル: usbd_conf.c プロジェクト: antboard/ScorpionBoard
/**
  * @brief  Suspend callback.
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
  USBD_LL_Suspend(hpcd->pData);
  /*Enter in STOP mode */
  /* USER CODE BEGIN 2 */
  if (hpcd->Init.low_power_enable)
  {
    /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
    SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
  }
  /* USER CODE END 2 */
}
コード例 #6
0
ファイル: usbd_conf.c プロジェクト: nihaopaul/Espruino
/**
  * @brief  Suspend callback.
  * When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
  /* Inform USB library that core enters in suspend Mode */
  USBD_LL_Suspend(hpcd->pData);
#ifndef STM32F1    
  __HAL_PCD_GATE_PHYCLOCK(hpcd);
#endif  
  /*Enter in STOP mode */
  /* USER CODE BEGIN 2 */
  if (hpcd->Init.low_power_enable)
  {
    /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
    SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
  }
  /* USER CODE END 2 */
}
コード例 #7
0
ファイル: usbd_conf.c プロジェクト: iwasz/gp8-clock
/**
 * @brief  Suspend callback.
 * @param  hpcd: PCD handle
 * @retval None
 */
void HAL_PCD_SuspendCallback (PCD_HandleTypeDef *hpcd)
{
        USBD_LL_Suspend (hpcd->pData);
}
コード例 #8
0
ファイル: usbd_conf.c プロジェクト: assarsh/Project_2016_04
/**
  * @brief  Suspend callback.
  * When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
  U8 i,y;
//  USBD_HID_HandleTypeDef *ptr;
//  ptr = (USBD_HID_HandleTypeDef *)(hUsbDeviceFS.pClassData);
//  GPIO_InitTypeDef GPIO_InitStruct;
  /* Inform USB library that core enters in suspend Mode */
  USBD_LL_Suspend(hpcd->pData);
  /*Enter in STOP mode */
  /* USER CODE BEGIN 2 */
  if (hpcd->Init.low_power_enable)
  {
    //[ slash

//   for (y = COLS; y < COLS+ROWS; y++) {                            // Scan, save, and update the current keyboard state
//     gpio_setDirvalue(matrix[y].port, matrix[y].pin, GPIO_MODE_OUTPUT_PP, GPIO_PIN_SET);
//      for (i = 0; i < 10; i++); 
//    }    
  if (HAL_TIM_Base_Stop_IT(&htim2) != HAL_OK)
  {
    /* Starting Error */
    while(1);
  }       
    HAL_I2CEx_AnalogFilter_Config(&hi2c2, I2C_ANALOGFILTER_DISABLE);
  if  (HAL_I2C_DeInit(&hi2c2)!= HAL_OK) {
    while(1);
  }
    for (i=0;i<3;i++) {
    ((USBD_HID_HandleTypeDef *)&hUsbDeviceFS.pClassData)->state[i] = HID_BUSY;
    }
    HAL_GPIO_WritePin(LED_RESET_GPIO_Port, LED_RESET_Pin, GPIO_PIN_RESET);                  // Low to shut down led controller
//    for (i = 0; i < 10; i++);
//    GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3 
//                            |GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7 
//                            |GPIO_PIN_15;
//    GPIO_InitStruct.Pin = GPIO_PIN_15;
//    GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
//    GPIO_InitStruct.Pull = GPIO_NOPULL;
//    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_1);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_2); 
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_3);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_4);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_5);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_6);
//////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_7);  
//    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_15);    
    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_All);    
////    HAL_NVIC_SetPriority(EXTI0_1_IRQn, 3, 0);
    HAL_NVIC_EnableIRQ(EXTI0_1_IRQn);
////    HAL_NVIC_SetPriority(EXTI2_3_IRQn, 3, 0);
    HAL_NVIC_EnableIRQ(EXTI2_3_IRQn);
//    HAL_NVIC_SetPriority(EXTI4_15_IRQn, 3, 0);
    HAL_NVIC_EnableIRQ(EXTI4_15_IRQn);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_0);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_1);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_2); 
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_3);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_4);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_5);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_6);
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_7);  
////    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_15);    
//    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_PIN_All); 
////      HAL_NVIC_DisableIRQ(I2C2_IRQn); 
    //]
    for (y = 0; y < COLS; y++) {                             // Scan, save, and update the current keyboard state
     gpio_setDirvalue(matrix[y].port, matrix[y].pin, GPIO_MODE_OUTPUT_PP, GPIO_PIN_RESET);
     for (i = 0; i < 10; i++); 
   }  
    for (y = 0; y < COLS; y++) {                             // Scan, save, and update the current keyboard state
     gpio_setDirvalue(matrix[y].port, matrix[y].pin, GPIO_MODE_OUTPUT_PP, GPIO_PIN_RESET);
     for (i = 0; i < 10; i++); 
   } 
    /* Set SLEEPDEEP bit and SleepOnExit of Cortex System Control Register */
//    SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
  }
  /* USER CODE END 2 */
}
コード例 #9
0
ファイル: usbd_conf.c プロジェクト: itahoe/gnss_dock
/**
  * @brief  Suspend callback.
  * @param  hpcd: PCD handle
  * @retval None
  */
void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
{
	USBD_LL_Suspend(hpcd->pData);
	ui_led_usb_set( false );
}