void board_led_off(int led)
{
  switch (led)
    {
      /* These should not happen and are ignored */

      default:
      case 0:
      case 1:
        break;

      /* These will extinguish the BLUE component with no effect on RED and GREEN */

      case 2:
        tiva_gpiowrite(GPIO_LED_B, true);
        break;

      /* These will extinguish the RED component with on effect on RED and GREEN */

      case 3:
      case 4:
        tiva_gpiowrite(GPIO_LED_R, true);
        break;
    }
}
示例#2
0
void board_led_off(int led)
{
/* --------------- ------- ----- ----- ----- ----- ----------
 * STATE           VALUE   LED1  LED2  LED3  LED4
 * --------------- ------- ----- ----- ----- ----- ----------
 * LED_STARTED       1     ON    OFF   NC    NC
 * LED_HEAPALLOCATE  0     NC    NC    NC    NC
 * LED_IRQSENABLED   0     NC    NC    NC    NC
 * LED_STACKCREATED  2     ON    ON    NC    NC
 * LED_INIRQ         0     NC    NC    NC    NC
 * LED_SIGNAL        0     NC    NC    NC    NC
 * LED_ASSERTION     0     NC    NC    NC    NC
 * LED_PANIC         3     ON    OFF   NC    NC  (flashing 2Hz)
 * --------------- ------- ----- ----- ----- ---------------
 *
 * A high output illuminates the LED.
 */

  switch (led)
  {
  case 0: /* No change */
  case 1: /* Will not happen */
  case 2: /* Will not happen */
  default:
    break;

  case 3: /* LED1=ON,  LED2=OFF, LED3=NC, LED4=NC */
    tiva_gpiowrite(GPIO_LED_D1, true);
    tiva_gpiowrite(GPIO_LED_D2, false);
    break;
  }
}
void board_led_on(int led)
{
  switch (led)
    {
      /* All components stay off until the file initialization step */

      default:
      case 0:
        break;

      /* The GREEN component is illuminated at the final initialization step */

      case 1:
        tiva_gpiowrite(GPIO_LED_G, false);
        break;

      /* These will illuminate the BLUE component with on effect no RED and GREEN */

      case 2:
        tiva_gpiowrite(GPIO_LED_B, false);
        break;

      /* This will turn off RED and GREEN and turn RED on */

      case 4:
        tiva_gpiowrite(GPIO_LED_G, true);
        tiva_gpiowrite(GPIO_LED_B, true);

      /* This will illuminate the RED component with no effect on RED and GREEN */

      case 3:
        tiva_gpiowrite(GPIO_LED_R, false);
        break;
    }
}
示例#4
0
void board_userled(int led, bool ledon)
{
  uint32_t ledcfg;

  if (led == BOARD_LED_D1)
    {
      ledcfg = GPIO_LED_D1;
    }
  else if (led == BOARD_LED_D2)
    {
      ledcfg = GPIO_LED_D2;
    }
  else if (led == BOARD_LED_D3)
    {
      ledcfg = GPIO_LED_D3;
    }
  else if (led == BOARD_LED_D4)
    {
      ledcfg = GPIO_LED_D4;
    }
  else
    {
      return;
    }

  tiva_gpiowrite(ledcfg, ledon);
}
示例#5
0
void board_userled_all(uint8_t ledset)
{
  bool ledon;

  ledon = ((ledset & BOARD_LED_D1_BIT) != 0);
  tiva_gpiowrite(GPIO_LED_D1, ledon);

  ledon = ((ledset & BOARD_LED_D2_BIT) != 0);
  tiva_gpiowrite(GPIO_LED_D2, ledon);

  ledon = ((ledset & BOARD_LED_D3_BIT) != 0);
  tiva_gpiowrite(GPIO_LED_D3, ledon);

  ledon = ((ledset & BOARD_LED_D4_BIT) != 0);
  tiva_gpiowrite(GPIO_LED_D4, ledon);
}
void board_led_off(int led)
{
/* --------------- ------- ---- ----- --------------------
 * STATE           VALUE   RED  GREEN BLUE
 * --------------- ------- ---- ----- --------------------
 * LED_STARTED       0     OFF  OFF   ON
 * LED_HEAPALLOCATE  1     NC   NC    NC
 * LED_IRQSENABLED   1     NC   NC    NC
 * LED_STACKCREATED  2     OFF  ON    OFF
 * LED_INIRQ         1     NC   NC    NC
 * LED_SIGNAL        1     NC   NC    NC
 * LED_ASSERTION     1     NC   NC    NC
 * LED_PANIC         3     ON   OFF   OFF (flashing 2Hz)
 * --------------- ------- ---- ----- --------------------
 *
 * A high output illuminates the LED.
 */

 switch (led)
  {
  case 0: /* Will not happen */
  case 1: /* No change */
  case 2: /* Will not happen */
  default:
    break;

  case 3: /* R=OFF, G=OFF, B=OFF */
    /* Previous state was all: R=ON, G=OFF, B=OFF */

    tiva_gpiowrite(GPIO_LED_R, false);
  }
}
示例#7
0
int tiva_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 */

      tiva_gpiowrite(OLEDDC_GPIO, !cmd);
      return OK;
    }

  return -ENODEV;
}
示例#8
0
void tiva_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("tiva_spiselect() Entry");

  if (devid == SPIDEV_MMCSD)
    {
      /* Assert the CS pin to the card */

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

      tiva_gpiowrite(OLEDCS_GPIO, !selected);
    }
#endif
  ssi_dumpgpio("tiva_spiselect() Exit");
}
示例#9
0
void tiva_ssiselect(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");
    if (devid == SPIDEV_MMCSD)
    {
        /* Assert the CS pin to the card */

        ssi_dumpgpio("tiva_ssiselect() before tiva_gpiowrite()");
        tiva_gpiowrite(SDCCS_GPIO, !selected);
        ssi_dumpgpio("tiva_ssiselect() after tiva_gpiowrite()");
    }
}
示例#10
0
void board_autoled_on(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("board_autoled_on: before tiva_gpiowrite()");
        tiva_gpiowrite(LED_GPIO, false);
        led_dumpgpio("board_autoled_on: after tiva_gpiowrite()");
        break;
    }
}
示例#11
0
void board_autoled_off(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("board_autoled_off: before tiva_gpiowrite()");
            tiva_gpiowrite(LED_GPIO, true);
            led_dumpgpio("board_autoled_off: after tiva_gpiowrite()");
          }
        break;
    }
}