/** \brief Handler for DIO timer event. \note This function is executed in task context, called by the scheduler. */ void icmpv6rpl_timer_DIO_task() { uint32_t dioPeriod; // send DIO sendDIO(); // arm the DIO timer with this new value dioPeriod = icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff); opentimers_setPeriod( icmpv6rpl_vars.timerIdDIO, TIME_MS, dioPeriod ); }
/** \brief Handler for DIO timer event. \note This function is executed in task context, called by the scheduler. */ void icmpv6rpl_timer_DIO_task() { // update the delayDIO icmpv6rpl_vars.delayDIO = (icmpv6rpl_vars.delayDIO+1)%5; // check whether we need to send DIO if (icmpv6rpl_vars.delayDIO==0) { // send DIO sendDIO(); // pick a new pseudo-random periodDIO icmpv6rpl_vars.periodDIO = TIMER_DIO_TIMEOUT+(openrandom_get16b()&0xff); // arm the DIO timer with this new value opentimers_setPeriod( icmpv6rpl_vars.timerIdDIO, TIME_MS, icmpv6rpl_vars.periodDIO ); } }