Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Monitoring Module
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
DIOT Monitoring Module
Commits
531b67e3
Commit
531b67e3
authored
Jun 28, 2020
by
Christos Gentsos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Master: query two MoniMods in the main log, add pwr cycle & query fn
parent
0a23fbef
Pipeline
#267
failed with stage
in 3 minutes and 17 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
3 deletions
+37
-3
main.c
test_master/src/main.c
+37
-3
No files found.
test_master/src/main.c
View file @
531b67e3
...
...
@@ -33,6 +33,15 @@ void check_res_print_error(uint32_t res)
debug
(
"I2C error: I2C_NACK (res = %lx)"
,
res
);
break
;
}
delay_ms
(
2
);
}
void
select_monimod
(
uint8_t
n
)
{
if
(
!
n
)
i2c_m_sync_set_slaveaddr
(
&
I2C_0
,
0x12
,
I2C_M_SEVEN
);
else
i2c_m_sync_set_slaveaddr
(
&
I2C_0
,
0x16
,
I2C_M_SEVEN
);
}
uint8_t
get_digit
(
uint8_t
echo
)
...
...
@@ -76,7 +85,6 @@ void user_interaction()
uint8_t
query_cmd
;
uint8_t
read_buf_long
[
32
];
uint8_t
read_buf_len
;
uint16_t
temp
;
uint16_t
volt
;
uint16_t
curr
;
uint16_t
powr
;
...
...
@@ -222,9 +230,24 @@ void user_interaction()
}
break
;
case
't'
:
res
=
i2c_m_sync_my_cmd_read
(
&
I2C_0
,
0x8D
,
(
uint8_t
*
)
&
temp
,
2
);
print
(
"Power cycling the MoniMods..."
);
gpio_set_pin_level
(
PCYC
,
1
);
delay_ms
(
1000
);
gpio_set_pin_level
(
PCYC
,
0
);
delay_ms
(
1000
);
print
(
"enabling PEC..."
);
select_monimod
(
0
);
res
=
enable_pec
(
&
I2C_0
);
check_res_print_error
(
res
);
select_monimod
(
1
);
res
=
enable_pec
(
&
I2C_0
);
check_res_print_error
(
res
);
print
(
"READ_TEMPERATURE_1: %.3f (%x)"
,
linear_to_float
(
temp
),
temp
);
delay_ms
(
100
);
print
(
"taking readouts..."
);
select_monimod
(
0
);
print_log
();
select_monimod
(
1
);
print_log
();
break
;
case
'T'
:
// write value doesn't matter, use whatever
...
...
@@ -233,8 +256,19 @@ void user_interaction()
print
(
"TMR_ERROR_CNT: %lu..."
,
tmp_word
);
break
;
case
'a'
:
select_monimod
(
0
);
print_log
();
select_monimod
(
1
);
print_log
();
break
;
case
'd'
:
print
(
"Selecting first MoniMod..."
);
select_monimod
(
0
);
break
;
case
'D'
:
print
(
"Selecting second MoniMod..."
);
select_monimod
(
1
);
break
;
default:
break
;
}
...
...
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