How to use "LPSPI_DRV_MasterTransferBlocking" to read the slave data

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

How to use "LPSPI_DRV_MasterTransferBlocking" to read the slave data

Jump to solution
579 Views
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 Kudos
Reply
1 Solution
565 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it seems to be correct

BR, Petr

View solution in original post

0 Kudos
Reply
1 Reply
566 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it seems to be correct

BR, Petr

0 Kudos
Reply