示例#1
0
static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler, xcpt_t *store)
{
  xcpt_t oldhandler;
  irqstate_t flags;

  /* Disable interrupts until we are done.  This guarantees that the following
   * operations are atomic.
   */

  flags = irqsave();

  /* Get the old button interrupt handler and save the new one */

  oldhandler = *store;
  *store = irqhandler;

  /* Configure the interrupt */

  sam3u_gpioirq(irq);
  (void)irq_attach(irq, irqhandler);
  sam3u_gpioirqenable(irq);
  irqrestore(flags);

  /* Return the old button handler (so that it can be restored) */

  return oldhandler;
}
示例#2
0
int arch_tcinitialize(int minor)
{
  FAR struct spi_dev_s *dev;
  int ret;

  idbg("minor %d\n", minor);
  DEBUGASSERT(minor == 0);

  /* Configure and enable the ADS7843E interrupt pin as an input */

  (void)sam3u_configgpio(GPIO_TCS_BUSY);
  (void)sam3u_configgpio(GPIO_TCS_IRQ);

  /* Configure the PIO interrupt */

  sam3u_gpioirq(GPIO_TCS_IRQ);

  /* Get an instance of the SPI interface */

  dev = up_spiinitialize(CONFIG_ADS7843E_SPIDEV);
  if (!dev)
    {
      idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
      return -ENODEV;
    }

  /* Initialize and register the SPI touschscreen device */

  ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
  if (ret < 0)
    {
      idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
      /* up_spiuninitialize(dev); */
      return -ENODEV;
    }

  return OK;
}