代码中只需要将Port初始化就行了,Dio不需要初始化,然后在周期任务中读取、输出电平。
#include "Port.h"
Port_Init(&Port_Config);
#include "Dio.h"
Task()
{
Dio_LevelType buttonLevel;
/* Button and LED interaction. */
buttonLevel = Dio_ReadChannel(DioConf_DioChannel_BUTTON1);
Dio_WriteChannel(DioConf_DioChannel_LED2, buttonLevel);
}
|