Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FPGA Configuration Space
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
FPGA Configuration Space
Commits
eaa16b31
Commit
eaa16b31
authored
13 years ago
by
Manohar Vanga
Browse files
Options
Downloads
Patches
Plain Diff
simulation: fix temperature readings of ds18b20 chip
Signed-off-by:
Manohar Vanga
<
manohar.vanga@cern.ch
>
parent
30a807fe
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
simulation/test/test1w.c
+2
-1
2 additions, 1 deletion
simulation/test/test1w.c
simulation/wb_onewire.c
+3
-3
3 additions, 3 deletions
simulation/wb_onewire.c
with
5 additions
and
4 deletions
simulation/test/test1w.c
+
2
−
1
View file @
eaa16b31
...
...
@@ -37,7 +37,8 @@ int main(int argc, char *argv[])
return
ret
;
}
printf
(
"Temp: %08x
\n
"
,
a
.
temp
/
16
.
0
);
printf
(
"Temp RAW: %08x
\n
"
,
a
.
temp
);
printf
(
"Temp: %08f
\n
"
,
a
.
temp
/
16
.
0
);
close
(
fd
);
return
0
;
...
...
This diff is collapsed.
Click to expand it.
simulation/wb_onewire.c
+
3
−
3
View file @
eaa16b31
...
...
@@ -135,7 +135,7 @@ void ds18b20_read_serial(struct wb_onewire_dev *dev, int port, uint8_t *sbuf)
wb_onewire_reset
(
dev
,
port
);
wb_onewire_writebyte
(
dev
,
port
,
0x33
);
sbuf
[
0
]
=
wb_onewire_readbyte
(
dev
,
port
);
for
(
i
=
6
;
i
>
=
1
;
i
--
)
for
(
i
=
1
;
i
<
=
6
;
i
++
)
sbuf
[
i
]
=
wb_onewire_readbyte
(
dev
,
port
);
sbuf
[
7
]
=
wb_onewire_readbyte
(
dev
,
port
);
}
...
...
@@ -158,7 +158,7 @@ int ds18b20_read_temp(struct wb_onewire_dev *dev, int port, uint8_t *serial)
int
temp
;
ds18b20_access
(
dev
,
port
,
serial
);
printk
(
"serial: "
);
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
7
;
i
>=
0
;
i
--
)
printk
(
"%02x "
,
serial
[
i
]);
printk
(
"
\n
"
);
wb_onewire_writebyte
(
dev
,
port
,
0x44
);
...
...
@@ -168,7 +168,7 @@ int ds18b20_read_temp(struct wb_onewire_dev *dev, int port, uint8_t *serial)
wb_onewire_writebyte
(
dev
,
port
,
0xbe
);
wb_onewire_readblock
(
dev
,
port
,
data
,
9
);
printk
(
"data: "
);
for
(
i
=
0
;
i
<
9
;
i
++
)
for
(
i
=
8
;
i
>=
0
;
i
--
)
printk
(
"%2x "
,
data
[
i
]);
printk
(
"
\n
"
);
temp
=
(
data
[
1
]
<<
8
)
|
data
[
0
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment