/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_shell_process, ev, data)
{
    PROCESS_BEGIN();

    serial_shell_init();
    shell_blink_init();
    shell_file_init();
    shell_coffee_init();
    shell_ps_init();
    shell_reboot_init();
    shell_rime_init();
    /*  shell_rime_debug_init();*/
    shell_rime_netcmd_init();
    /*   shell_rime_ping_init(); */
    shell_rime_neighbors_init();
    shell_rime_sendcmd_init();
    /*  shell_rime_sniff_init();*/
    shell_rime_unicast_init();
    /*shell_sky_init();*/
    shell_text_init();
    shell_time_init();

    SENSORS_ACTIVATE(acc_sensor);
    shell_register_command(&acc_command);
    shell_register_command(&poke_command);
    shell_register_command(&peek_command);
    shell_register_command(&leds_command);

    PROCESS_END();
}
Exemple #2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_telnetd_process, ev, data)
{
  PROCESS_BEGIN();

  PROCESS_PAUSE();

  shell_blink_init();
  /*  shell_file_init();
      shell_netfile_init();*/
  shell_ps_init();
  shell_reboot_init();
  /*shell_rime_init();*/
  /*shell_rime_ping_init();*/
  /*shell_rime_netcmd_init();*/
  /*shell_rime_sniff_init();*/
  shell_sky_init();
  shell_text_init();
  shell_time_init();

  shell_register_command(&id_command);

  while(1) {
    PROCESS_WAIT_EVENT();
  }

  PROCESS_END();

}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(collect_view_shell_process, ev, data)
{
  PROCESS_BEGIN();

  serial_shell_init();
  shell_blink_init();

#if WITH_COFFEE
  shell_file_init();
  shell_coffee_init();
#endif /* WITH_COFFEE */

  /* shell_download_init(); */
  /* shell_rime_sendcmd_init(); */
  /* shell_ps_init(); */
  shell_reboot_init();
  shell_rime_init();
  shell_rime_netcmd_init();
  /* shell_rime_ping_init(); */
  /* shell_rime_debug_init(); */
  /* shell_rime_debug_runicast_init(); */
  shell_powertrace_init();
  /* shell_base64_init(); */
  shell_text_init();
  shell_time_init();
  /* shell_sendtest_init(); */

#if CONTIKI_TARGET_SKY
  shell_sky_init();
#endif /* CONTIKI_TARGET_SKY */

  shell_collect_view_init();

  PROCESS_END();
}
Exemple #4
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_shell_process, ev, data)
{
  PROCESS_BEGIN();

  /* XXX the Sentilla JCreate has 8 LEDs, and we need to set the ports
     correctly. */
  LEDS_PxDIR = 0xff;
  LEDS_PxOUT = 0xff;
  
  serial_shell_init();
  shell_blink_init();
  shell_file_init();
  shell_coffee_init();
  shell_ps_init();
  shell_reboot_init();
  shell_rime_init();
  /*  shell_rime_debug_init();*/
  shell_rime_netcmd_init();
  shell_rime_ping_init();
  shell_rime_neighbors_init();
  shell_rime_sendcmd_init();
  /*  shell_rime_sniff_init();*/
  shell_rime_unicast_init();
  /*shell_sky_init();*/
  shell_text_init();
  shell_time_init();

  acc_sensor.activate();
  shell_register_command(&acc_command);
  shell_register_command(&poke_command);
  shell_register_command(&peek_command);
  shell_register_command(&leds_command);
  
  PROCESS_END();
}
Exemple #5
0
/*---------------------------------------------------------------*/
PROCESS_THREAD(null_app_process, ev, data)
{
	PROCESS_BEGIN();
	printf("ADXL335 Started\n");

#ifdef SF_FEATURE_SHELL_OPT
	serial_shell_init();
	remote_shell_init();
	shell_reboot_init();
	shell_blink_init();
	shell_sky_init();

#endif

	//static uint8_t MPU_status3 = 0;

	app_conn_open(&nullApp_callback);

	if (node_id > 0)
	{
		ADC_status = 0;

		adxl_enable();

		// start sampling
		ctimer_set(&ct,SAMPLE_RATE,sample_fun,(void*)NULL);
		ctimer_set(&reset_timer,SAMPLE_RATE*50,reset_sample_timer,(void*)NULL);
	}


	PROCESS_END();
}
Exemple #6
0
void
commands_init()
{
  // contiki commands
  shell_reboot_init();
  
  // own commands
  shell_register_command(&radio_power_command);
  shell_register_command(&subscribe_command);
  shell_register_command(&unsubscribe_command);
  shell_register_command(&print_neigh_command);
}
Exemple #7
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(mb851_shell_process, ev, data)
{
  PROCESS_BEGIN();

  serial_shell_init();
  shell_blink_init();
  shell_ps_init();
  shell_reboot_init();
  shell_text_init();
  shell_time_init();
  shell_sensors_init();
  
  PROCESS_END();
}
Exemple #8
0
/*---------------------------------------------------------------*/
PROCESS_THREAD(null_app_process, ev, data)
{
	PROCESS_BEGIN();
	printf("MPU6050 ACC Started\n");

#ifdef SF_FEATURE_SHELL_OPT
	serial_shell_init();
	remote_shell_init();
	shell_reboot_init();
	shell_blink_init();
	shell_sky_init();
	
#endif

	static uint8_t MPU_status2 = 0;
	uint8_t i;

	app_conn_open(&nullApp_callback);

	if (node_id != 0)
	{
		MPU_status2 = 0;
		for(i = 0; i < 100 &(~MPU_status2);i++)
		{
			MPU_status2 = mpu_enable();
		}

		if(MPU_status2 == 0)
		{
			printf("MPU could not be enabled\n");
		}

		MPU_status2 = 0;
		for(i = 0; i < 100 &(~MPU_status2);i++)
		{
			MPU_status2 = mpu_wakeup();
		}

		if(MPU_status2 == 0)
		{
			printf("MPU could not be awakened\n");
		}

		ctimer_set(&ct,SAMPLE_RATE,sample_fun,(void*)NULL);
	}

	PROCESS_END();
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(virtualsense_shell_process, ev, data)
{
  PROCESS_BEGIN();

#if WITH_PERIODIC_DEBUG
  ctimer_set(&debug_timer, 20 * CLOCK_SECOND, periodic_debug, NULL);
#endif /* WITH_PERIODIC_DEBUG */

  serial_shell_init();
  shell_reboot_init();
  shell_gateway_init(NULL);

#if DEBUG_SNIFFERS
  rime_sniffer_add(&s);
#endif /* DEBUG_SNIFFERS */
  
  PROCESS_END();
}
PROCESS_THREAD(sleepy_trilateration_matlab_process, ev, data)
{
	PROCESS_BEGIN();
	serial_shell_init();
	shell_blink_init();
	shell_reboot_init();
	shell_rime_init();
	shell_rime_netcmd_init();
	shell_text_init();
	shell_time_init();
	shell_sky_init();
	shell_collect_view_init();

	shell_global_sensor_init();
	shell_sleepy_trilateration_matlab_init();

	PROCESS_END();
}
Exemple #11
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(adaptive_cusum_process, ev, data)
{
	PROCESS_BEGIN();
	serial_shell_init();
	shell_blink_init();
	shell_reboot_init();
	shell_rime_init();
	shell_rime_netcmd_init();
	shell_text_init();
	shell_time_init();
	shell_sky_init();
	shell_collect_view_init();

	shell_adaptive_cusum_init();
	shell_global_sensor_init();
	shell_sample_stats_init();

	PROCESS_END();
}
Exemple #12
0
PROCESS_THREAD(gaussian_cusum_process, ev, data) {
	PROCESS_BEGIN();
	serial_shell_init();
	shell_blink_init();
	shell_reboot_init();
	shell_rime_init();
//	shell_rime_netcmd_init();
	shell_text_init();
	shell_time_init();
	shell_sky_init();
	shell_collect_view_init();

	// Here's where it differs from the normal collect-view program.	
	shell_sleepy_cusum_init();
	shell_global_sensor_init();
	shell_sample_stats_init();

	PROCESS_END();
}
Exemple #13
0
PROCESS_THREAD(rssi_measure_process, ev, data)
{
	PROCESS_BEGIN();
	serial_shell_init();
	shell_blink_init();
	shell_reboot_init();
	shell_rime_init();
	shell_rime_netcmd_init();
	shell_powertrace_init();
	shell_text_init();
	shell_time_init();
	shell_sky_init();
	shell_collect_view_init();

// Here's where it differs from the normal collect-view program
	shell_rssi_measure_init();

	PROCESS_END();
}
Exemple #14
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_shell_process, ev, data)
{
  PROCESS_BEGIN();

#if WITH_PERIODIC_DEBUG
  ctimer_set(&debug_timer, 20 * CLOCK_SECOND, periodic_debug, NULL);
#endif /* WITH_PERIODIC_DEBUG */

  serial_shell_init();
  shell_blink_init();
  /*  shell_file_init();
      shell_coffee_init();*/
  /*  shell_download_init();*/
  shell_rime_sendcmd_init();
  /*  shell_ps_init();*/
  shell_reboot_init();
  shell_rime_init();
  shell_rime_netcmd_init();
  /*  shell_rime_ping_init();
  shell_rime_debug_init();
  shell_rime_debug_runicast_init();*/
  /*  shell_rime_sniff_init();*/
  shell_sky_init();
  shell_power_init();
  shell_powertrace_init();
  /*  shell_base64_init();*/
  shell_text_init();
  shell_time_init();
  /*  shell_sendtest_init();*/

  shell_collect_view_init();

#if DEBUG_SNIFFERS
  rime_sniffer_add(&s);
#endif /* DEBUG_SNIFFERS */
  
  PROCESS_END();
}
Exemple #15
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(sky_shell_process, ev, data)
{
  PROCESS_BEGIN();

  serial_shell_init();
  shell_blink_init();
  shell_file_init();
  shell_coffee_init();
  shell_ps_init();
  shell_reboot_init();
  shell_rime_init();
  /*shell_rime_netcmd_init();*/
  /*shell_rime_ping_init();*/
  /*shell_rime_debug_init();*/
  /*shell_rime_sniff_init();*/
  shell_rime_sendcmd_init();
  shell_download_init();
  shell_sky_init();
  shell_text_init();
  shell_time_init();
  shell_checkpoint_init();

  PROCESS_END();
}
Exemple #16
0
/*---------------------------------------------------------------*/
PROCESS_THREAD(null_app_process, ev, data)
{
	PROCESS_BEGIN();
	printf("MPU6050 Started\n");

#ifdef SF_FEATURE_SHELL_OPT
	serial_shell_init();
	remote_shell_init();
	shell_reboot_init();
	shell_blink_init();
	shell_sky_init();

#endif

	uint8_t i;

	app_conn_open(&nullApp_callback);

	if (node_id > 0)
	{
		MPU_status = 0;
		for(i = 0; i < 100 &(~MPU_status);i++)
		{
			MPU_status = mpu_enable();
		}

		if(MPU_status == 0)
		{
			printf("MPU could not be enabled\n");
		}

		MPU_status = 0;
		for(i = 0; i < 100 &(~MPU_status);i++)
		{
			MPU_status = mpu_wakeup();
		}

		if(MPU_status == 0)
		{
			printf("MPU could not be awakened\n");
		}

		/* configurate MPU6050 sensor */
		uint8_t MPU_config = 0;

		// disable sleep model
		read_mpu_reg(MPU_RA_PWR_MGMT1,&MPU_config);
		MPU_config = MPU_config & ~BV(6); // set bit 6 to 0
		write_mpu_reg(MPU_RA_PWR_MGMT1,MPU_config);
#if DEBUG
		read_mpu_reg(MPU_RA_PWR_MGMT1,&MPU_config);
		PRINTF("power management 1: %u\n",MPU_config);
#endif
		// disable cycle
		read_mpu_reg(MPU_RA_PWR_MGMT1,&MPU_config);
		MPU_config = MPU_config & ~BV(5); // set bit 5 to 0
		write_mpu_reg(MPU_RA_PWR_MGMT1,MPU_config);
#if DEBUG
		read_mpu_reg(MPU_RA_PWR_MGMT1,&MPU_config);
		PRINTF("power management 1: %u\n",MPU_config);
#endif

		// gyro range: -/+ 250 degree/sec
		read_mpu_reg(MPU_GYRO_CONFIG,&MPU_config);
		MPU_config = MPU_config & ~BV(3); // set bit 3 to zero
		write_mpu_reg(MPU_GYRO_CONFIG,MPU_config);
#if DEBUG
		read_mpu_reg(MPU_GYRO_CONFIG,&MPU_config);
		PRINTF("Gyro config: %u\n",MPU_config);
#endif

		// accelerometer range: -/+ 2g
		read_mpu_reg(MPU_ACCEL_CONFIG,&MPU_config);
		MPU_config = MPU_config & ~BV(3); // set bit 3 to zero -/+ 2g
		//MPU_config = MPU_config | BV(4); // set bit 4 to one -/+ 8g
		write_mpu_reg(MPU_ACCEL_CONFIG,MPU_config);
		read_mpu_reg(MPU_ACCEL_CONFIG,&MPU_config);
		printf("Acceleromter config: %u\n",MPU_config);

		// LPF: cut-off 21Hz for accel and 20Hz for gyro; DLPF_CFG = 4
		read_mpu_reg(MPU_CONFIG,&MPU_config);
		MPU_config = MPU_config | BV(2); // set bit 2 to 1, DLPF_CFG = 4
		write_mpu_reg(MPU_CONFIG,MPU_config);
#if DEBUG
		read_mpu_reg(MPU_CONFIG,&MPU_config);
		PRINTF("MPU 6050 config: %u\n",MPU_config);
#endif

		// sampling rate 1kHz
		write_mpu_reg(MPU_SMPLRT_DIV,0);
#if DEBUG
		read_mpu_reg(MPU_SMPLRT_DIV,&MPU_config);
		PRINTF("sample divider: %u\n",MPU_config);
#endif

		// start sampling
		ctimer_set(&ct,SAMPLE_RATE,sample_fun,(void*)NULL);
		ctimer_set(&reset_timer,SAMPLE_RATE*50,reset_sample_timer,(void*)NULL);
	}
	else
	{
		print_MPU = 1;
	}

	PROCESS_END();
}
Exemple #17
0
/*---------------------------------------------------------------*/
PROCESS_THREAD(null_app_process, ev, data)
{

	static struct etimer rxtimer;

	PROCESS_BEGIN();


	printf("Hello world Started.\n");

#ifdef SF_FEATURE_SHELL_OPT
	serial_shell_init();
	remote_shell_init();
	shell_reboot_init();
	shell_blink_init();
	shell_sky_init();
#endif

	app_conn_open(&nullApp_callback);


#ifdef ADC_SENSOR
	static uint16_t samples[ADC_SAMPLES_PER_FRAME]={0};
	uint8_t i;
//	static uint8_t samples_sorted_bytes[2*ADC_SAMPLES_PER_FRAME];
	static uint8_t sample_num = 0; //increments from 0 to samples_per_frame-1


	if (node_id != 0){
		adc_on();
		//adc_configure(0); //to sample reference voltage (Vref/2), ~2048.
		etimer_set( &rxtimer, (unsigned long)(CLOCK_SECOND/(ADC_SAMPLING_FREQ)));
	}
	else
		etimer_set(&rxtimer,CLOCK_SECOND/20);

	if(node_id != 0)
	{

	  while(1)
	  {

	    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&rxtimer));
	    etimer_reset(&rxtimer);

	    samples[sample_num]=adc_sample();
	    sample_num++;
	    if(sample_num == ADC_SAMPLES_PER_FRAME){
	    	sample_num=0;
	    	/*
	    	 * Byte order needs to be reversed because of low-endian system.
	    	 * Can be done at AP level too, if needed.
	    	 */
	    	// for(i=0;i<ADC_SAMPLES_PER_FRAME;i++){
	    	// 	samples_sorted_bytes[2*i]=(samples[i]>>8);
	    	// 	samples_sorted_bytes[2*i+1]= (samples[i]& 0xff);
	    	// }


	    	//app_conn_send(samples_sorted_bytes,sizeof(uint8_t)*ADC_SAMPLES_PER_FRAME*2);
	    	 tdma_rdc_buf_ptr = 0;
	    	 tdma_rdc_buf_send_ptr = 0;
	    	 tdma_rdc_buf_full_flg = 0;
	    	 app_conn_send(samples,sizeof(uint16_t)*ADC_SAMPLES_PER_FRAME/sizeof(uint8_t));
	    }

	  }
	}
