daeun

mid

Showing 1 changed file with 24 additions and 24 deletions
......@@ -11,30 +11,6 @@ int time = 0;
int data[] = { 0,0,0,0,0,0 };
int state = 2;
void init(){
int i;
if( wiringPiSetupGpio() == -1 ){
printf( "wiringPiSetupGpio() error\n" );
exit(-1);
}
for(i=0;i<6;i++){
pinMode( FndSelectPin[i], OUTPUT );
digitalWrite( FndSelectPin[i], HIGH );
}
for(i=0;i<8;i++){
pinMode( FndPin[i], OUTPUT );
digitalWrite( FndPin[i], LOW );
}
for (i = 0; i < 3; i++)
pinMode(Keypad[i], INPUT);
if (wiringPiISR(Keypad[1], INT_EDGE_FALLING, &stop) < 0) {
return 1;
}
if (wiringPiISR(Keypad[2], INT_EDGE_FALLING, &reset) < 0) {
return 1;
}
}
int KeypadRead()
{
int i, keypadnum = -1;
......@@ -87,6 +63,30 @@ void reset() {
time = 0;
state = 2;
}
void init() {
int i;
if (wiringPiSetupGpio() == -1) {
printf("wiringPiSetupGpio() error\n");
exit(-1);
}
for (i = 0; i < 6; i++) {
pinMode(FndSelectPin[i], OUTPUT);
digitalWrite(FndSelectPin[i], HIGH);
}
for (i = 0; i < 8; i++) {
pinMode(FndPin[i], OUTPUT);
digitalWrite(FndPin[i], LOW);
}
for (i = 0; i < 3; i++)
pinMode(Keypad[i], INPUT);
if (wiringPiISR(Keypad[1], INT_EDGE_FALLING, &stop) < 0) {
return 1;
}
if (wiringPiISR(Keypad[2], INT_EDGE_FALLING, &reset) < 0) {
return 1;
}
}
int main(){
init();
if (KeypadRead() == 0) {
......