-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mpu6050 impr3 add cdev #31
base: Dmytro.Kirtoka
Are you sure you want to change the base?
Mpu6050 impr3 add cdev #31
Conversation
e10217d
to
51ebcf7
Compare
finished the driver, ready for review |
51ebcf7
to
a01f6a5
Compare
three dependent commits for mpu6050 practics:
|
a01f6a5
to
c8643dd
Compare
Driver change: |
I'm tested last changes and work at fix it |
added ring buffer with 10 elm added timer with module parameter rate, default is 1000 msec added work for periodic read data from device sheduled by time
added dinamic add/remove device in /dev added support read only fops for mpu6050 module limitation: read data by only READ_REG_NUM blocks supported only one device
c8643dd
to
181bde6
Compare
Check on device, apply kernel code style. |
Signed-off-by: dmytro.kirtoka <[email protected]>
181bde6
to
2374c33
Compare
@dmytrokirtoka , is this PR is still relevant? |
is this PR is still relevant?
|
this pull request have another realization of buffering, see branch "added buffered read data by time", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I haven't tested - only reviewed.
Good exercise implementation (timer, completion, etc).
Nitpicks:
- Commit messages could be improved (following kernel recommendations, SOB, etc.)
- Changes of "mpu6050: apply kernel code style" which fixes previous commits are better to include in place.
|
||
return 0; | ||
} | ||
|
||
static int mpu6050_get_data(int *values, int is_buffered) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, there's no need to make is_buffered
a parameter here.
If you check is_buf
inside mpu6050_read_data()
, I believe mpu6050_get_data()
should follow the same.
mpu6050/mpu6050.c
Outdated
g_mpu6050_data.data[head].values.temperature = (temp + 12420 + 170) / 340; | ||
|
||
if ((is_buf && count < READ_DEPTH) || (!is_buf && !count)) | ||
complete(&has_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to note: I haven't made deep analyse bu afraid of possibility of some race with mpu6050_get_data()
,
which may cause has_data
became desynchronized with g_mpu6050_data.count
.
complete mpu6050 dev for next use.