Пример #1
0
void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
{
  ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
  ssi_dumpgpio("lm3s_spiselect() Entry");
  if (devid == SPIDEV_MMCSD)
    {
      /* Assert the CS pin to the card */

      lm3s_gpiowrite(SDCCS_GPIO, !selected);
    }
#ifdef CONFIG_NX_LCDDRIVER
  else if (devid == SPIDEV_DISPLAY)
    {
      /* Assert the CS pin to the display */

      lm3s_gpiowrite(OLEDCS_GPIO, !selected);
    }
#endif
  ssi_dumpgpio("lm3s_spiselect() Exit");
}
Пример #2
0
int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
{
  if (devid == SPIDEV_DISPLAY)
    {
      /* Set GPIO to 1 for data, 0 for command */

      lm3s_gpiowrite(OLEDDC_GPIO, !cmd);
      return OK;
    }
  return -ENODEV;
}
Пример #3
0
void up_ledon(int led)
{
    switch (led)
    {
    case LED_STARTED:
    case LED_HEAPALLOCATE:
    default:
        break;

    case LED_INIRQ:
    case LED_SIGNAL:
    case LED_ASSERTION:
    case LED_PANIC:
        g_nest++;
    case LED_IRQSENABLED:
    case LED_STACKCREATED:
        led_dumpgpio("up_ledon: before lm3s_gpiowrite()");
        lm3s_gpiowrite(LED1_GPIO, false);
        led_dumpgpio("up_ledon: after lm3s_gpiowrite()");
        break;
    }
}
Пример #4
0
void up_ledoff(int led)
{
    switch (led)
    {
    case LED_IRQSENABLED:
    case LED_STACKCREATED:
    case LED_STARTED:
    case LED_HEAPALLOCATE:
    default:
        break;

    case LED_INIRQ:
    case LED_SIGNAL:
    case LED_ASSERTION:
    case LED_PANIC:
        if (--g_nest <= 0)
        {
            led_dumpgpio("up_ledoff: before lm3s_gpiowrite()");
            lm3s_gpiowrite(LED1_GPIO, true);
            led_dumpgpio("up_ledoff: after lm3s_gpiowrite()");
        }
        break;
    }
}