コード例 #1
0
ファイル: up_nsh.c プロジェクト: FreddieChopin/NuttX
static void kinetis_mediachange(void)
{
  bool inserted;

  /* Get the current value of the card detect pin.  This pin is pulled up on
   * board.  So low means that a card is present.
   */

  inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);

  /* Has the pin changed state? */

  if (inserted != g_nsh.inserted)
    {
      /* Yes.. perform the appropriate action (this might need some debounce). */

      g_nsh.inserted = inserted;
      sdhc_mediachange(g_nsh.sdhc, inserted);

      /* If the card has been inserted, then check if it is write protected
       * as well.  The pin is pulled up, but apparently logic high means
       * write protected.
       */

      if (inserted)
        {
          sdhc_wrprotect(g_nsh.sdhc, kinetis_gpioread(GPIO_SD_WRPROTECT));
        }
    }
}
コード例 #2
0
ファイル: sdhc.c プロジェクト: AlexisTM/Firmware
static void fmuk66_mediachange(struct fmuk66_sdhc_state_s *sdhc)
{
	bool inserted;

	/* Get the current value of the card detect pin.  This pin is pulled up on
	 * board.  So low means that a card is present.
	 */

	inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
	mcinfo("inserted: %s\n", inserted ? "Yes" : "No");

	/* Has the pin changed state? */

	if (inserted != sdhc->inserted) {
		mcinfo("Media change: %d->%d\n",  sdhc->inserted, inserted);

		/* Yes.. perform the appropriate action (this might need some debounce). */

		sdhc->inserted = inserted;
		sdhc_mediachange(sdhc->sdhc, inserted);

#ifdef CONFIG_FMUK66_SDHC_AUTOMOUNT
		/* Let the automounter know about the insertion event */

		fmuk66_automount_event(fmuk66_cardinserted());
#endif
	}
}
コード例 #3
0
ファイル: up_buttons.c プロジェクト: FreddieChopin/NuttX
uint8_t board_buttons(void)
{
  uint8_t ret = 0;

  if (kinetis_gpioread(GPIO_SW1))
    {
      ret |= BUTTON_SW1_BIT;
    }

  if (kinetis_gpioread(GPIO_SW2))
    {
      ret |= BUTTON_SW2_BIT;
    }

  return ret
}
コード例 #4
0
ファイル: sdhc.c プロジェクト: AlexisTM/Firmware
bool fmuk66_cardinserted(void)
{
	bool inserted;

	/* Get the current value of the card detect pin.  This pin is pulled up on
	 * board.  So low means that a card is present.
	 */

	inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);
	mcinfo("inserted: %s\n", inserted ? "Yes" : "No");
	return inserted;
}
コード例 #5
0
ファイル: k40_appinit.c プロジェクト: jmacintyre/nuttx-k64f
static void kinetis_mediachange(void)
{
  bool inserted;

  /* Get the current value of the card detect pin.  This pin is pulled up on
   * board.  So low means that a card is present.
   */

  inserted = !kinetis_gpioread(GPIO_SD_CARDDETECT);

  /* Has the pin changed state? */

  if (inserted != g_nsh.inserted)
    {
      /* Yes.. perform the appropriate action (this might need some debounce). */

      g_nsh.inserted = inserted;
      sdhc_mediachange(g_nsh.sdhc, inserted);
    }
}
コード例 #6
0
ファイル: nxphlite_led.c プロジェクト: bo-rc/Firmware
static bool phy_get_led(int led)
{

	return kinetis_gpioread(g_ledmap[led]);
}