Example #1
0
void scheduler_start(OpenMote* self) {
   taskList_item_t* pThisTask;
   while (1) {
      while((self->scheduler_vars).task_list!=NULL) {
         // there is still at least one task in the linked-list of tasks
         
         // the task to execute is the one at the head of the queue
         pThisTask                = (self->scheduler_vars).task_list;
         
         // shift the queue by one task
         (self->scheduler_vars).task_list = pThisTask->next;
         
         // execute the current task
         pThisTask->cb(self);
         
         // free up this task container
         pThisTask->cb            = NULL;
         pThisTask->prio          = TASKPRIO_NONE;
         pThisTask->next          = NULL;
         (self->scheduler_dbg).numTasksCur--;
      }
 debugpins_task_clr(self);
 board_sleep(self);
 debugpins_task_set(self);                      // IAR should halt here if nothing to do
   }
}
Example #2
0
/**
\brief The program starts executing here.
*/
int mote_main(void) {
   
   board_init();
   leds_error_on();
   
   debugpins_frame_set();    some_delay();
   debugpins_frame_toggle(); some_delay();
   debugpins_frame_toggle(); some_delay();
   debugpins_frame_clr();    some_delay();
   
   debugpins_slot_set();     some_delay();
   debugpins_slot_toggle();  some_delay();
   debugpins_slot_toggle();  some_delay();
   debugpins_slot_clr();     some_delay();
   
   debugpins_fsm_set();      some_delay();
   debugpins_fsm_toggle();   some_delay();
   debugpins_fsm_toggle();   some_delay();
   debugpins_fsm_clr();      some_delay();
   
   debugpins_task_set();     some_delay();
   debugpins_task_toggle();  some_delay();
   debugpins_task_toggle();  some_delay();
   debugpins_task_clr();     some_delay();
   
   debugpins_isr_set();      some_delay();
   debugpins_isr_toggle();   some_delay();
   debugpins_isr_toggle();   some_delay();
   debugpins_isr_clr();      some_delay();
   
   debugpins_radio_set();    some_delay();
   debugpins_radio_toggle(); some_delay();
   debugpins_radio_toggle(); some_delay();
   debugpins_radio_clr();    some_delay();
   
   board_reset();
   
   return 0;
}