📄 gpio.c
字号:
//*****************************************************************************
// Filename: main.c
// Version: 0.01
// Description: EQH-01
// Returns : void
//-----------------------------------------------------------------------------
// Revision History:
// Auther:屈宵军
// 0.01, R. qxj, 01/15/05, - Original release
//*****************************************************************************
#include <csl.h>
#include <csl_gpio.h>
#include <tms320.h>
/*********************8根通用IO引脚作为继电器输出和键盘输入*******************/
int key1=0xFF,key2=0xFF,key3=0xFF;
void GPIO1_control(void);
void Relay(void)
{
uint k=0,m=0;
for(k=0;k<3;k++)
{
GPIO1_control();
for(m=0;m<100;m++)
{
Delay(3000);
}
GPIO_pinWrite (GPIO_PIN1, 0);
for(m=0;m<100;m++)
{
Delay(3000);
}
}
}
void GPIO1_control(void)
{
GPIO_pinEnable (GPIO_PIN1);
GPIO_pinDirection (GPIO_PIN1, GPIO_OUTPUT);
GPIO_pinWrite (GPIO_PIN1, 1); /* sets io pin1 to "1" */
}
/***************************************************************************/
void Key_Pin(void)
{
GPIO_pinEnable (GPIO_PIN3);
GPIO_pinDirection (GPIO_PIN3, GPIO_INPUT);
GPIO_pinEnable (GPIO_PIN4);
GPIO_pinDirection (GPIO_PIN4, GPIO_INPUT);
GPIO_pinEnable (GPIO_PIN6);
GPIO_pinDirection (GPIO_PIN6, GPIO_INPUT);
GPIO_pinWrite (GPIO_PIN3, 1); /* sets io pin1 to "1" */
GPIO_pinWrite (GPIO_PIN4, 1); /* sets io pin1 to "1" */
GPIO_pinWrite (GPIO_PIN6, 1); /* sets io pin1 to "1" */
}
void GET_KEY(void)
{
key1=GPIO_pinRead (GPIO_PIN3); // y(0)
key2=GPIO_pinRead (GPIO_PIN4); // y(1)
key3=GPIO_pinRead (GPIO_PIN6); // y(2)
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -