Created
November 18, 2014 10:08
-
-
Save phardy/57d53f38873ab948f6eb to your computer and use it in GitHub Desktop.
rising-edge latching of bit field
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
| void controlGroupLatch() { | |
| uint16_t mask; | |
| uint16_t state = controlGroupToggle[0]; | |
| // Only care about the first mux bank at the moment | |
| mask = ~lastMuxState[0] & muxState[0]; // Mask of all changed inputs | |
| mask = mask & muxState[0]; // Mask of changed inputs that are now high | |
| state = state ^ mask; // Apply mask to toggle state | |
| controlGroupToggle[0] = state; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment