Well, as I said, "it works". But let me count the "whyTF did they do it in this way?"s...
Using a shifted mask of 1 bit when it all ends up with a huge hardcoded address thing anyway (just use if and &, it's not that many checks...),
Using an XOR every frigging time instead of just checking if the status has changed in the first line (IIRC the function is only called if the status has changed, even),
Switching by the (magic) position of the mask,
Sending "1" to the respective address in the most complicated way I have ever seen, using hardcoded shiftcount
And using this whole thing to send three(!) possible things.
Did I forget anything?
You could code the whole thing a lot easier, better, more readable, and easier to expand. That is the WTF.