UKHeliBob:
16 bits
If an int is 16 bits and a bool is 1 bit, how does it save memory to use an int array? Does it work by putting all 7 variables under one address? Would it be even better to use a two dimensional bool array to store all these values at 1 address and eliminate the extra bits? It is rather inconvenient that the pieces of the signal are different sizes, but by moving the two bits from the end of the common to the beginning of each OUTx and having 'on' follow 'off' on the same line I can fit it all into a 10*6 bool array. Only 60 bits there vs 112 for the int array.
How would I initialize a constant two dimensional array?
Nevermind, I think I figured it out:
const bool codes[6][10] = {{0, 0, 0, 0, 0, 0, 0, 1, 0, 1}, // common
{0, 1, 0, 1, 0, 1, 0, 0, 1, 1}, // 1
{0, 1, 0, 1, 0, 1, 1, 1, 0, 0}, // 2
{0, 1, 0, 1, 1, 1, 0, 0, 0, 0}, // 3
{0, 1, 1, 1, 0, 1, 0, 0, 0, 0}, // 4
{0, 0, 1, 1, 0, 1, 1, 0, 0, 0}}; // on = first 5, off = last 5