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