[Feat] GPIO配置的代码可以加一个注释,说明这个脚是做什么功能的
举例如下:
void MF_SPI1_Init(void)
{
FL_GPIO_InitTypeDef GPIO_InitStruct;
FL_SPI_InitTypeDef SPI1_InitStruct;
/* PA8 SPI1_SSN */
GPIO_InitStruct.pin = FL_GPIO_PIN_8;
GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;
GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.pull = FL_DISABLE;
GPIO_InitStruct.remapPin = FL_DISABLE;
GPIO_InitStruct.analogSwitch = FL_DISABLE;
FL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* PA9 SPI1_SCK */
GPIO_InitStruct.pin = FL_GPIO_PIN_9;
GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;
GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.pull = FL_DISABLE;
GPIO_InitStruct.remapPin = FL_DISABLE;
GPIO_InitStruct.analogSwitch = FL_DISABLE;
FL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* PB0 SPI1_MISO */
GPIO_InitStruct.pin = FL_GPIO_PIN_0;
GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;
GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.pull = FL_DISABLE;
GPIO_InitStruct.remapPin = FL_DISABLE;
GPIO_InitStruct.analogSwitch = FL_DISABLE;
FL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* PB1 SPI1_MOSI */
GPIO_InitStruct.pin = FL_GPIO_PIN_1;
GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;
GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.pull = FL_DISABLE;
GPIO_InitStruct.remapPin = FL_DISABLE;
GPIO_InitStruct.analogSwitch = FL_DISABLE;
FL_GPIO_Init(GPIOB, &GPIO_InitStruct);
SPI1_InitStruct.softControl = FL_DISABLE;
SPI1_InitStruct.mode = FL_SPI_WORK_MODE_MASTER;
SPI1_InitStruct.baudRate = FL_SPI_BAUDRATE_DIV8;
SPI1_InitStruct.bitOrder = FL_SPI_BIT_ORDER_MSB_FIRST;
SPI1_InitStruct.dataWidth = FL_SPI_DATA_WIDTH_8B;
SPI1_InitStruct.clockPhase = FL_SPI_PHASE_EDGE1;
SPI1_InitStruct.transferMode = FL_SPI_TRANSFER_MODE_FULL_DUPLEX;
SPI1_InitStruct.clockPolarity = FL_SPI_POLARITY_NORMAL;
FL_SPI_Init(SPI1, &SPI1_InitStruct);
}