I am toying with shift registers (HC595) and trying to move babysteps in bit masking.
I have a set of 8 boolean variables I want to store as a single byte. When the state of one of the boolean variables change, I want only the bit relative to that variable to change, the others being left unchanged.
I arrived at this point:
value is the nth state-boolean
obyte is the storing byte
omask is the mask for the nth value.
This someway works, but when "value" is zero, it obviously resets all the other stored states.
What is the best coding practice for a (simple, I know...) task like this?