/**
 * @brief This function use for read data by PMP bus.
 * @param addr Set address where you want to read data.
 * @param data You can keep data from PMP bus by this parameter.
 * @return void
 */
void DRV_PMP0_Read(uint16_t addr,uint16_t *data)
{
    // Set address
    PLIB_PMP_AddressSet(PMP_ID_0, addr );
    // Dummy read
    // Read data from buffer to PMDIN & from Slave to buffer
    while(PLIB_PMP_PortIsBusy(PMP_ID_0) == true);
    PLIB_PMP_MasterReceive(PMP_ID_0);
    // Actual data shifted from buffer to PMDIN
    while(PLIB_PMP_PortIsBusy(PMP_ID_0) == true);
    *data = PLIB_PMP_MasterReceive(PMP_ID_0);    
}
Exemplo n.º 2
0
uint8_t DRV_PMP0_Read(void)
{
    uint8_t value;
    value = PLIB_PMP_MasterReceive(PMP_ID_0);
    while(PLIB_PMP_PortIsBusy(PMP_ID_0) == true);
	
    return (value);
}