Exemplo n.º 1
0
void loop(void) {
  // Clear measurement values
  memset(values,0,num_channels);
  // Scan all channels num_reps times
  int rep_counter = num_reps;
  while (rep_counter--)
  {
    int i = num_channels;
    while (i--)
    {
      // Select this channel
      radio.setChannel(i);
      // Listen for a little
      radio.startListening();
      __usleep(128);
      radio.stopListening();
      // Did we get a carrier?
      if ( radio.testCarrier() )
	++values[i];
    }
  }
  // Print out channel measurements, clamped to a single hex digit
  int i = 0;
  while ( i < num_channels )
  {
    printf("%x",min(0xf,values[i]&0xf));
    ++i;
  }
  printf("\n\r");
}
Exemplo n.º 2
0
int
_usleep(useconds_t useconds)
{
	struct pthread *curthread = _get_curthread();
	unsigned int	ret;

	_thr_cancel_enter(curthread);
	ret = __usleep(useconds);
	_thr_cancel_leave(curthread, 1);
	
	return (ret);
}
Exemplo n.º 3
0
/*
 * msleep()
 *	Like sleep, but milliseconds
 */
__msleep(uint msecs)
{
	return(__usleep(msecs * 1000));
}