Example #1
0
error_t rreg_receive(OpenQueueEntry_t* msg,
                   coap_header_iht* coap_header,
                   coap_option_iht* coap_options) {
                      
   error_t outcome;
   
   if (coap_header->Code==COAP_CODE_REQ_POST) {
      // request to register received
      
      // triggered: schedule task to execute timer function next
      scheduler_push_task(rreg_timer,TASKPRIO_COAP);
      //call timer here, but reset timer after
      
      
      // reset packet payload
      msg->payload                     = &(msg->packet[127]);
      msg->length                      = 0;
      
      // set the CoAP header
      coap_header->OC                  = 0;
      coap_header->Code                = COAP_CODE_RESP_VALID;
      
      outcome = E_SUCCESS;
   } else if (coap_header->T==COAP_TYPE_ACK) {
      // it worked!
   } else {
      outcome = E_FAIL;
   }
   
   return outcome;
}
__interrupt void PORT2_ISR (void) {
#ifdef ISR_BUTTON
   //interrupt from button connected to P2.7
   if ((P2IFG & 0x80)!=0) {
      P2IFG &= ~0x80;                            // clear interrupt flag
      scheduler_push_task(ID_ISR_BUTTON);        // post task
      __bic_SR_register_on_exit(CPUOFF);         // restart CPU
   }
#endif
}
__interrupt void PORT1_ISR (void) {
#ifdef ISR_RADIO
   //interrupt from radio through IRQ_RF connected to P1.6
   if ((P1IFG & 0x40)!=0) {
      P1IFG &= ~0x40;                            // clear interrupt flag
      scheduler_push_task(ID_ISR_RADIO);         // post task
      __bic_SR_register_on_exit(CPUOFF);         // restart CPU
   }
#endif
}
__interrupt void TIMERB0_ISR (void) {
#ifdef ISR_TIMERS
   if (timers_continuous[0]==TRUE) {
      TBCCR0 += timers_period[0];                // continuous timer: schedule next instant
   } else {
      TBCCTL0 = 0;                               // stop the timer
      TBCCR0  = 0;
   }
   scheduler_push_task(ID_ISR_MAC_PERIODIC);     // post the corresponding task
   __bic_SR_register_on_exit(CPUOFF);            // restart CPU
#endif
}
Example #5
0
/**
   \brief   Called back from opentimers when a CoAP message is received for this resource.
      Timer fired, but we don't want to execute task in ISR mode.
      Instead, push task to scheduler with COAP priority, and let scheduler take care of it.
   \param[in] id The opentimer identifier used to resolve the csensor resource associated
      parsed.
*/
void csensors_timer_cb(opentimers_id_t id){
   uint8_t i;

   for(i=0;i<csensors_vars.numCsensors;i++) {
      if (csensors_vars.csensors_resource[i].timerId == i) {
         csensors_vars.cb_list[csensors_vars.cb_put] = i;
         csensors_vars.cb_put = (csensors_vars.cb_put+1)%CSENSORSTASKLIST;
         opentimers_scheduleIn(
             csensors_vars.csensors_resource[i].timerId,
             csensors_vars.csensors_resource[i].period,
             TIME_MS,
             TIMER_ONESHOT,
             csensors_timer_cb
         );
         break;
      }
   }
   scheduler_push_task(csensors_task_cb,TASKPRIO_COAP);
}
Example #6
0
void stupidmac_sendDone(OpenQueueEntry_t* pkt, error_t error) {
   openqueue_freePacketBuffer(pkt);
   scheduler_push_task(ID_TASK_APPLICATION);     // ask the scheduler to do run task_application again
}
Example #7
0
//timer fired, but we don't want to execute task in ISR mode
//instead, push task to scheduler with COAP priority, and let scheduler take care of it
void bbk_timer_cb(){
   scheduler_push_task(bbk_task_cb,TASKPRIO_COAP);
}
Example #8
0
void sixtop_timeout_timer_cb(opentimer_id_t id) {
   scheduler_push_task(timer_sixtop_six2six_timeout_fired,TASKPRIO_SIXTOP_TIMEOUT);
}
Example #9
0
//timer fired, but we don't want to execute task in ISR mode
//instead, push task to scheduler with COAP priority, and let scheduler take care of it
void rex_timer_cb(){
   scheduler_push_task(rex_task_cb,TASKPRIO_COAP);
}
Example #10
0
void openserial_debugPrint_timer_cb(opentimers_id_t id){
	//leds_radio_toggle();
    scheduler_push_task(task_openserial_debugPrint,TASKPRIO_OPENSERIAL);
}
Example #11
0
void sixtop_maintenance_timer_cb(opentimer_id_t id) {
   scheduler_push_task(timer_sixtop_management_fired,TASKPRIO_SIXTOP);
}
Example #12
0
/**
\note timer fired, but we don't want to execute task in ISR mode instead, push
   task to scheduler with CoAP priority, and let scheduler take care of it.
*/
void uinject_timer_cb(opentimer_id_t id){
   
   scheduler_push_task(uinject_task_cb,TASKPRIO_COAP);
}
Example #13
0
uint8_t isr_openserial_rx(void) {
    uint8_t rxbyte;
    uint8_t returnVal;

    returnVal = 0;

    // read byte just received
    rxbyte = uart_readByte();

    if (
        openserial_vars.hdlcBusyReceiving==FALSE  &&
        openserial_vars.hdlcLastRxByte==HDLC_FLAG &&
        rxbyte!=HDLC_FLAG
    ) {
        // start of frame

        // I'm now receiving
        openserial_vars.hdlcBusyReceiving         = TRUE;

        // create the HDLC frame
        inputHdlcOpen();

        // add the byte just received
        inputHdlcWrite(rxbyte);
    } else if (
        openserial_vars.hdlcBusyReceiving==TRUE   &&
        rxbyte!=HDLC_FLAG
    ) {
        // middle of frame

        // add the byte just received
        inputHdlcWrite(rxbyte);
        if (openserial_vars.inputBufFillLevel+1>SERIAL_INPUT_BUFFER_SIZE){
            // push task
            scheduler_push_task(task_printInputBufferOverflow,TASKPRIO_OPENSERIAL);
            openserial_vars.inputBufFillLevel      = 0;
            openserial_vars.hdlcBusyReceiving      = FALSE;
        }
    } else if (
        openserial_vars.hdlcBusyReceiving==TRUE   &&
        rxbyte==HDLC_FLAG
    ) {
        // end of frame

        // finalize the HDLC frame
        inputHdlcClose();
        openserial_vars.hdlcBusyReceiving      = FALSE;

        if (openserial_vars.inputBufFillLevel==0){
            // push task
            scheduler_push_task(task_printWrongCRCInput,TASKPRIO_OPENSERIAL);
        } else {
            openserial_handleRxFrame();
            openserial_vars.inputBufFillLevel = 0;
            returnVal = 1;
        }
    }

    openserial_vars.hdlcLastRxByte = rxbyte;

    return returnVal;
}
Example #14
0
//timer fired, but we don't want to execute task in ISR mode
//instead, push task to scheduler with COAP priority, and let scheduler take care of it
void cexample_timer_cb(){
   scheduler_push_task(cexample_task_cb,TASKPRIO_COAP);
}
Example #15
0
void udprand_timer() {
  scheduler_push_task(udprand_task,TASKPRIO_COAP);
}
Example #16
0
/**
\brief DIO timer callback function.

\note This function is executed in interrupt context, and should only push a 
   task.
*/
void icmpv6rpl_timer_DIO_cb(opentimer_id_t id) {
   scheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL);
}
__interrupt void TIMERB1through6_ISR (void) {
#ifdef ISR_TIMERS
   uint16_t tbiv_temp = TBIV;                    // read only once because accessing TBIV resets it
   switch (tbiv_temp) {
      case 0x0002:
         if (timers_continuous[1]==TRUE) {
            TBCCR1 += timers_period[1];          // continuous timer: schedule next instant
         } else {
            TBCCTL1 = 0;                         // stop the timer
            TBCCR1  = 0;
         }
         scheduler_push_task(ID_ISR_MAC_BACKOFF);// post the corresponding task
         __bic_SR_register_on_exit(CPUOFF);      // restart CPU
         break;
      case 0x0004:
         if (timers_continuous[2]==TRUE) {
            TBCCR2 += timers_period[2];          // continuous timer: schedule next instant
         } else {
            TBCCTL2 = 0;                         // stop the timer
            TBCCR2  = 0;
         }
         scheduler_push_task(ID_ISR_MAC_WATCHDOG);// post the corresponding task
         __bic_SR_register_on_exit(CPUOFF);       // restart CPU
         break;
      case 0x0006:
         if (timers_continuous[3]==TRUE) {
            TBCCR3 += timers_period[3];          // continuous timer: schedule next instant
         } else {
            TBCCTL3 = 0;                         // stop the timer
            TBCCR3  = 0;
         }
         scheduler_push_task(ID_ISR_TCP_TIMEOUT);// post the corresponding task
         __bic_SR_register_on_exit(CPUOFF);      // restart CPU
         break;
      case 0x0008:
         if (timers_continuous[4]==TRUE) {
            TBCCR4 += timers_period[4];          // continuous timer: schedule next instant
         } else {
            TBCCTL4 = 0;                         // stop the timer
            TBCCR4  = 0;
         }
         scheduler_push_task(ID_ISR_RPL);        // post the corresponding task
         __bic_SR_register_on_exit(CPUOFF);      // restart CPU
         break;
      case 0x000A:
         if (timers_continuous[5]==TRUE) {
            TBCCR5 += timers_period[5];          // continuous timer: schedule next instant
         } else {
            TBCCTL5 = 0;                         // stop the timer
            TBCCR5  = 0;
         }
         scheduler_push_task(ID_ISR_TIMERB5);    // post the corresponding task
         __bic_SR_register_on_exit(CPUOFF);      // restart CPU
         break;
      case 0x000C:
         if (timers_continuous[6]==TRUE) {
            TBCCR6 += timers_period[6];          // continuous timer: schedule next instant
         } else {
            TBCCTL6 = 0;                         // stop the timer
            TBCCR6  = 0;
         }
#ifdef TASK_APPLICATION
         task_app_count++;
         scheduler_push_task(ID_TASK_APPLICATION);// post the corresponding task
#else
         scheduler_push_task(ID_ISR_TIMERB6);    // post the corresponding task
#endif
         __bic_SR_register_on_exit(CPUOFF);      // restart CPU
         break;
      default:
         while(1);                               // this should not happen
   }
#endif
}
Example #18
0
void res_timer_cb() {
   scheduler_push_task(timers_res_fired,TASKPRIO_RES);
}
Example #19
0
//timer fired, but we don't want to execute task in ISR mode
//instead, push task to scheduler with COAP priority, and let scheduler take care of it
void cexample_timer_cb(OpenMote* self){
 scheduler_push_task(self, cexample_task_cb,TASKPRIO_COAP);
}
Example #20
0
void otf_notif_removedCell(void) {
   scheduler_push_task(otf_removeCell_task,TASKPRIO_OTF);
}
Example #21
0
void udplatency_timer() {
  scheduler_push_task(udplatency_task,TASKPRIO_COAP);
}
Example #22
0
//timer fired, but we don't want to execute task in ISR mode
//instead, push task to scheduler with COAP priority, and let scheduler take care of it
void table_update_timer_cb(opentimer_id_t id){

   	scheduler_push_task(table_update_task_cb,TASKPRIO_COAP);

}
Example #23
0
/**
\brief DAO timer callback function.

\note This function is executed in interrupt context, and should only push a
   task.
*/
void icmpv6rpl_timer_DAO_cb() {
   scheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL);
}
Example #24
0
/**
\note timer fired, but we don't want to execute task in ISR mode instead, push
   task to scheduler with CoAP priority, and let scheduler take care of it.
*/
void uinject_timer_cb(OpenMote* self, opentimer_id_t id){
   
 scheduler_push_task(self, uinject_task_cb,TASKPRIO_COAP);
}