Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이다은
/
raspberry
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
daeun
2021-04-23 14:38:55 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
25336684f715fe382e403375534cfa21cb6fe58f
25336684
1 parent
74222898
mid
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
midterm4.c
midterm4.c
View file @
2533668
...
...
@@ -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
)
{
...
...
Please
register
or
login
to post a comment