void gpioInit(void)
{
SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK | SIM_SCGC5_PORTC_MASK; //开启时钟
PORT_ENABLE_CLK(MKL_PORTC); //PORTC 3 外部中断设置
IO_FUN_SEL(MKL_PORTC,3,1);
GPIO_DDR_INPUT(MKL_PORTC,3);
IO_IRQ_CONFIG(MKL_PORTC, 3, IO_EITHER_EDGE_IRQ);
NVIC_EnableIRQ(PORTC_PORTD_IRQn);
NVIC_SetPriority(PORTC_PORTD_IRQn,6);
PORTC_PCR3 = ( PORTC_PCR3 | PORT_PCR_IRQC(PORT_PCR_IRQC_MASK)); //清除标志位
PORTC_PCR4 |= PORT_PCR_MUX(1); //SPI端口初始化
PORTC_PCR5 |= PORT_PCR_MUX(2)|(uint32_t)~(uint32_t)PORT_PCR_MUX(5);
PORTC_PCR6 |= PORT_PCR_MUX(2)|(uint32_t)~(uint32_t)PORT_PCR_MUX(5);
PORTC_PCR7 |= PORT_PCR_MUX(2)|(uint32_t)~(uint32_t)PORT_PCR_MUX(5);
FGPIOC_PSOR |= 1<<4;
FGPIOC_PDDR |= 1<<4;
}
是不是管脚复用了,功能复用了呀 |