Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DIOT Monitoring Module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
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
Show more breadcrumbs
Projects
DIOT Monitoring Module
Commits
a8ac461b
Commit
a8ac461b
authored
5 years ago
by
Christos Gentsos
Browse files
Options
Downloads
Patches
Plain Diff
PMBus: add the READ_TEMPERATURE_n cmds, temp sensor -> ADC -> tmp1
parent
b876cef4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
main_fw/build/Makefile
+1
-0
1 addition, 0 deletions
main_fw/build/Makefile
main_fw/src/i2c_impl.c
+7
-0
7 additions, 0 deletions
main_fw/src/i2c_impl.c
main_fw/src/main.c
+6
-0
6 additions, 0 deletions
main_fw/src/main.c
with
14 additions
and
0 deletions
main_fw/build/Makefile
+
1
−
0
View file @
a8ac461b
...
...
@@ -72,6 +72,7 @@ hal/src/hal_atomic.o \
hpl/adc/hpl_adc.o
\
../../common/src/checksums.o
\
../../common/src/flash_utils.o
\
../../common/src/float_utils.o
\
../../common/src/i2c_slave.o
\
../src/i2c_impl.o
...
...
This diff is collapsed.
Click to expand it.
main_fw/src/i2c_impl.c
+
7
−
0
View file @
a8ac461b
...
...
@@ -18,6 +18,10 @@ void query_prp();
void
query_cln
();
uint8_t
query_r
;
extern
uint16_t
temp1
;
extern
uint16_t
temp2
;
extern
uint16_t
temp3
;
extern
uint32_t
secondary_fw_start
;
#define N_CMDS 12
...
...
@@ -25,6 +29,9 @@ extern uint32_t secondary_fw_start;
static
cmd_space_t
cmds
=
{
N_CMDS
,
(
cmd_t
[]){{
0x1A
,
-
1
,
(
uint8_t
*
)
&
query_r
,
&
query_prp
,
&
query_cln
},
{
0x8D
,
2
,
(
uint8_t
*
)
&
temp1
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
},
{
0x8E
,
2
,
(
uint8_t
*
)
&
temp2
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
},
{
0x8F
,
2
,
(
uint8_t
*
)
&
temp3
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
},
{
0x99
,
-
(
int8_t
)
sizeof
(
MFR_ID
),
(
uint8_t
*
)
&
MFR_ID
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
},
{
0x9A
,
-
(
int8_t
)
sizeof
(
MFR_MDL
),
(
uint8_t
*
)
&
MFR_MDL
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
},
{
0x9B
,
-
(
int8_t
)
sizeof
(
MFR_REV
),
(
uint8_t
*
)
&
MFR_REV
,
(
fp_t
)
NULL
,
(
fp_t
)
NULL
},
...
...
This diff is collapsed.
Click to expand it.
main_fw/src/main.c
+
6
−
0
View file @
a8ac461b
...
...
@@ -3,10 +3,15 @@
#include
"usb_debug.h"
#include
"checksums.h"
#include
"flash_utils.h"
#include
"float_utils.h"
#include
"i2c_impl.h"
static
uint16_t
iter
=
0
;
uint16_t
temp1
;
uint16_t
temp2
;
uint16_t
temp3
;
static
void
mytimercallback
(
const
struct
timer_task
*
const
timer_task
)
{
uint16_t
adc_val
;
...
...
@@ -15,6 +20,7 @@ static void mytimercallback(const struct timer_task *const timer_task)
for
(
int
i
=
0
;
i
<
9
;
++
i
)
adc_sync_read_channel
(
&
ADC_0
,
0
,
(
uint8_t
*
)
&
adc_val
,
2
);
adc_temp
=
((
adc_val
/
4095
.
0
)
-
0
.
6
)
/
0
.
01
;
temp1
=
float_to_linear
(
adc_temp
);
debug
(
"slave iter %d, temp=%.1f"
,
iter
++
,
adc_temp
);
gpio_toggle_pin_level
(
LED
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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