AnsweredAssumed Answered

USB JoystickMouse Example Question!

Question asked by tuyen.vo_quang on Apr 20, 2015
/*******************************************************************************
* Function Name  : PowerOn
* Description    :
* Input          : None.
* Output         : None.
* Return         : USB_SUCCESS.
*******************************************************************************/
RESULT PowerOn(void)
{
#ifndef STM32F10X_CL
  uint16_t wRegVal;


  /*** cable plugged-in ? ***/
  USB_Cable_Config(ENABLE);


  /*** CNTR_PWDN = 0 ***/
  wRegVal = CNTR_FRES;
  _SetCNTR(wRegVal);


  /*** CNTR_FRES = 0 ***/
  wInterrupt_Mask = 0;
  _SetCNTR(wInterrupt_Mask);
  /*** Clear pending interrupts ***/
  _SetISTR(0);
  /*** Set interrupt mask ***/
  wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM;
  _SetCNTR(wInterrupt_Mask);
#endif /* STM32F10X_CL */


  return USB_SUCCESS;
}

Why do we define #ifndef STM32F10X_CL. It means that when i define STM32F10X_CL, the program will ignore the body of this function, so i wonder how can the program configure USB Power ON for STM32F10X_CL?

Outcomes