1 // *************************************************************************** 2 // Custom DPA Handler code example - Disables sleep during default bonding * 3 // *************************************************************************** 4 // Copyright (c) MICRORISC s.r.o. 5 // 6 // File: $RCSfile: CustomDpaHandler-BondingNoSleep.c,v $ 7 // Version: $Revision: 1.13 $ 8 // Date: $Date: 2022/02/25 09:41:25 $ 9 // 10 // Revision history: 11 // 2022/02/24 Release for DPA 4.17 12 // 2018/10/25 Release for DPA 3.03 13 // 14 // ********************************************************************* 15 16 // Online DPA documentation https://doc.iqrf.org/DpaTechGuide/ 17 18 // Default IQRF include (modify the path according to your setup) 19 #include "IQRF.h" 20 21 // Default DPA header (modify the path according to your setup) 22 #include "DPA.h" 23 // Default Custom DPA Handler header (modify the path according to your setup) 24 #include "DPAcustomHandler.h" 25 26 // Must be the 1st defined function in the source code in order to be placed at the correct FLASH location! 27 //############################################################################################ 28 bit CustomDpaHandler() 29 //############################################################################################ 30 { 31 // Handler presence mark 32 clrwdt(); 33 34 // Detect DPA event to handle 35 switch ( GetDpaEvent() ) 36 { 37 // ------------------------------------------------- 38 case DpaEvent_Interrupt: 39 return Carry; 40 41 // ------------------------------------------------- 42 case DpaEvent_BondingButton: 43 // Called to allow a bonding button customization 44 45 BondingSleepCountdown = 0; 46 break; 47 48 case DpaEvent_DpaRequest: 49 // Called to interpret DPA request for peripherals 50 // ------------------------------------------------- 51 // Peripheral enumeration 52 if ( IsDpaEnumPeripheralsRequest() ) 53 { 54 // We implement no user peripheral 55 _DpaMessage.EnumPeripheralsAnswer.HWPID |= 0xabcF; 56 _DpaMessage.EnumPeripheralsAnswer.HWPIDver |= 0x9876; 57 return TRUE; 58 } 59 } 60 61 return FALSE; 62 } 63 64 //############################################################################################ 65 // Default Custom DPA Handler header; 2nd include implementing a Code bumper to detect too long code of the Custom DPA Handler (modify the path according to your setup) 66 #include "DPAcustomHandler.h" 67 //############################################################################################