Beispiel #1
0
static void incoming_packet(void) {
    int length = packetbuf_totlen();
    int noise = cc2420_rssi();
    int crc_ok = -1;
    int rssi = packetbuf_attr(PACKETBUF_ATTR_RSSI);
    int lqi = packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY);

    noise = cc2420_rssi();
    dump_packet(packetbuf_dataptr(), length, crc_ok, rssi, noise, lqi);
}
Beispiel #2
0
static int
do_rssi(void)
{
  static int sample;
  int channel;
  
  NETSTACK_MAC.off(0);

  cc2420_on();
  for(channel = 11; channel <= 26; ++channel) {
    cc2420_set_channel(channel);
    rssi_samples[sample].channel[channel - 11] = cc2420_rssi() + 53;
  }
  
  NETSTACK_MAC.on();
  
  sample = (sample + 1) % NUM_SAMPLES;

  {
    int channel, tot;
    tot = 0;
    for(channel = 0; channel < 16; ++channel) {
      int max = -256;
      int i;
      for(i = 0; i < NUM_SAMPLES; ++i) {
	max = MAX(max, rssi_samples[i].channel[channel]);
      }
      tot += max / 20;
    }
    return tot;
  }
}
Beispiel #3
0
static void
do_rssi(void)
{
  int channel;
  printf("RSSI:");
  for(channel = 0; channel <= 85; ++channel) {
    set_frq(channel);
    printf("%d ", cc2420_rssi() + 55);
  }
  printf("\n");
}
Beispiel #4
0
/*---------------------------------------------------------------*/
static void scan_channel(void)
{
	uint i = 0;
	int rx_power = 0;
	for(i = 11; i <= 26; i++)
	{
		cc2420_set_channel(i);
		rx_power = cc2420_rssi()-45;
		printf("Channel %u: %d dBm\n",i,rx_power);
	}
	printf("\n");
	ctimer_reset(&ct);
}