Beispiel #1
0
static ajoy_buttonset_t ajoy_buttons(FAR const struct ajoy_lowerhalf_s *lower)
{
  ajoy_buttonset_t ret = 0;
  int i;

  /* Read each joystick GPIO value */

  for (i = 0; i < AJOY_NGPIOS; i++)
    {
      /* Button outputs are pulled high. So a sensed low level means that the
       * button is pressed.
       */

      if (!sam_pioread(g_joypio[i]))
        {
          ret |= (1 << i);
        }
    }

  iinfo("Returning: %02x\n", ret);
  return ret;
}
Beispiel #2
0
uint8_t up_buttons(void)
{
  return sam_pioread(PIO_USER1) ? 0 : BUTTON_USER1_BIT;
}
uint8_t board_buttons(void)
{
  return sam_pioread(PIO_BTN_USER) ? 0 : BUTTON_USER_BIT;
}