-
Notifications
You must be signed in to change notification settings - Fork 3k
DELTA_DFCM_NNN40 pull request #1002
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
Closed
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
120aefd
routine update
Marcomissyou dee7043
sync and modify PinNames, add FLASH SPI
Marcomissyou 9a992a7
do nothing
Marcomissyou bead745
Merge remote-tracking branch 'upstream/master'
Marcomissyou 831dab2
Merge remote-tracking branch 'upstream/master'
Marcomissyou 4394b25
update only
Marcomissyou f249a21
Merge remote-tracking branch 'upstream/master'
Marcomissyou ce0d8e1
routin commit
Marcomissyou 80ec7f7
Merge remote-tracking branch 'upstream/master'
Marcomissyou ef12ca8
commit to the newest version mbed_lib_rev96
Marcomissyou 9b06950
add rtc_api.c for RTC test
Marcomissyou 037497c
remote spi_flash and blinky main
Marcomissyou 2e0aff9
modify blinky main
Marcomissyou 55eb479
update mbed_overrides.c for shutdown Flash
Marcomissyou 6d53a99
Merge remote-tracking branch 'upstream/master'
Marcomissyou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ | |
|
||
#define DEVICE_CAN 0 | ||
|
||
#define DEVICE_RTC 0 | ||
#define DEVICE_RTC 1 | ||
|
||
#define DEVICE_ETHERNET 0 | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ries/mbed/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_DELTA_DFCM_NNN40/rtc_api.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* mbed Microcontroller Library | ||
* Copyright (c) 2006-2013 ARM Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "rtc_api.h" | ||
|
||
|
||
#define LFCLK_FREQUENCY (32768UL) | ||
#define RTC0_COUNTER_PRESCALER ((LFCLK_FREQUENCY/8) - 1) | ||
#define COMPARE_COUNTERTIME (691200UL) //86400 x 8 | ||
|
||
|
||
time_t initTime; | ||
|
||
void rtc_init(void) { | ||
|
||
NVIC_EnableIRQ(RTC0_IRQn); // Enable Interrupt for the RTC in the core. | ||
//NRF_RTC0->TASKS_STOP =1; | ||
NRF_RTC0->PRESCALER = RTC0_COUNTER_PRESCALER; // Set prescaler to a TICK of RTC_FREQUENCY. | ||
NRF_RTC0->CC[0] = COMPARE_COUNTERTIME; // Compare0 after approx COMPARE_COUNTERTIME seconds. | ||
|
||
// Enable COMPARE0 event and COMPARE0 interrupt: | ||
NRF_RTC0->EVTENSET = RTC_EVTENSET_COMPARE0_Msk; | ||
NRF_RTC0->INTENSET = RTC_INTENSET_COMPARE0_Msk; | ||
NRF_RTC0->TASKS_START = 1; | ||
|
||
|
||
} | ||
|
||
void rtc_free(void) { | ||
// [TODO] | ||
} | ||
|
||
/* | ||
* Little check routine to see if the RTC has been enabled | ||
* | ||
* Clock Control Register | ||
* RTC_CCR[0] : 0 = Disabled, 1 = Enabled | ||
* | ||
*/ | ||
int rtc_isenabled(void) { | ||
// [TODO] return(((NRF_RTC0->TASKS_START) & 0x01) != 0); | ||
} | ||
|
||
time_t rtc_read(void) { | ||
|
||
time_t t = initTime; | ||
t += (86400*NRF_RTC0->EVENTS_COMPARE[0]); | ||
t += (int)((NRF_RTC0->COUNTER)/8); | ||
return(t); | ||
} | ||
|
||
void rtc_write(time_t t) { | ||
// Convert the time in to a tm | ||
|
||
// Pause clock, and clear counter register (clears us count) | ||
NRF_RTC0->TASKS_STOP = 1; | ||
|
||
initTime = t; | ||
// Restart clock | ||
NRF_RTC0->TASKS_START = 1; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ int main() { | |
myled = 0; | ||
wait(0.2); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 remove this target?
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 target is added by me.
I added twice, so I remove one.
Thanks