cancel
Showing results for 
Search instead for 
Did you mean: 

Transmitting variable to UART ?

antonius
Senior
Posted on February 12, 2016 at 06:02

Guys,

I want to transmit ''res'' into UART buffer :

FRESULT f_open (

 

    FIL* fp,            /* Pointer to the blank file object */

 

    const TCHAR* path,    /* Pointer to the file name */

 

    BYTE mode            /* Access mode and file open mode flags */

 

)

 

{

 

    FRESULT res;

 

 

I want to print ''res'' to UART buffer

void Transmit_String_ff(unsigned char *s)

 

{

 

  HAL_UART_Transmit(&huart1, s, strlen(s), 1000); // As a pointer, with a length

 

}

I can't do

Transmit_String_ff(res)

I got this error,

error:  #167: argument of type ''FRESULT'' is incompatible with parameter of type ''unsigned char *''

How can I fix it ? thanks
1 REPLY 1
AvaTar
Lead
Posted on February 12, 2016 at 07:08

The FatFS source file

ff.h

says:

typedef enum {

    ....

} FRESULT;

Thus, just cast it; enum is usually (but not necessarily)

int

:

  sprintf (buf, ''%d'',

(int)

fres);

That is more or less basic C stuff.