drivers/adxl345: fixes & cleanup#7067
Conversation
aabadie
left a comment
There was a problem hiding this comment.
Just a minor comment, otherwise look good. @haukepetersen what do you think ?
tests/driver_adxl345/main.c
Outdated
| adxl345_params->i2c); | ||
|
|
||
| if (adxl345_init(&dev, (adxl345_params_t*)adxl345_params) == ADXL345_OK) { | ||
| if (adxl345_init(&dev, adxl345_params) == ADXL345_OK) { |
There was a problem hiding this comment.
should be &adxl345_params[0], since ADXL_PARAMS macro may contain a list (defined by user).
There was a problem hiding this comment.
@aabadie I'll address your comment after @haukepetersen's review
haukepetersen
left a comment
There was a problem hiding this comment.
Looks good, two minor things and this PR is good to go.
tests/driver_adxl345/main.c
Outdated
| puts("ADXL345 test application"); | ||
| printf("Initializing ADXL345 accelerometer at I2C_DEV(%i)... ", | ||
| dev.i2c); | ||
| adxl345_params->i2c); |
There was a problem hiding this comment.
this should be adx11345_params[0].i2c if I am not mistaken. Comes down to the same thing, but would semantically the right thing to do here.
tests/driver_adxl345/main.c
Outdated
| adxl345_params->i2c); | ||
|
|
||
| if (adxl345_init(&dev, (adxl345_params_t*)adxl345_params) == ADXL345_OK) { | ||
| if (adxl345_init(&dev, adxl345_params) == ADXL345_OK) { |
|
and sorry for the long reaction time... |
|
@aabadie @haukepetersen |
|
ping |
|
Rebased on lastest master. |
|
|
||
| #define BUS (dev->i2c) | ||
| #define ADDR (dev->addr) | ||
| #define BUS (dev->params->i2c) |
There was a problem hiding this comment.
I think it should be dev->params.i2c instead of dev->params->i2c, same issue on the line below.
There was a problem hiding this comment.
params is a pointer, hence params->i2c
| typedef struct { | ||
| i2c_t i2c; /**< I2C device which is used */ | ||
| uint8_t addr; /**< I2C address */ | ||
| adxl345_params_t *params; /**< Device configuration */ |
There was a problem hiding this comment.
no need to use a pointer for params (was already the case)
There was a problem hiding this comment.
But it was requested by @haukepetersen in #6799 to save a bit of RAM.
The idea was the keep the often used data in RAM and let the rest in ROM.
There was a problem hiding this comment.
I went through #6799 but couldn't find any reference of that. Looking at the device driver implementation (especially this paragraph), the params attribute shouldn't be a pointer (it's called p in the wiki)
There was a problem hiding this comment.
@aabadie see #6799 (comment)
@haukepetersen what should we do ?
There was a problem hiding this comment.
@haukepetersen, what's your opinion here ? (You wrote the wiki and gave the pointer advice)
There was a problem hiding this comment.
I agree with using a pointer. This lets us put the configuration constants in ROM instead of in RAM. adxl345_params_t is significantly larger than a single pointer and I doubt the double dereference will cause any measurable performance delays when communicating with a I2C device.
|
ping |
|
@haukepetersen ping |
|
postponed |
|
@haukepetersen ping |
|
I guess we will never have @haukepetersen 's response here. Should I close ? |
|
We can look for other reviewers and clear the request of @haukepetersen - what about your requests @aabadie ? |
|
The problem here is not about clearing @haukepetersen's review but rather having his opinion on this comment and the associated thread. |
|
@aabadie if @haukepetersen is not sharing his opinion we need someone else to evaluate the case. Unresponsiveness is a DoS to the process, and this has been almost a year by now. |
Agreed @tcschmidt, let's ask @gebart who commented somewhere else about a similar problem. |
jnohlgard
left a comment
There was a problem hiding this comment.
Looks good to me, untested ACK
| typedef struct { | ||
| i2c_t i2c; /**< I2C device which is used */ | ||
| uint8_t addr; /**< I2C address */ | ||
| adxl345_params_t *params; /**< Device configuration */ |
There was a problem hiding this comment.
I agree with using a pointer. This lets us put the configuration constants in ROM instead of in RAM. adxl345_params_t is significantly larger than a single pointer and I doubt the double dereference will cause any measurable performance delays when communicating with a I2C device.
|
|
||
| #define BUS (dev->i2c) | ||
| #define ADDR (dev->addr) | ||
| #define BUS (dev->params->i2c) |
There was a problem hiding this comment.
params is a pointer, hence params->i2c
|
@aabadie are your concerns addressed ? |
|
This PR is blocked as long as the I2C embargo remains so no need to hurry. |
Maybe we need a label for that? |
Signed-off-by: dylad <dylan.laduranty@mesotic.com>
|
I resolved a conflict introduces by the I2C rework, now the embargo is over we can handle this PR :) |
|
Yep - but now @aabadie is gone. Is it easy to resolve @PeterKietzmann or shall we wait for Alex? |
|
We can wait for @aabadie to come back I guess. I don't mind. |
|
The PR is ACKed and only waits for testing. Unfortunately I don't have such a device available. @aabadie do you? Then, you can directly remove your change request :-). As I see it, the question about using a pointer to |
|
@aabadie ping |
aabadie
left a comment
There was a problem hiding this comment.
Let's go with this one. ACK
Other drivers need to be adapted the same way.
@haukepetersen As promised, this PR should address all your missing reviews from #6799
I hope I didn't forget something.