Пример #1
0
/*---------------------------------------------------------------------------*/
static void
init(void)
{
  timer_set(&debouncetimer, 0);
  BUTTON_IRQ_EDGE_SELECTD();

  BUTTON_SELECT();
  BUTTON_MAKE_INPUT();
}
Пример #2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(buttonIT_process, ev, data)
{
  PROCESS_BEGIN();

  BUTTON_IRQ_EDGE_SELECTD();
  BUTTON_SELECT();
  BUTTON_MAKE_INPUT();
  BUTTON_SET_HANDLER();
  BUTTON_ENABLE_IRQ();
  while (1)
  {
    PROCESS_PAUSE();
    leds_on(LEDS_BLUE);
    delay();
    leds_off(LEDS_BLUE);
    delay();
  }

  PROCESS_END();
}
Пример #3
0
/*---------------------------------------------------------------------------*/
static int
configure(int type, int c)
{switch (type) {
  case SENSORS_ACTIVE:
    if (c) {
      if(!status(SENSORS_ACTIVE)) {
	timer_set(&debouncetimer, 0);
	BUTTON_IRQ_EDGE_SELECTD();

	BUTTON_SELECT();
	BUTTON_MAKE_INPUT();

	BUTTON_ENABLE_IRQ();
      }
    } else {
      BUTTON_DISABLE_IRQ();
    }
    return 1;
  }
  return 0;
}