Esempio n. 1
0
FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno)
{
  FAR struct spi_dev_s *spi;
  FAR struct lcd_dev_s *dev;

  /* Configure the OLED GPIOs. For the SPI interface, insert jumpers in J42,
   * J43, J45 pin1-2 and J46 pin 1-2.
   */
 
  oledcs_dumpgpio("up_nxdrvinit: After OLED CS setup");
  oleddc_dumpgpio("up_nxdrvinit: On entry");

  (void)lpc17_configgpio(LPCXPRESSO_OLED_POWER); /* OLED 11V power */
  (void)lpc17_configgpio(LPCXPRESSO_OLED_DC);    /* OLED Command/Data */

  oleddc_dumpgpio("up_nxdrvinit: After OLED Power/DC setup");

  /* Get the SSI port (configure as a Freescale SPI port) */

  spi = up_spiinitialize(1);
  if (!spi)
    {
      glldbg("Failed to initialize SSI port 1\n");
    }
  else
    {
      /* Bind the SSI port to the OLED */

      dev = ug_initialize(spi, devno);
      if (!dev)
        {
          glldbg("Failed to bind SSI port 1 to OLED %d: %d\n", devno);
        }
     else
        {
          gllvdbg("Bound SSI port 1 to OLED %d\n", devno);

          /* And turn the OLED on (dim) */

          (void)dev->setpower(dev, UG_POWER_DIM);
          return dev;
        }
    }
  return NULL;
}
Esempio n. 2
0
FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno)
{
  FAR struct spi_dev_s *spi;
  FAR struct lcd_dev_s *dev;

  /* Configure the OLED GPIOs */

  oledcs_dumpgpio("board_graphics_setup: After OLEDCS setup");
  oleddc_dumpgpio("board_graphics_setup: On entry");

  tiva_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */
  tiva_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */

  oleddc_dumpgpio("board_graphics_setup: After OLEDDC/EN setup");

  /* Get the SSI port (configure as a Freescale SPI port) */

  spi = up_spiinitialize(0);
  if (!spi)
    {
      glldbg("Failed to initialize SSI port 0\n");
    }
  else
    {
      /* Bind the SSI port to the OLED */

      dev = rit_initialize(spi, devno);
      if (!dev)
        {
          glldbg("Failed to bind SSI port 0 to OLED %d: %d\n", devno);
        }
     else
        {
          gllvdbg("Bound SSI port 0 to OLED %d\n", devno);

          /* And turn the OLED on (CONFIG_LCD_MAXPOWER should be 1) */

          (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER);
          return dev;
        }
    }

  return NULL;
}