I guess speed is not that much of an issue with your setup, so I’d rather go for the “easiest” approach, and building up scattered masks doesn’t seem to be the “easiest” way
And since you have the A2 pin to “latch” the set address you don’t need to set all the address pins at once, so
pinSet would be easy enough.
On the other hand, if you had the possibility to rewire the 74HC138 and don’t need
TX/RX you could go for
A0, A1, RX, TX) that would be a complete nibble that can easily be written at once.
Another thing is that the SPI pins are also located on
GPIOA (high nibble low byte) so
GPIOA high byte and complete
GPIOB would be free for other use.
BTW: To use these macros you’d still have to set the
pinMode(.., OUTPUT) for the respective pins.