-
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/at30tse75x: add device driver for AT30TSE75x temperature sensor #3755
Conversation
d0e9619
to
51ab79f
Compare
@daniel-k thanks for the nice driver! Is the review urgent? Generally I would review this PR, but currently this may take some time. Does someone own this piece of hardware? Maybe @kaspar030? |
Ah, and I will assign myself for now. If someone else has capacities for a review, feel free to assign yourself :-) ! |
No, it's not urgent. Nothing depends on it, so take your time. Maybe the EEPROM driver will be finished before this get's merged (depending on my motivation) but I'd open a separate PR anyway. |
I'm not sure if it's a good idea to call |
I know I know.. Please check #2528? |
|
||
|
||
#include "periph/i2c.h" | ||
#include "hwtimer.h" |
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.
@daniel-k, sorry for the delay. Could you adapt the implementation to use xtimer
please
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.
0d171a8
to
3b9b21c
Compare
} | ||
|
||
switch(mode) { | ||
case AT30TSE75X_MODE_ONE_SHOT: |
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'm not sure out of my head if it's written in our coding conventions, but I think that case
is indented against switch
mostly
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'm just aware of these coding conventions and they don't mention this. But I don't really have an opinion on this, so I can adapt it if you wish.
EDIT: Linux kernel coding conventions even say to not indent case
:P
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.
Honestly I don't even care either. Just wanted to make it look similar to other code. Are there other opinions?
AT30TSE75X_CONFIG__RESOLUTION_SHIFT; | ||
|
||
/* Wait until conversion is finished */ | ||
xtimer_usleep((uint32_t)(25000 << resolution)); |
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 understand that the conversion time is dependent from the resolution. But why shifting 25000
?
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.
The conversion time is a multiple of 25ms. See datasheet p.47.
EDIT: Shifting because it's multiplication by 2^resolution.
@daniel-k thanks again for that PR. Code looks nice overall. Please adapt the discussed changes. After that we should see what the build tests report. Again: Does anyone own that hardware (e.g. ATIO1-XPRO dev board) ? Would be nice if the PR is tested by a second party before merging it. |
4958eb6
to
367e4b6
Compare
@PeterKietzmann Additionally I rebased on master and squashed everything that has been reviewed already into the first commit, as well as some cleanups and a sanity check of the supplied device address. |
return -1; | ||
} | ||
|
||
#if ENABLE_DEBUG |
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 think you can remove these preprocessor instructions now
@daniel-k thanks for addressing my comments. I'm fine with the small delay before the bus access. IIRC we had a similar situation for an other sensor (but with the CS line of SPI). Please address my latest minor comments. After that we can run Travis. |
Travis running, but still needs squashing. |
@daniel-k Travis failed for several boards because of a redefinition of |
#include <stdlib.h> | ||
#include <stdbool.h> | ||
#include "at30tse75x.h" | ||
#define MODULE_AT30TSE75X |
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.
Why did you introduce this in late before last commit? Travis complains about that define. (He complains about redefinition and I think it is initially defined by the makefile system)
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.
This slipped through by accident. Eclipse doesn't know those defines, so auto-completion doesn't work inside unknown #ifdef
s.
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.
Run make eclipsesym to create an eclipse symbol xml file that you can
import into your eclipse project. There's a page in the wiki about it.
On Oct 2, 2015 12:17 PM, "Daniel Krebs" [email protected] wrote:
In sys/shell/commands/sc_at30tse75x.c
#3755 (comment):
- * @{
- * @file
- * @brief Provides shell commands to test AT30TSE75x temperature sensor
- * @author Daniel Krebs [email protected]
- * @}
- */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include "at30tse75x.h"
+#define MODULE_AT30TSE75XThis slipped through by accident. Eclipse doesn't know those defines, so
auto-completion doesn't work inside unknown #ifdefs.—
Reply to this email directly or view it on GitHub
https://github.com/RIOT-OS/RIOT/pull/3755/files#r41007887.
9ec3950
to
396b76c
Compare
Finally, travis is happy :-D |
As far as I see it, nobody objects merging this PR. Again: I did not test this PR with hardware but the code looks fine now and makes Travis green. Because I'm away for two weeks from now on, I will just merge the PR, so @daniel-k can use the driver in his project in a more comfortable way. Also I do trust him that he'll take care of it, just if it causes some problems (but I assume that won't be the case ;-) ) |
So ACK and go |
drivers/at30tse75x: add device driver for AT30TSE75x temperature sensor
Sure! Thanks for merging! |
This PR add a device driver for the AT30TSE75x series temperature sensors included in the ATIO1-XPRO dev board. There's also a EEPROM on the same chips, for which I will add driver support later.
This PR weakly depends on #3751, but should work without error feedback nevertheless.