Go to the documentation of this file.00001 #ifndef direct_pin_read_h_
00002 #define direct_pin_read_h_
00003
00004 #if defined(__AVR__) || defined(__MK20DX128__) || defined(__MK20DX256__)
00005
00006 #define IO_REG_TYPE uint8_t
00007 #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))
00008 #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
00009 #define DIRECT_PIN_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0)
00010
00011 #elif defined(__SAM3X8E__)
00012
00013 #define IO_REG_TYPE uint32_t
00014 #define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))
00015 #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
00016 #define DIRECT_PIN_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0)
00017
00018 #elif defined(__PIC32MX__)
00019
00020 #define IO_REG_TYPE uint32_t
00021 #define PIN_TO_BASEREG(pin) (portModeRegister(digitalPinToPort(pin)))
00022 #define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
00023 #define DIRECT_PIN_READ(base, mask) (((*(base+4)) & (mask)) ? 1 : 0)
00024
00025 #endif
00026
00027 #endif