Beispiel #1
0
void main(void) {
   //configuring
   P1OUT |=  0x04;                               // set P1.2 for debug
   P4DIR  |= 0x20;                               // P4.5 as output (for debug)
   
   gina_init();
   scheduler_init();
   leds_init();
   
   if (*(&eui64+3)==0x09) {                      // this is a GINA board (not a basestation)
      gyro_init();
      large_range_accel_init();
      magnetometer_init();
      sensitive_accel_temperature_init();
   }
   
   radio_init();
   timer_init();
   
   P1OUT &= ~0x04;                               // clear P1.2 for debug
   
   //check sensor configuration is right
   gyro_get_config();
   large_range_accel_get_config();
   magnetometer_get_config();
   sensitive_accel_temperature_get_config();

   //scheduler_push_task(ID_TASK_APPLICATION);
   
   scheduler_register_application_task(&task_application_imu_radio, 0, FALSE);

   scheduler_start();
}
Beispiel #2
0
void main(void) {
   //configuring
   P1OUT |=  0x04;                               // set P1.2 for debug
   P4DIR  |= 0x20;                               // P4.5 as output (for debug)
   
   gina_init();
   scheduler_init();
   leds_init();
   
   if (*(&eui64+3)==0x09) {                      // this is a GINA board (not a basestation)
      magnetometer_init();
   }
   
   radio_init();
   timer_init();
   
   P1OUT &= ~0x04;                               // clear P1.2 for debug
   
   //check sensor configuration is right
   magnetometer_get_config();

   //scheduler_push_task(ID_TASK_APPLICATION);
   
   //initialize variables
   timer_period = 0x033333; //set the timer frequency to 80Hz
   
   for (int c=0;c<9;c++)
   {
     delay[c] = 0;
     out[c] = 0;
   }

   alpha[0]=	0.423466145992279;
   alpha[1]=	0.359764546155930;
   alpha[2]=	0.134587764739990;
   alpha[3]=	0.445259362459183;
   alpha[4]=	0.134587764739990;
   alpha[5]=	0.400678455829620;
   alpha[6]=	0.134587764739990;
   alpha[7]=	0.160087645053864;
   alpha[8]=	0.134587764739990;
   
   //FSM variable initialization
   threshold = 0.1096;
   state = NOCAR; //initial state
   FSMcounter = 0;
   maxCount = 10; //change?
   minCount = 2;
   seenCar=0;
   
   scheduler_register_application_task(&task_application_intersection, 410, TRUE);

   scheduler_start();
}
Beispiel #3
0
int main(void) {
   //configuring
   P1OUT |=  0x04;                               // set P1.2 for debug
   
   gina_init();
   scheduler_init();
   button_init();
   //openwsn_init();
   P1OUT &= ~0x04;                               // clear P1.2 for debug
   
   radio_init();

   radio_rxOn(DEFAULTCHANNEL);

   scheduler_start();
}
Beispiel #4
0
int main(void) {
   char blah;
   
   //initialization
   gina_init();  // initialize hardware
   at_init();    // enable radio
   pwm_init();   // enable timers
   adc_init();   // init Analog-to-Digital (temp+xl)
   i2c_cfg();

   radio_cfg(); // init Radio
   imu_cfg();

   if(at_test()) {
      cmd_mode = CMD_MODE_ERROR;
   }

   cmd_mode = CMD_MODE_IMU_LOOP; //have the mote just blast data
   
   while(1) {
      //radio_cfg();
      //cmd_mode = CMD_MODE_IMU_LOOP; 
      cmd_loop();
      //Collect and send data 
      if (cmd_mode == CMD_MODE_IMU_LOOP) {
         imu_measure();
         imu_send();
         //blah=at_get_reg(RG_ANT_DIV);
         //blah+1;
      }

      //Clear out RX interrupts if we aren't expecting something
      if ((at_state!=AT_STATE_RX_READY && at_state!=AT_STATE_RX_WAITING)) { 
         at_rxmode(0);
         AT_CLR_IRQ;
      }
      PWM_WAIT;  //wait for the 3ms timer
         //Check RX
      if (at_state == AT_STATE_RX_WAITING) {
         at_read(&bytes, &len);
      }
   }
   return 0;
}