PreviousNext
Enumerate Peripherals
Help > Custom DPA Handler > Events > DPA Request > Enumerate Peripherals

This DPA Request is executed as a part of the peripheral enumeration.

 

The purposes of the request are:

1.   Specify how many user peripherals are implemented.

2.   Set bits corresponding to the user peripherals at the UserPer array. Predefined macro FlagUserPer can be used.

3.   If any embedded peripheral is handled by a custom DPA handler instead of the default handler (overriding embedded peripherals).

4.   Specify HW profile ID and its version if one is implemented.

 

Example

 

case DpaEvent_DpaRequest:

 if ( IsDpaEnumPeripheralsRequest() )

{

 // One user peripheral defined

 _DpaMessage.EnumPeripheralsAnswer.UserPerNr = 1;

 FlagUserPer( _DpaMessage.EnumPeripheralsAnswer.UserPer, PNUM_USER );

 // We override embedded EEEPROM peripheral

 _DpaMessage.EnumPeripheralsAnswer.DefaultPer[PNUM_EEEPROM/8] |= 1 << (PNUM_EEEPROM % 8);

 // HW profile ID and version

 _DpaMessage.EnumPeripheralsAnswer.HWPID = 0x123F;

 _DpaMessage.EnumPeripheralsAnswer.HWPIDver = 0xABCD;

 

 return TRUE;

}