This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-CC26X2R1: how can we get the number of bytes when the UART work in read callback mode

Part Number: LAUNCHXL-CC26X2R1

Tool/software: Code Composer Studio

Hi,

we set the uart in read callback mode to receive random length(< 128)data, it call uart_read(uart1_handle,rxbuffer,128) every 100ms.

it goto callback function normally, but how to get the number of bytes when it step into the callback ?

Thanks,

LN

  • Hi LN,

    The number of bytes is the third parameter in your callback function:

    /*!
     *  @brief      The definition of a callback function used by the UART driver
     *              when used in #UART_MODE_CALLBACK
     *              The callback can occur in task or HWI context.
     *
     *  @param      UART_Handle             UART_Handle
     *
     *  @param      buf                     Pointer to read/write buffer
     *
     *  @param      count                   Number of elements read/written
     */
    typedef void (*UART_Callback) (UART_Handle handle, void *buf, size_t count);
    

    Best Regards,

    R.M

  • Hi R.M,

    Thank you, it works.

    LN