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
Philip Stewart
firmware
Commits
5a7cc7c9
Commit
5a7cc7c9
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
change(spo2): Allocate buffers on heap
parent
beab46e5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pycardium/modules/spo2_algo.c
+17
-6
17 additions, 6 deletions
pycardium/modules/spo2_algo.c
pycardium/mpconfigport.h
+1
-0
1 addition, 0 deletions
pycardium/mpconfigport.h
with
18 additions
and
6 deletions
pycardium/modules/spo2_algo.c
+
17
−
6
View file @
5a7cc7c9
...
...
@@ -5,10 +5,13 @@
#include
"py/obj.h"
#include
"py/runtime.h"
static
mp_obj_t
mp_maxim_rd177
(
mp_obj_t
ir
,
mp_obj_t
red
)
{
struct
spo2_memory
{
uint32_t
pun_ir_buffer
[
500
];
uint32_t
pun_red_buffer
[
500
];
};
static
mp_obj_t
mp_maxim_rd177
(
mp_obj_t
ir
,
mp_obj_t
red
)
{
int32_t
n_ir_buffer_length
;
int32_t
pn_spo2
=
0
;
...
...
@@ -39,16 +42,24 @@ static mp_obj_t mp_maxim_rd177(mp_obj_t ir, mp_obj_t red)
);
}
struct
spo2_memory
*
m
=
(
struct
spo2_memory
*
)
MP_STATE_PORT
(
spo2_memory
);
if
(
!
m
)
{
/* Will raise an exception if out of memory: */
m
=
m_malloc
(
sizeof
(
struct
spo2_memory
));
MP_STATE_PORT
(
spo2_memory
)
=
m
;
}
n_ir_buffer_length
=
ir_len
;
for
(
size_t
i
=
0
;
i
<
ir_len
;
i
++
)
{
pun_ir_buffer
[
i
]
=
mp_obj_get_int
(
ir_elem
[
i
]);
pun_red_buffer
[
i
]
=
mp_obj_get_int
(
red_elem
[
i
]);
m
->
pun_ir_buffer
[
i
]
=
mp_obj_get_int
(
ir_elem
[
i
]);
m
->
pun_red_buffer
[
i
]
=
mp_obj_get_int
(
red_elem
[
i
]);
}
maxim_heart_rate_and_oxygen_saturation
(
pun_ir_buffer
,
m
->
pun_ir_buffer
,
n_ir_buffer_length
,
pun_red_buffer
,
m
->
pun_red_buffer
,
&
pn_spo2
,
&
pch_spo2_valid
,
&
pn_heart_rate
,
...
...
This diff is collapsed.
Click to expand it.
pycardium/mpconfigport.h
+
1
−
0
View file @
5a7cc7c9
...
...
@@ -114,4 +114,5 @@ typedef long mp_off_t;
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[16]; \
mp_obj_t interrupt_callbacks[EPIC_INT_NUM]; \
void *spo2_memory; \
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