Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pete
firmware
Commits
d10d99fb
Commit
d10d99fb
authored
5 years ago
by
Arist
Browse files
Options
Downloads
Patches
Plain Diff
feat(max86150): MAX86150 Pycardium API: use namedtuple
parent
e3aa6461
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
preload/apps/spo2/__init__.py
+1
-1
1 addition, 1 deletion
preload/apps/spo2/__init__.py
pycardium/modules/py/max86150.py
+10
-1
10 additions, 1 deletion
pycardium/modules/py/max86150.py
with
11 additions
and
2 deletions
preload/apps/spo2/__init__.py
+
1
−
1
View file @
d10d99fb
...
@@ -38,7 +38,7 @@ class SPO2:
...
@@ -38,7 +38,7 @@ class SPO2:
def
update_history
(
self
,
datasets
):
def
update_history
(
self
,
datasets
):
for
val
in
datasets
:
for
val
in
datasets
:
# get red value (first in tuple)
# get red value (first in tuple)
self
.
avg
[
self
.
avg_pos
]
=
val
[
0
]
self
.
avg
[
self
.
avg_pos
]
=
val
.
red
if
self
.
avg_pos
<
9
:
if
self
.
avg_pos
<
9
:
self
.
avg_pos
+=
1
self
.
avg_pos
+=
1
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/py/max86150.py
+
10
−
1
View file @
d10d99fb
import
sys_max86150
import
sys_max86150
import
uerrno
import
uerrno
import
interrupt
import
interrupt
import
ucollections
Max86150Data
=
ucollections
.
namedtuple
(
"
Max86150Data
"
,
[
"
red
"
,
"
infrared
"
,
"
ecg
"
])
class
MAX86150
:
class
MAX86150
:
...
@@ -68,7 +71,13 @@ class MAX86150:
...
@@ -68,7 +71,13 @@ class MAX86150:
Read as many samples (signed integer) as currently available.
Read as many samples (signed integer) as currently available.
"""
"""
assert
self
.
active
,
"
Sensor is inactive
"
assert
self
.
active
,
"
Sensor is inactive
"
return
sys_max86150
.
read_sensor
(
self
.
stream_id
)
result
=
[]
for
sample
in
sys_max86150
.
read_sensor
(
self
.
stream_id
):
result
.
append
(
self
.
_convert
(
sample
))
return
result
def
_convert
(
self
,
sample
):
return
Max86150Data
(
sample
[
0
],
sample
[
1
],
sample
[
2
])
def
_interrupt
(
self
,
_
):
def
_interrupt
(
self
,
_
):
if
self
.
active
:
if
self
.
active
:
...
...
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