

根于MM32 eMiniBoard蓝牙开发板,LED LD1~LD4分别连接PA15,PC10,PC11,PC12。
这个完全可以成单片机玩。
废话少说,直接上代码。
void GPIO_init()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //Multiplexed push-pull output
GPIO_Init(GPIOC, &GPIO_InitStructure);//GPIO initialization
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //Multiplexed push-pull output
GPIO_Init(GPIOA, &GPIO_InitStructure);//GPIO initialization
}
GPIO初始化,跟STM32库函数完全兼容。
主函数
main()
{
SYSTick_Configuration();
delay_init();
GPIO_init();
while (1)
{
GPIO_ResetBits(GPIOC,GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12);
GPIO_ResetBits(GPIOA,GPIO_Pin_15);
delay_ms(3000);
GPIO_SetBits(GPIOC,GPIO_Pin_10|GPIO_Pin_11|GPIO_Pin_12);
GPIO_SetBits(GPIOA,GPIO_Pin_15);
delay_ms(3000);
}
}
试验效果如下:
