Usage of UART receive callback function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Usage of UART receive callback function

Jump to solution
3,197 Views
eugenephua
Contributor III

Hi there, I am using KSDK1.2.0 with KDS 3.0.0 with FRDM-KL25Z board. I am trying to understand the purpose of the UART receive callback function when setting the parameters of UART in processor expert. In the callback function generated, there are 2 input parameters: uint32_t instance and void *uartState. How do i make use of these to obtain the received character in the UART?

Labels (1)
0 Kudos
Reply
1 Solution
1,349 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Eugene,

you can get it for example by this way:

void uartCom1_RxCallback(uint32_t instance, void * uartState)

{

  /* Write your code here ... */

    uint8_t buffer[5]={0};

    UART_DRV_ReceiveData(instance,buffer,1);

}

where instance is UART number.

I hope this helps.

Best Regards,

Iva

View solution in original post

0 Kudos
Reply
2 Replies
1,350 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Eugene,

you can get it for example by this way:

void uartCom1_RxCallback(uint32_t instance, void * uartState)

{

  /* Write your code here ... */

    uint8_t buffer[5]={0};

    UART_DRV_ReceiveData(instance,buffer,1);

}

where instance is UART number.

I hope this helps.

Best Regards,

Iva

0 Kudos
Reply
1,349 Views
eugenephua
Contributor III

Hi Eva,

Thanks, that helps!

Regards

Eugene

0 Kudos
Reply