Exemple #1
0
void set_address(int address)
{
    //USB_DAADR
    _SetEPAddress(0, 0);
    _SetEPAddress(1, 1);//FIXME: is this usable?
    _SetDADDR((address & 0x7F) | DADDR_EF);
}
Exemple #2
0
/*******************************************************************************
* Function Name  : SetDeviceAddress.
* Description    : Set the device and all the used Endpoints addresses.
* Input          : - Val: device address.
* Output         : None.
* Return         : None.
*******************************************************************************/
void SetDeviceAddress(uint8_t Val) {
    uint32_t i;
    uint32_t nEP = Device_Table.Total_Endpoint;

    /* set address in every used endpoint */
    for (i = 0; i < nEP; i++) {
        _SetEPAddress((uint8_t)i, (uint8_t)i);
    } 
    
    _SetDADDR(Val | DADDR_EF); /* set device address and enable function */ 
}
Exemple #3
0
/**
  * @brief This Function set USB device address
  * @param  pdev: device instance
  * @param  address: new device address
  */
void  DCD_EP_SetAddress (USB_CORE_HANDLE *pdev, uint8_t address)
{
  uint32_t i=0;
  pdev->dev.device_address = address;
  
  /* set address in every used endpoint */
  for (i = 0; i < EP_NUM; i++)
  {
    _SetEPAddress((uint8_t)i, (uint8_t)i);
  } /* set device address and enable function */
  _SetDADDR(address | DADDR_EF); 
}
/*******************************************************************************
* Function Name  : SetDeviceAddress.
* Description    : Set the device and all the used Endpoints addresses.
* Input          : - Val: device adress.
* Output         : None.
* Return         : None.
*******************************************************************************/
void SetDeviceAddress(u8 Val)
{
  u32 i;
  u32 nEP = Device_Table.Total_Endpoint;

  /* set address in every used endpoint */
  for (i = 0; i < nEP; i++)
  {
    _SetEPAddress((u8)i, (u8)i);
  } /* for */
  _SetDADDR(Val | DADDR_EF); /* set device address and enable function */
}
Exemple #5
0
/*******************************************************************************
* Function Name  : SetDeviceAddress.
* Description    : Set the device and all the used Endpoints addresses.
* Input          : - Val: device address.
* Output         : None.
* Return         : None.
*******************************************************************************/
void SetDeviceAddress(uint8_t Val) {
#ifdef STM32F10X_CL
    PCD_EP_SetAddress((uint8_t)Val);
#else
    uint32_t i;
    uint32_t nEP = Device_Table.Total_Endpoint;

    /* set address in every used endpoint */
    for(i = 0; i < nEP; i++) {
        _SetEPAddress((uint8_t)i, (uint8_t)i);
    }                          /* for */
    _SetDADDR(Val | DADDR_EF); /* set device address and enable function */
#endif /* STM32F10X_CL */
}