PreviousNext
InStandby
Help > Custom DPA Handler > Events > InStandby

This event is raised only at TR-7xG [N]. Allows you to optionally set the value of the watchdog timer (WDT) so that the event is periodically triggered in the Standby state. The event is always triggered at the beginning of the standby mode. The event stores the WDT value in the userReg1 variable and returns TRUE. If the event returns FALSE (i.e. it is not implemented), the WDT is disabled and the standby mode can only be interrupted by the IQRF button. If a WDT time has been set and an interrupt from WDT has occurred, the event is periodically called again. Reentrancy of the Custom DPA handler may occur because this event can be triggered in a standby state activated from the DPA Menu Beaming, which is normally handled in an Idle event. Therefore, local variables must not be used in event processing, but global or local static variables. No interrupt-dependent routines (e.g., from a timer) must be used because interrupts are disabled. Because of the standby mode, power consumption must of course be minimal.

 

Example

 

static uns8 inStanbyCnt;

  case DpaEvent_InStandby:

    // Pulse LEDR or LEDG for 8 ms every 4 s in Standby

    if ( inStanbyCnt.1 )

      _LEDR = 1;

    else

      _LEDG = 1;

 

    if ( inStanbyCnt.0 )

    {

      _LEDR = 0;

      _LEDG = 0;

      userReg1 = WDTCON_4s;

    }

    else

      userReg1 = WDTCON_8ms;

 

    inStanbyCnt++;

    return TRUE;

 

  case DpaEvent_MenuActivated:

    inStanbyCnt = 0;

    break;

 

See example CustomDpaHandler-DpaMenu for more details.