cancel
Showing results for 
Search instead for 
Did you mean: 

How it works the return??

BTurc.2
Senior

Hello all,

I'm using the HAL library for the camera, specifically I'm using the function:

 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef *hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length)

In the function are many return HAL_ERROR, and one HAL_OK. When the function works fine It return a 0, but when I have an error it return 2.

Why It retuns 2 if the HAL_ERROR is defined as 1 when I have an error.

1 ACCEPTED SOLUTION

Accepted Solutions
LCE
Principal

I think 2 is busy:

typedef enum
{
  HAL_OK       = 0x00U,
  HAL_ERROR    = 0x01U,
  HAL_BUSY     = 0x02U,
  HAL_TIMEOUT  = 0x03U
} HAL_StatusTypeDef;

View solution in original post

5 REPLIES 5
LCE
Principal

I think 2 is busy:

typedef enum
{
  HAL_OK       = 0x00U,
  HAL_ERROR    = 0x01U,
  HAL_BUSY     = 0x02U,
  HAL_TIMEOUT  = 0x03U
} HAL_StatusTypeDef;

BTurc.2
Senior

Ohh, Okey, I see that a function inside could return a HAL_BUSY, but the main function only could return HAL_OK and HAL_ERROR, so why It return the HAL_BUSY??. The return of the subfunction is only used in the subfunction no??

LCE
Principal

I don't know that function.

Check it again, then debug it.

Mike_ST
ST Employee

Hello,

if you have:

status = function(...);

and later you have

return status;

then status might be the return value of the sub-function.

As LCE wrote, please use the debugger so you can better understand where you get HAL_BUSY.

BTurc.2
Senior

I will try to debug it! Thanks for the help!