It is a probles about Kinetis K10 MCU.
Usually when I want to configure a pin as the funcion I require,I need only call the following macro definition:
#define IO_FUN_SEL(PTO, BIT, FUN) \
PCR(PTO,BIT) = (PCR(PTO,BIT) & (~PORT_PCR_MUX_MASK))|PORT_PCR_MUX(FUN)
In this macro definition,the parameter FUN stands for the number sequence of function option and can be 0~7(stands for ALT0~ALT7),refer to the table below:
For example,if I want to configure the Pin PTC0(the 43rd pin) as the SPI0_PCS4,I need just define FUN as 2,namely the related code is:PORT_PCR_MUX(2).
Now please look at the Pin PTC2,there are 3 items(ADC0_SE4b,CMP1_IN0,TSI0_CH15) in the unit ALT0.
1) So which funciton is really actived if I define the FUN as 0(PORT_PCR_MUX(0)) ?
2) And ,if I want to configure the pin as the function wanted,what's the code?
Actually,I think that there are some other factors affecting the selection of pin function,but I can't find them.Who can tell me?