AnsweredAssumed Answered

Generated functions in module usbd_cdc_if have wrong return values

Question asked by katzenberger.michael on Jan 13, 2017

Hi !

 

This issue relates to:

https://community.st.com/message/143002-re-stm32cube-f4-fw-150-usbdstatustypedef-not-used-where-appropriate?commentID=143002&et=watches.email.thread#comment-143002

Although the module functions should return a value of the enumeration USBD_StatusTypeDef

/* Following USB Device status */
typedef enum {
  USBD_OK   = 0,
  USBD_BUSY,
  USBD_FAIL,
}USBD_StatusTypeDef;

 

the return value of the generated functions is int8_t

static int8_t CDC_Init_FS     (void);
static int8_t CDC_DeInit_FS   (void);
static int8_t CDC_Control_FS  (uint8_t cmd, uint8_t* pbuf, uint16_t length);
static int8_t CDC_Receive_FS  (uint8_t* pbuf, uint32_t *Len);

for example:

/**
  * @brief  CDC_Init_FS
  *         Initializes the CDC media low layer over the FS USB IP
  * @param  None
  * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
  */

static int8_t CDC_Init_FS(void)
{

should be changed to

/**
  * @brief  CDC_Init_FS
  *         Initializes the CDC media low layer over the FS USB IP
  * @param  None
  * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
  */

static USBD_StatusTypeDef CDC_Init_FS(void)

Outcomes