uint8_t up_buttons(void) { uint8_t retval; retval = sam3u_gpioread(GPIO_BUTTON1) ? 0 : GPIO_BUTTON1; retval |= sam3u_gpioread(GPIO_BUTTON2) ? 0 : GPIO_BUTTON2; return retval; }
static bool tsc_pendown(FAR struct ads7843e_config_s *state) { /* REVISIT: This might need to be inverted */ bool pendown = sam3u_gpioread(GPIO_TCS_IRQ); ivdbg("pendown:%d\n", pendown); return pendown; }
bool sam3u_writeprotected(unsigned char slot) { if (slot == 0) { #ifdef GPIO_MCI_WP bool protected = sam3u_gpioread(GPIO_MCI_WP); fvdbg("protected: %s\n", inserted ? "YES" : "NO"); return protected; #else return false; #endif }
bool sam3u_cardinserted(unsigned char slot) { if (slot == 0) { #ifdef GPIO_MCI_CD bool inserted = sam3u_gpioread(GPIO_MCI_CD); fvdbg("inserted: %s\n", inserted ? "NO" : "YES"); return !inserted; #else return true; #endif } return false; }
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 /* REVISIT: This might need to be inverted */ bool busy = sam3u_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; }