PreviousNext
Reset
Help > Custom DPA Handler > Events > Reset

The event is called just after the module was reset. It can be used to handle the bonding/unbonding of the  [N] devices. In this case, the code must return TRUE. If the [N] is not bonded the handler routine must not finish until the [N] is bonded. The code does not have to handle the setting of NodeWasBonded. See also Init event concerning the initialization options. An interrupt is enabled so the Interrupt event can be already called. [N] devices are set to the Node mode by calling setNodeMode IQRF OS function before this event is raised. After the bonding is done the content of the bufferRF must stay intact.

 

The Reset event is also once raised at the [C] device for the sake of the same behavior of all device types. In this case, it is not used to do bonding or unbonding of course. The [C] devices are at non‑network mode because of the previous call of setNonetMode IQRF OS function.

 

Example

 

 // Illustrative code

 case DpaEvent_Reset:

        if (!doCustomBonding)

             return FALSE;

 

        if ( amIBonded() )

        {

              if ( unBondCondition )

              {

                    removeBond();

                    setLEDR();

                    waitDelay( 100 );

                    stopLEDR();

              }

        }

        else

        {

        while ( !amIBonded() )

        {

              if ( bondRequestCondition )

             {

                            bondRequestAdvanced();

                     setWDToff();

             }

        }

        }

 

       return TRUE;

 

☼ See example code CustomDpaHandler-Bonding.c for more details.