Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zenox
firmware
Commits
d10d99fb
Commit
d10d99fb
authored
Feb 09, 2020
by
Arist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(max86150): MAX86150 Pycardium API: use namedtuple
parent
e3aa6461
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
preload/apps/spo2/__init__.py
preload/apps/spo2/__init__.py
+1
-1
pycardium/modules/py/max86150.py
pycardium/modules/py/max86150.py
+10
-1
No files found.
preload/apps/spo2/__init__.py
View file @
d10d99fb
...
...
@@ -38,7 +38,7 @@ class SPO2:
def
update_history
(
self
,
datasets
):
for
val
in
datasets
:
# 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
:
self
.
avg_pos
+=
1
else
:
...
...
pycardium/modules/py/max86150.py
View file @
d10d99fb
import
sys_max86150
import
uerrno
import
interrupt
import
ucollections
Max86150Data
=
ucollections
.
namedtuple
(
"Max86150Data"
,
[
"red"
,
"infrared"
,
"ecg"
])
class
MAX86150
:
...
...
@@ -68,7 +71,13 @@ class MAX86150:
Read as many samples (signed integer) as currently available.
"""
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
,
_
):
if
self
.
active
:
...
...
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