/**
 * @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);    
}
Пример #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);
}
/**
 * @brief This function use for write data by PMP bus.
 * @param addr Set address where you want to place data.
 * @param data You can send data to PMP bus by this parameter.
 * @return void
 */
void DRV_PMP0_Write(uint16_t addr,uint16_t data)
{
    // Set address
    PLIB_PMP_AddressSet(PMP_ID_0, addr );
    // Wait bus ready
    while(PLIB_PMP_PortIsBusy(PMP_ID_0) == true);
    // Send data
    PLIB_PMP_MasterSend(PMP_ID_0, data);
}
Пример #4
0
void DRV_PMP0_Write(uint8_t data)
{
    PLIB_PMP_MasterSend(PMP_ID_0, data);
    while(PLIB_PMP_PortIsBusy(PMP_ID_0) == true);
}