instead of mucking around with 32 bit variables and bit masks and shifting etc, if my gpio is aligned with byte boundaries, can i access the registers using shorter variables..
i.e. if I want to use say PA8-PA23, the middle 16 bits, can i use it like this -
// point to the required 16 bits, skip the first 8
odsr16_address = address of REG_PIOA_ODSR register + 1;
// use short to access just the required 16 bits, skip the fist 8 bits
unsigned short volatile * const my_odsr = (unsigned short *) (odsr16_address);
// set all 16 bits high
my_odsr = 0xFFFF;
// to read data
short a = *my_odsr;
similarly use char to access 8 bits...
PS: is there a restriction on the shorts (or ints for that matter) starting on odd or even address boundaries, or can they start anywhere.