How to use "LPSPI_DRV_MasterTransferBlocking" to read the slave data

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

How to use "LPSPI_DRV_MasterTransferBlocking" to read the slave data

跳至解决方案
848 次查看
Hrohn
Contributor II
uint8_t reg_access_read(uint8_t addr )
{
    uint8_t rdata = 0;
    uint8_t wdata = 0;

 

    SpiChipSelect();
    wdata =  (addr & 0x7f);
    LPSPI_DRV_MasterTransferBlocking(INST_LPSPI_1,(uint8_t*)&wdata,(uint8_t*)&rdata,1,OSIF_WAIT_FOREVER);
   
    SpiChipRelease();

 

    return rdata;
}
 
The above is the SPI I wrote as a function for the host to read data from the slave. Is this correct?
0 项奖励
回复
1 解答
834 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it seems to be correct

BR, Petr

在原帖中查看解决方案

0 项奖励
回复
1 回复
835 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it seems to be correct

BR, Petr

0 项奖励
回复