Usage of UART receive callback function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Usage of UART receive callback function

跳至解决方案
3,198 次查看
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?

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
1,350 次查看
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 项奖励
回复
2 回复数
1,351 次查看
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 项奖励
回复
1,350 次查看
eugenephua
Contributor III

Hi Eva,

Thanks, that helps!

Regards

Eugene

0 项奖励
回复