Exemplo n.º 1
0
/*---------------------------------------------------------------------------*/
static void
init(void)
{
  timer_set(&debouncetimer, 0);
  BUTTON_IRQ_EDGE_SELECTD();

  BUTTON_SELECT();
  BUTTON_MAKE_INPUT();
}
Exemplo n.º 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();
}
Exemplo n.º 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;
}
Exemplo n.º 4
0
/*---------------------------------------------------------------------------*/
static int
configure(int type, int value)
{
  switch(type) {
  case SENSORS_HW_INIT:
    BUTTON_IRQ_EDGE_SELECTD();
    BUTTON_SELECT_IO();
    BUTTON_MAKE_INPUT();
    return 1;
  case SENSORS_ACTIVE:
    if(value) {
      if(!BUTTON_IRQ_ENABLED()) {
        timer_set(&debouncetimer, 0);
        BUTTON_ENABLE_IRQ();
      }
    } else {
      BUTTON_DISABLE_IRQ();
    }
    return 1;
  }
  return 0;
}