Hi Earl
I prefer to not get involved too much in issues of coding "styles" rather than coding "correctness" since it is a bit like discussion religion (but hopefully not leading to any deaths and war).
#define KE_PORTB_BIT3 0x00000800
#define KE_PORTB_BIT3 0b0000100000000000
#define KE_PORTB_BIT3 (1 << 11)
are of course the same and a coder's preference.
I like to simply use the KE_PORTB_BIT3 at the application level as a mask to keep consistent and in fact don't really think of it as a bit or mask when using it but rather simply as a name that one can assume is a correct reference.
The final assembler code is identical in each case, however written.
Where I can certainly agree/confirm is that it would have been simpler from a programmer's point of view if the ports on the KE were not used as pseudo 8 bit ones in the documentation since the nasty bit in the macro above is that one needs to use
_READ_PORT_MASK(A, TEST_INPUT)
when the TEST_INPUT is on KE ports A, B, C or D
and then
_READ_PORT_MASK(B, TEST_INPUT)
if it is on KE port E, F, G or H
This needs a little attention since the underlying macro can't accept an intermediate define (such as allowing _READ_PORT_MASK(KE_PORT_F, TEST_INPUT)
But since it is limited to this it is not the end of the world. The actual KE operation with port MUX control based on peripheral functions and their priorities, rather than a PORTx_PCRy, causes more headaches, especially when simulating the behaviour!).
Regards
Mark
Kinetis: µTasker Kinetis support
KE: µTasker FRDM-KE02Z support / µTasker FRDM-KE02Z40M support / µTasker FRDM-KE06Z support
For the complete "out-of-the-box" Kinetis experience and faster time to market