-
Notifications
You must be signed in to change notification settings - Fork 2k
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
drivers: mag3110 rework #6886
drivers: mag3110 rework #6886
Conversation
smlng
commented
Apr 10, 2017
- rework driver mag3110 magnetometer
- add SAUL support
304a1c6
to
428be72
Compare
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.
A few nits and comments. I also think you could add an auto_init_mag3110
function in sys/auto_init/saul
. Then one can test the driver with examples/saul
by simply running:
USEMODULE=mag3110 make -C examples/saul flash term
* @{ | ||
* | ||
* @file | ||
* @brief MAG3110 adaption to the RIOT actuator/sensor interface |
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.
adaptation
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.
both are correct, I leave as is 'cause its written that way in every other saul adaption
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.
indeed, this is probably a French bias (it's also adaptation in French). According to this post, adaptation is the preferred form though.
But leave it like this it's fine.
tests/driver_mag3110/main.c
Outdated
printf("Initializing MAG3110 magnetometer at I2C_%i... ", TEST_MAG3110_I2C); | ||
if (mag3110_init(&dev, TEST_MAG3110_I2C, TEST_MAG3110_ADDR, MAG3110_DROS_DEFAULT) == 0) { | ||
printf("Initializing MAG3110 magnetometer at I2C_%i... ", mag3110_params->i2c); | ||
if (mag3110_init(&dev, mag3110_params) == 0) { |
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.
Here it should be &mag3110_params[0]
instead of mag3110_params
drivers/mag3110/mag3110.c
Outdated
if (i2c_init_master(i2c, I2C_SPEED) < 0) { | ||
i2c_release(dev->i2c); | ||
if (i2c_init_master(BUS, I2C_SPEED) < 0) { | ||
i2c_release(BUS); | ||
return -2; |
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.
It would be also great if you could add an enum for return codes
drivers/mag3110/mag3110.c
Outdated
if (reg != dev->params.type) { | ||
i2c_release(BUS); | ||
DEBUG("[mag3110] init - error: invalid WHO_AM_I value [0x%02x]\n", | ||
(int)reg); |
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.
align
428be72
to
720b720
Compare
@aabadie address[ed] your comments! |
08fb578
to
94563aa
Compare
@aabadie ping? Okay to squash and release Murdock on it? |
94563aa
to
56f0463
Compare
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.
Yes, please squash @smlng.
ACK when Murdock is green
56f0463
to
02a5fe9
Compare
02a5fe9
to
17e78f7
Compare