Exemplo n.º 1
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_sense_process, ev, data)
{
    struct sense_msg msg;
    PROCESS_BEGIN();

    SENSORS_ACTIVATE(light_sensor);
    SENSORS_ACTIVATE(battery_sensor);
    SENSORS_ACTIVATE(sht11_sensor);

    msg.len = 7;
    msg.clock = clock_time();
#if TIMESYNCH_CONF_ENABLED
    msg.timesynch_time = timesynch_time();
#else /* TIMESYNCH_CONF_ENABLED */
    msg.timesynch_time = 0;
#endif /* TIMESYNCH_CONF_ENABLED */
    msg.light1 = light_sensor.value(LIGHT_SENSOR_PHOTOSYNTHETIC);
    msg.light2 = light_sensor.value(LIGHT_SENSOR_TOTAL_SOLAR);
    msg.temp = sht11_sensor.value(SHT11_SENSOR_TEMP);
    msg.humidity = sht11_sensor.value(SHT11_SENSOR_HUMIDITY);
    msg.rssi = do_rssi();
    msg.voltage = battery_sensor.value(0);

    msg.rssi = do_rssi();

    SENSORS_DEACTIVATE(light_sensor);
    SENSORS_DEACTIVATE(battery_sensor);
    SENSORS_DEACTIVATE(sht11_sensor);

    shell_output(&sense_command, &msg, sizeof(msg), "", 0);
    PROCESS_END();
}
Exemplo n.º 2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(scanner_process, ev, data)
{
  PROCESS_BEGIN();
  /* switch mac layer off, and turn radio on */
  rime_mac->off(0);
  cc2420_on();

  while(1) {
    do_rssi();
    PROCESS_PAUSE();
  }

  PROCESS_END();
}