@Christopher Garner
I just commented on this very documentation deficiency in the Comments for BusIn(), and the documentation for this is even less well-specified, because you can't intuit its behavior even from the example.
Assuming that BusIn and BusOut are orthogonal, one can only assume that the following is the case (assuming active-high LEDs):
CL = 0; all LEDs off
CL = 1; a.k.a. 1<<0 or 0x1, (only) LED0 on
CL = 2; a.k.a. 1<<1 or 0x2, (only) LED1 on
CL = 4; a.k.a. 1<<2 or 0x4, (only) LED2 on
CL = 8; a.k.a. 1<<3 or 0x8, (only) LED3 on
That is, where the leftmost bits are the MSBs (most-significant bits) in the read/written "int" type, the parameters are actually passed in *reverse* order, LSB to MSB, as follows (as packed into bit positions 15..0 in an "int", respectively):
- - - - - - - - - - - - p22 p18 p20 p19
Even though the documentation isn't clear, from your example it seems like you're not "thinking binary" from your statement about p20 perhaps being "3". Each pin is a single *bit*... either a 1 or a 0. If you're not into thinking binary (yet), perhaps the following would help: http://www.arduino.cc/playground/Code/BitMath.
If it's still unclear, I'm guessing that the Forum would probably be a better place to get help.
What does the wait() do in this function? Does it clear the bus, or hold the information?