/*---------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------------------*/ 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(); }
PROCESS_THREAD(stm32_shell_process, ev, data) { PROCESS_BEGIN(); serial_shell_init(); /* add the shell blink command */ shell_blink_init(); shell_range_init(); PROCESS_END(); }
/*---------------------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------*/ 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(test_shell_process, ev, data) { PROCESS_BEGIN(); serial_shell_init(); shell_coffee_init(); shell_exec_init(); shell_file_init(); shell_ps_init(); shell_rime_init(); shell_rime_netcmd_init(); shell_text_init(); PROCESS_END(); }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(sky_shell_process, ev, data) { PROCESS_BEGIN(); /* WITH_UIP=1 assumes incoming SLIP serial data. * We override this assumption by restoring default serial input handler. */ uart1_set_input(serial_line_input_byte); serial_line_init(); serial_shell_init(); shell_file_init(); shell_wget_init(); shell_text_init(); PROCESS_END(); }
PROCESS_THREAD(demo_6lbr_process, ev, data) { PROCESS_BEGIN(); #if SHELL uart1_set_input(serial_line_input_byte); serial_line_init(); serial_shell_init(); shell_ping_init(); shell_6lbr_init(); #else start_apps(); #endif 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(); }
/*---------------------------------------------------------------------------*/ 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(matlab_sleep_respond_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_matlab_response_protocol_init(); PROCESS_END(); }
/*---------------------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(example_shell_process, ev, data) { PROCESS_BEGIN(); //rs232_set_input(RS232_PORT_0, serial_line_input_byte); serial_shell_init(); //mmem_init(); shell_base64_init(); //shell_blink_init(); ///*shell_checkpoint_init();*/ shell_coffee_init(); //shell_download_init(); ///*shell_exec_init();*/ shell_file_init(); //shell_httpd_init(); //shell_irc_init(); //shell_netfile_init(); ///*shell_ping_init();*/ /* uIP ping */ //shell_power_init(); ///*shell_profile_init();*/ //shell_ps_init(); ///*shell_reboot_init();*/ //shell_rime_debug_init(); //shell_rime_netcmd_init(); //shell_rime_ping_init(); /* Rime ping */ //shell_rime_sendcmd_init(); //shell_rime_sniff_init(); //shell_rime_init(); ///*shell_rsh_init();*/ //shell_run_init(); //shell_sendtest_init(); ///*shell_sky_init();*/ //shell_tcpsend_init(); //shell_text_init(); //shell_time_init(); //shell_udpsend_init(); //shell_vars_init(); //shell_wget_init(); //shell_tweet_init(); PROCESS_END(); }
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(); }
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(); }
void shell_sdr_init(void) { memb_init(&broadcast_mem); memb_init(&unicast_mem); memb_init(&runicast_mem); list_init(broadcast_list); list_init(unicast_list); list_init(runicast_list); serial_shell_init(); shell_register_command(&bc_open_command); shell_register_command(&bc_close_command); shell_register_command(&bc_send_command); shell_register_command(&uc_open_command); shell_register_command(&uc_close_command); shell_register_command(&uc_send_command); shell_register_command(&ruc_open_command); shell_register_command(&ruc_close_command); shell_register_command(&ruc_send_command); }
/*---------------------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------------------*/ 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_sky_init();*/ shell_text_init(); /*shell_time_init();*/ /* shell_checkpoint_init();*/ shell_exec_init(); PROCESS_END(); }
/*---------------------------------------------------------------------------*/ PROCESS_THREAD(netperf_shell_process, ev, data) { PROCESS_BEGIN(); 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_sniff_init(); shell_text_init(); shell_time_init(); shell_sendtest_init(); shell_netperf_init(); PROCESS_END(); }
PROCESS_THREAD(accel_process, ev, data) { PROCESS_BEGIN(); { int16_t x, y, z; serial_shell_init(); shell_ps_init(); shell_file_init(); // for printing out files shell_text_init(); // for binprint /* Register the event used for lighting up an LED when interrupt strikes. */ ledOff_event = process_alloc_event(); /* Start and setup the accelerometer with default values, eg no interrupts enabled. */ accm_init(); /* Register the callback functions for each interrupt */ ACCM_REGISTER_INT1_CB(accm_ff_cb); ACCM_REGISTER_INT2_CB(accm_tap_cb); /* Set what strikes the corresponding interrupts. Several interrupts per pin is possible. For the eight possible interrupts, see adxl345.h and adxl345 datasheet. */ accm_set_irq(ADXL345_INT_FREEFALL, ADXL345_INT_TAP + ADXL345_INT_DOUBLETAP); while (1) { x = accm_read_axis(X_AXIS); y = accm_read_axis(Y_AXIS); z = accm_read_axis(Z_AXIS); printf("x: %d y: %d z: %d\n", x, y, z); etimer_set(&et, ACCM_READ_INTERVAL); PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); } } PROCESS_END(); }
/*---------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------*/ 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(); }
/*---------------------------------------------------------------*/ 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(); }