Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r 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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
flow3r
flow3r firmware
Commits
6c30041b
Commit
6c30041b
authored
1 year ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
imu: don't forward imu errors into mpy
parent
a359276a
No related branches found
No related tags found
1 merge request
!25
BMI270 acc support
Pipeline
#5919
passed
1 year ago
Stage: check
Stage: build
Stage: deploy
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/flow3r_bsp/flow3r_bsp_imu.h
+9
-0
9 additions, 0 deletions
components/flow3r_bsp/flow3r_bsp_imu.h
components/micropython/usermodule/mp_imu.c
+6
-12
6 additions, 12 deletions
components/micropython/usermodule/mp_imu.c
with
15 additions
and
12 deletions
components/flow3r_bsp/flow3r_bsp_imu.h
+
9
−
0
View file @
6c30041b
...
...
@@ -14,6 +14,15 @@ typedef struct {
uint8_t
dev_addr
;
}
flow3r_bsp_imu_t
;
// Init the IMU to default settings
//
// 100 Hz sample rate, 2 g range
esp_err_t
flow3r_bsp_imu_init
(
flow3r_bsp_imu_t
*
imu
);
// Query the IMU for an accelerometer reading.
//
// This directly calls the I2C bus and need to lock the bus for that.
// Returns ESP_ERR_NOT_FOUND if there is no new reading available.
// Return values in m/s.
esp_err_t
flow3r_bsp_imu_read_acc_mps
(
flow3r_bsp_imu_t
*
imu
,
float
*
x
,
float
*
y
,
float
*
z
);
This diff is collapsed.
Click to expand it.
components/micropython/usermodule/mp_imu.c
+
6
−
12
View file @
6c30041b
...
...
@@ -4,20 +4,14 @@
#include
"py/runtime.h"
STATIC
mp_obj_t
mp_imu_acc_read
(
void
)
{
float
x
,
y
,
z
;
static
float
x
,
y
,
z
;
esp_err_t
ret
=
st3m_imu_read_acc_mps
(
&
x
,
&
y
,
&
z
);
// Will not overwrite old data if there is an error
st3m_imu_read_acc_mps
(
&
x
,
&
y
,
&
z
);
if
(
ret
==
ESP_OK
)
{
mp_obj_t
items
[
3
]
=
{
mp_obj_new_float
(
x
),
mp_obj_new_float
(
y
),
mp_obj_new_float
(
z
)
};
return
mp_obj_new_tuple
(
3
,
items
);
}
else
if
(
ret
==
ESP_ERR_NOT_FOUND
)
{
return
mp_const_none
;
}
// TODO: raise exception here
return
mp_const_none
;
mp_obj_t
items
[
3
]
=
{
mp_obj_new_float
(
x
),
mp_obj_new_float
(
y
),
mp_obj_new_float
(
z
)
};
return
mp_obj_new_tuple
(
3
,
items
);
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_0
(
mp_imu_acc_read_obj
,
mp_imu_acc_read
);
...
...
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