-
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
cpu/samd21: add rtc periph implementation #2197
Conversation
//#define REFERENCE_YEAR 2000 | ||
static uint16_t reference_year = 2000; | ||
|
||
void rtc_init(void){ |
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.
coding conventions (opening curly brace on new line)
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 goes for all functions..
I don't have a device for testing at hand - did you check with #2061 ? |
Nope, I didn't, why don't you merge it to main repo if it works? |
Long story short: It wasn't ready until half an hour ago and is now waiting for squashing and review. |
Ok :-) |
@LudwigOrtmann
My registers are normal ( RTC.MODE2.CLOCK) Ok I found what you did in _print_time() Btw, I didn't understand why the settime didn't work. EDIT: I understand now, it's because when you parse the struct time, you remove 1900 and 1 so my rtc_settime return -1 |
Either I change my file to adapt your shell or I leave my file like this. The thing is if someone doesn't use the shell, he has to to copy your code to parse the time as you do. Leaving my code, he would have nothing to do apart from gettime :-) Let me know what you think about that. |
It's really not "my code" but the standard defined for that data type. |
Ok I see what you mean. So I should return the year from 1900 and a month starting at 0 not one. |
Great! |
One last question: |
I don't think any platform does this at this time. |
Good, I made the changes. I only set my default year to 2000 (1900+100) because SAMR21 allows only 64years as I explained at the end of the file. |
Feel free to squash. |
@@ -0,0 +1,201 @@ | |||
/* | |||
* Copyright (C) 2014 CLENET Baptiste |
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 don't really care, but as far as I know, all other files use a "Forename Surname" pattern.
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.
Sorry, just saw this now..
Changes done and squashed |
#define I2C_0_PINS (PORT_PA16 | PORT_PA17) | ||
/* Default Clock Source on reset OSC8M - 8MHz */ | ||
#define I2C_0_REF_F (8000000UL) | ||
|
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 there's a closing Doxygen parenthesis missing...
In any case it would be nice to keep this as a separate commit.
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.
hm, this section is already part of master.
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.
Yep, true, I will edit that in a bit
Le 17 déc. 2014 12:59, "Thomas Eichinger" notifications@github.com a
écrit :
In boards/samr21-xpro/include/periph_conf.h
#2197 (diff):+#define I2C_1_EN 0
+#define I2C_2_EN 0
+#define I2C_3_EN 0
+#define I2C_IRQ_PRIO 1
+
+#define I2C_0_DEV SERCOM3->I2CM
+#define I2C_0_IRQ SERCOM3_IRQn
+#define I2C_0_ISR isr_sercom3
+/* I2C 0 pin configuration /
+#define I2C_0_PORT (PORT->Group[0])
+#define I2C_SDA PIN_PA16
+#define I2C_SCL PIN_PA17
+#define I2C_0_PINS (PORT_PA16 | PORT_PA17)
+/ Default Clock Source on reset OSC8M - 8MHz */
+#define I2C_0_REF_F (8000000UL)
+hm, this section is already part of master
https://github.com/RIOT-OS/RIOT/blob/master/boards/samr21-xpro/include/periph_conf.h#L133
.—
Reply to this email directly or view it on GitHub
https://github.com/RIOT-OS/RIOT/pull/2197/files#r21967452.
/* GPIO channel 2 config */ | ||
#define GPIO_2_DEV PORT->Group[0] | ||
#define GPIO_2_PIN PIN_PA15 | ||
#define GPIO_2_EXTINT 15 | ||
#define GPIO_2_EXTINT 15 |
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'd also move these into a separate commit.
Sorry for torturing you about the commits ;) |
Done |
Where are the commits? |
(They can stay part of this PR..) |
These comits were not part of this PR. |
But aren't they needed? Which PR does contain them? |
@@ -1 +1 @@ | |||
FEATURES_PROVIDED += periph_gpio cpp periph_uart periph_timer | |||
FEATURES_PROVIDED += periph_gpio cpp periph_uart periph_timer periph_i2c periph_rtc |
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.
In case the i2c changes are part of an external PR, the periph_i2c
here should probably be removed too.
Reassigning to @thomaseichinger for testing. |
Rebase and squash done. (And also because I'm bad at using GitHub :-) ) |
I guess you need to rebase again. |
Nope, it should be fine now. (one commit, only my changes) |
The button on this page says there's conflicts so it can't be merged. Maybe all you need to do is bring your own master up-to-date? |
@@ -1 +1 @@ | |||
FEATURES_PROVIDED += periph_gpio cpp periph_uart periph_timer | |||
FEATURES_PROVIDED += periph_gpio cpp periph_uart periph_timer periph_rtc |
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.
Sorry, there should be a periph_i2c
here, probably it only was indicated as a change because your own master wasn't up to date. I wasn't aware of that PR.
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.
To explain:
This is a problem in the GitHub interface - it shows diffs against the master of the fork (bapclenet/RIOT.git/master in this case), not against the branch it is going to be merged into (in this case RIOT-OS/RIOT.git/master).
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.
So, what you need to do: update your master, rebase on it, push both, your master and this branch.
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.
My repo is "dirty" so I'm going to delete my fork and redo the pull request after a clean fork.
Is that fine?
(Because it tells that it's up to date and rebase is too long, wait for your agreement before doing that)
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.
That would not have been necessary - don't hesitate to ask for help with git in the future ;)
Implementation of RTC for the SAMR21 board
It uses GCLK2 with OSC32K