**本程序设计是基于嵌入式开发板CT117E,stm32f103RBT6。
如果对哪个模块的代码不理解可以点开我的博客查看各个模块的编写思路。
一、试题二、需要用到的模块 1.LED
代码如下:led.c:
#include "led.h"void led_init(void){ GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOC, ENABLE); /* Configure PD0 and PD2 in output pushpull mode */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOD, &GPIO_InitStructure);GPIO_InitStructure.GPIO_Pin = 0xff00;GPIO_Init(GPIOC, &GPIO_InitStructure);GPIOC->ODR |=0xff