#endif


#ifdef I2C_SENSOR
	//static rtimer_clock_t rt, del;
	int i;
	static uint8_t MPU_status = 0;
	static uint8_t sample_count = 0;
/*
	static uint8_t samples_sorted_bytes[14*MPU_SAMPLES_PER_FRAME],comp_samples_sorted_bytes[14*MPU_SAMPLES_PER_FRAME];
	static uint8_t sample_num=0, uncomp_data_len=14*MPU_SAMPLES_PER_FRAME,comp_data_len;
	static uint8_t *st;
*/


	static mpu_data sampleArray[MPU_SAMPLES_PER_FRAME];

	if (node_id != 0){

		MPU_status = 0;
		for(i = 0; i < 100 & (~MPU_status);i++)
		{
			MPU_status = mpu_enable();
		}

		if (MPU_status == 0)
			printf("MPU could not be enabled.\n");


		MPU_status = 0;
		for(i = 0; i < 100 & (~MPU_status);i++)
		{
			MPU_status = mpu_wakeup();
		}

		if (MPU_status == 0)
			printf("MPU could not be awakened.\n");

		etimer_set(&rxtimer, (unsigned long)(CLOCK_SECOND/MPU_SAMPLING_FREQ));
		}
	else
		etimer_set(&rxtimer,CLOCK_SECOND/20);

	if(node_id != 0)
	{

		while(1){
			PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&rxtimer));
			etimer_reset(&rxtimer);

			mpu_data_union samples;
			int m=mpu_sample_all(&samples);
			app_conn_send((uint8_t *)(&samples),MPU_DATA_SIZE);
/*
			sampleArray[sample_count] = samples.data;

			sample_count = sample_count + 1;

			if(sample_count == MPU_SAMPLES_PER_FRAME)
			{
				sample_count = 0;
				tdma_rdc_buf_clear();

				app_conn_send(sampleArray,MPU_DATA_SIZE*MPU_SAMPLES_PER_FRAME);

			}
*/
/*
			st = &samples;
			for(i=0;i<7;i++){
				samples_sorted_bytes[2*i+14*sample_num]=*(st+2*i+1);
				samples_sorted_bytes[2*i+1+14*sample_num]= *(st+2*i);
			}
			sample_num++;

			if(sample_num==MPU_SAMPLES_PER_FRAME){
				sample_num=0;

				app_conn_send(samples_sorted_bytes,sizeof(uint8_t)*14*MPU_SAMPLES_PER_FRAME);
			}

			PRINTF("%d,%d,%d,%d,%d,%d,%d\n",samples.data.accel_x,samples.data.accel_y,samples.data.accel_z,samples.data.gyro_x,samples.data.gyro_y,
				samples.data.gyro_z,samples.data.temperature);
*/
//			app_conn_send(&samples,sizeof(mpu_data)/sizeof(uint8_t));
		}
	}

#endif

	PROCESS_END();

}
Exemple #18
0
/*---------------------------------------------------------------*/
PROCESS_THREAD(null_app_process, ev, data)
{
	PROCESS_BEGIN();
	printf("Sine Wave Started\n");

	serial_shell_init();
	remote_shell_init();
	shell_reboot_init();
	shell_blink_init();
	shell_sky_init();
	

	app_conn_open(&nullApp_callback);
/*
	if (node_id != 0)
		etimer_set(&et,16);
	else
		etimer_set(&et,200);
*/
	if (node_id != 0)
	{
		ctimer_set(&ct,10,sample_fun,(void*)NULL);
/*
		while(1)
		{
			PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
			etimer_reset(&et);
			uint8_t i;
			for(i = 0; i < 6; i++)
			{
				data_buf[i] = sinI(counter);
				counter++;
			}
			app_conn_send((uint8_t *)data_buf,6*sizeof(int8_t));
		}
*/
	}
/*
	else
	{
		while(1)
		{
			PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
			etimer_reset(&et);
		}
		
	}
*/



/*
	int8_t data_buf[6] = {0};
	static struct etimer et;
	//static uint16_t counter = 0;
	uint8_t i;

	etimer_set(&et,(unsigned long)102);

	if (node_id != 0)
	{
		while(1)
		{
			//etimer_set(&et,(unsigned long)102);
			//printf("here 1\n");
			printf("1timer start %lu interval %lu process %s\n",et.timer.start,et.timer.interval,et.p->name);
			PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));

			printf("if expired %u\n",etimer_expired(&et));

			etimer_reset(&et);

			printf("2timer start %lu interval %lu process %s\n",et.timer.start,et.timer.interval,et.p->name);
			printf("next timer start %lu interval %lu process %s\n",et.next->timer.start,et.next->timer.interval,et.next->p->name);


			for(i = 0; i < 6; i++)
			{
				data_buf[i] = sinI(counter);
				counter++;
			}


			printf("here 3\n");
			app_conn_send((uint8_t *)data_buf,6*sizeof(int8_t));
			printf("here 4\n");
		}
	}
*/
	PROCESS_END();
}