Created
April 23, 2018 01:25
-
-
Save seebs/848fb98ae05526195e73d08f74a37635 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- // read from teensy | |
- return | |
- (PINF&(1<<0) ? 0 : (1<<0)) | | |
- (PINF&(1<<1) ? 0 : (1<<1)) | | |
- (PINF&(1<<4) ? 0 : (1<<2)) | | |
- (PINF&(1<<5) ? 0 : (1<<3)) | | |
- (PINF&(1<<6) ? 0 : (1<<4)) | | |
- (PINF&(1<<7) ? 0 : (1<<5)) ; | |
+ /* read from teensy | |
+ * bitmask is 0b11110011, but we want those all | |
+ * in the lower six bits. | |
+ * we'll return 1s for the top two, but that's harmless. | |
+ */ | |
+ | |
+ return ~((PINF & 0x03) | ((PINF & 0xF0) >> 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment