uint8_t board_buttons(void) { uint8_t retval; retval = sam_gpioread(GPIO_BUTTON1) ? 0 : BUTTON1; retval |= sam_gpioread(GPIO_BUTTON2) ? 0 : BUTTON2; return retval; }
uint8_t board_buttons(void) { uint8_t retval; retval = sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; retval |= sam_gpioread(GPIO_SW1) ? 0 : BUTTON_SW1_BIT; return retval; }
uint8_t board_buttons(void) { uint8_t retval; retval = sam_gpioread(GPIO_SCROLLUP) ? 0 : BUTTON_SCROLLUP; retval |= sam_gpioread(GPIO_SCROLLDWN) ? 0 : BUTTON_SCROLLDOWN; retval |= sam_gpioread(GPIO_WAKU) ? 0 : BUTTON_WAKU; retval |= sam_gpioread(GPIO_TAMP) ? 0 : BUTTON_TAMP; return retval; }
static bool tsc_pendown(FAR struct ads7843e_config_s *state) { /* The /PENIRQ value is active low */ bool pendown = !sam_gpioread(GPIO_TSC_IRQ); ivdbg("pendown:%d\n", pendown); return pendown; }
bool sam_cardinserted(int slotno) { bool removed; /* Get the state of the GPIO pin */ removed = sam_gpioread(GPIO_MCI_CD); fllvdbg("Slot %d inserted: %s\n", slotno, removed ? "NO" : "YES"); return !removed; }
bool sam_writeprotected(unsigned char slot) { if (slot == 0) { #ifdef GPIO_MCI_WP bool protected = sam_gpioread(GPIO_MCI_WP); fvdbg("protected: %s\n", inserted ? "YES" : "NO"); return protected; #else return false; #endif }
bool sam_cardinserted(unsigned char slot) { if (slot == 0) { #ifdef GPIO_MCI_CD bool inserted = sam_gpioread(GPIO_MCI_CD); fvdbg("inserted: %s\n", inserted ? "NO" : "YES"); return !inserted; #else return true; #endif } return false; }
uint8_t sam_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { uint8_t ret = 0; #ifdef CONFIG_SAM4L_XPLAINED_IOMODULE /* Check if an SD card is present in the microSD slot */ if (devid == SPIDEV_MMCSD) { /* Active low */ if (!sam_gpioread(GPIO_SD_CD)) { ret |= SPI_STATUS_PRESENT; } } #endif return ret; }
static bool tsc_busy(FAR struct ads7843e_config_s *state) { #if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE) static bool last = (bool)-1; #endif /* BUSY is high impedance when CS is high (not selected). When CS is * is low, BUSY is active high. */ bool busy = sam_gpioread(GPIO_TCS_BUSY); #if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE) if (busy != last) { ivdbg("busy:%d\n", busy); last = busy; } #endif return busy; }
uint8_t up_buttons(void) { return sam_gpioread(GPIO_USER1) ? 0 : BUTTON_USER1_BIT; }
uint8_t board_buttons(void) { return sam_gpioread(GPIO_SW0) ? 0 : BUTTON_SW0_BIT; }