Treating a short like an uchar[2]
Well, there's no need to copy the short into an array of (unsigned) char:
Treating any type as an array of (optionally signed/unsigned) char is an explicit exception from the strict-aliasing-rule.
(I assume your targets byte-order is big-endian for that. Or you will need to byte-swap it first.)
Unless prefix_A and/or prefix_B should ever be dynamically changed, mark them as const so you don't change them accidentally, and the compiler knows they cannot change so it will optimize accordingly.


So it becomes:

// constants
const short prefix_A = 3 &lt;&lt; (4+8);
const short prefix_B = 11 &lt;&lt; (4+8);

void send_cmd(bool A, short cmd){
    assert( cmd &lt; 4096);
    cmd |= A ? prefix_A : prefix_B;
    cmd = htons(cmd); // byte-swap if little-endian
    wiringPiSPIDataRW(0, (unsigned char*)&amp;cmd, 2);
}