Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
vielex
/
bes_labs_2019
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
605e8ed3
authored
Mar 12, 2019
by
vielex
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Final version
parent
3ca637f2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
Labware/Lab9_FunctionalDebugging/main.c
Labware/Lab9_FunctionalDebugging/main.c
View file @
605e8ed3
...
...
@@ -90,7 +90,8 @@ int main(void){ unsigned long i,last,now;
last
=
NVIC_ST_CURRENT_R
;
EnableInterrupts
();
// enable interrupts for the grader
while
(
1
){
if
(
!
(
GPIO_PORTF_DATA_R
&
0x01
)
||
!
(
GPIO_PORTF_DATA_R
&
0x10
)){
// PF0 or PF4
//either PF4 or PF0 is 0
if
(
!
(
GPIO_PORTF_DATA_R
&
0x01
)
||
!
(
GPIO_PORTF_DATA_R
&
0x10
)){
Led
=
GPIO_PORTF_DATA_R
;
// read previous
Led
=
Led
^
0x02
;
// toggle red LED
GPIO_PORTF_DATA_R
=
Led
;
// output
...
...
@@ -100,11 +101,11 @@ int main(void){ unsigned long i,last,now;
//disable LED if nothing is pressed
GPIO_PORTF_DATA_R
&=~
0x02
;
}
if
(
i
<
50
){
if
(
i
<
50
&&
changed
){
changed
=
false
;
now
=
NVIC_ST_CURRENT_R
;
Time
[
i
]
=
(
last
-
now
)
&
0x00FFFFFF
;
// 24-bit time difference
Data
[
i
]
=
GPIO_PORTF_DATA_R
&
0x
02
;
// record PF1
Data
[
i
]
=
GPIO_PORTF_DATA_R
&
0x
13
;
// record PF4,1,0
last
=
now
;
i
++
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment