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)); } } }
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 } }
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 }
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; }
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); } }
static bool phy_get_led(int led) { return kinetis_gpioread(g_ledmap[led]); }