The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NRF52_DK/TARGET_NORDIC/TARGET_NRF5/common_rtc.h@136:ef9c61f8c49f, 2017-02-14 (annotated)
- Committer:
- Kojto
- Date:
- Tue Feb 14 11:24:20 2017 +0000
- Revision:
- 136:ef9c61f8c49f
- Parent:
- 123:b0220dba8be7
- Child:
- 163:e59c8e839560
Release 136 of the mbed library
Ports for Upcoming Targets
Fixes and Changes
3432: Target STM USBHOST support https://github.com/ARMmbed/mbed-os/pull/3432
3181: NUCLEO_F207ZG extending PeripheralPins.c: all available alternate functions can be used now https://github.com/ARMmbed/mbed-os/pull/3181
3626: NUCLEO_F412ZG : Add USB Device +Host https://github.com/ARMmbed/mbed-os/pull/3626
3628: Fix warnings https://github.com/ARMmbed/mbed-os/pull/3628
3629: STM32: L0 LL layer https://github.com/ARMmbed/mbed-os/pull/3629
3632: IDE Export support for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3632
3642: Missing IRQ pin fix for platform VK_RZ_A1H https://github.com/ARMmbed/mbed-os/pull/3642
3664: Fix ncs36510 sleep definitions https://github.com/ARMmbed/mbed-os/pull/3664
3655: [STM32F4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3655
3657: [STM32L4] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3657
3658: [STM32F3] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3658
3685: STM32: I2C: reset state machine https://github.com/ARMmbed/mbed-os/pull/3685
3692: uVisor: Standardize available legacy heap and stack https://github.com/ARMmbed/mbed-os/pull/3692
3621: Fix for #2884, LPC824: export to LPCXpresso, target running with wron https://github.com/ARMmbed/mbed-os/pull/3621
3649: [STM32F7] Modify folder structure https://github.com/ARMmbed/mbed-os/pull/3649
3695: Enforce device_name is valid in targets.json https://github.com/ARMmbed/mbed-os/pull/3695
3723: NCS36510: spi_format function bug fix https://github.com/ARMmbed/mbed-os/pull/3723
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 123:b0220dba8be7 | 1 | /* mbed Microcontroller Library |
Kojto | 123:b0220dba8be7 | 2 | * Copyright (c) 2015 ARM Limited |
Kojto | 123:b0220dba8be7 | 3 | * |
Kojto | 123:b0220dba8be7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Kojto | 123:b0220dba8be7 | 5 | * you may not use this file except in compliance with the License. |
Kojto | 123:b0220dba8be7 | 6 | * You may obtain a copy of the License at |
Kojto | 123:b0220dba8be7 | 7 | * |
Kojto | 123:b0220dba8be7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Kojto | 123:b0220dba8be7 | 9 | * |
Kojto | 123:b0220dba8be7 | 10 | * Unless required by applicable law or agreed to in writing, software |
Kojto | 123:b0220dba8be7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Kojto | 123:b0220dba8be7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Kojto | 123:b0220dba8be7 | 13 | * See the License for the specific language governing permissions and |
Kojto | 123:b0220dba8be7 | 14 | * limitations under the License. |
Kojto | 123:b0220dba8be7 | 15 | */ |
Kojto | 123:b0220dba8be7 | 16 | |
Kojto | 123:b0220dba8be7 | 17 | #ifndef COMMON_RTC_H |
Kojto | 123:b0220dba8be7 | 18 | #define COMMON_RTC_H |
Kojto | 123:b0220dba8be7 | 19 | |
Kojto | 123:b0220dba8be7 | 20 | #include "nrf_rtc.h" |
Kojto | 123:b0220dba8be7 | 21 | |
Kojto | 123:b0220dba8be7 | 22 | #define RTC_COUNTER_BITS 24u |
Kojto | 123:b0220dba8be7 | 23 | |
Kojto | 123:b0220dba8be7 | 24 | // Instance 0 is reserved for SoftDevice. |
Kojto | 123:b0220dba8be7 | 25 | // Instance 1 is used as a common one for us_ticker, lp_ticker and (in case |
Kojto | 123:b0220dba8be7 | 26 | // of NRF51) as an alternative tick source for RTOS. |
Kojto | 123:b0220dba8be7 | 27 | // ["us_ticker.c" uses hard coded addresses of the 'NRF_RTC1->EVENT_COMPARE[1]' |
Kojto | 123:b0220dba8be7 | 28 | // register in inline assembly implementations of COMMON_RTC_IRQ_HANDLER, |
Kojto | 123:b0220dba8be7 | 29 | // please remember to update those in case of doing changes here] |
Kojto | 123:b0220dba8be7 | 30 | #define COMMON_RTC_INSTANCE NRF_RTC1 |
Kojto | 123:b0220dba8be7 | 31 | #define COMMON_RTC_IRQ_HANDLER RTC1_IRQHandler |
Kojto | 123:b0220dba8be7 | 32 | #define US_TICKER_CC_CHANNEL 0 |
Kojto | 123:b0220dba8be7 | 33 | #define OS_TICK_CC_CHANNEL 1 |
Kojto | 123:b0220dba8be7 | 34 | #define LP_TICKER_CC_CHANNEL 2 |
Kojto | 123:b0220dba8be7 | 35 | |
Kojto | 123:b0220dba8be7 | 36 | #define COMMON_RTC_EVENT_COMPARE(channel) \ |
Kojto | 123:b0220dba8be7 | 37 | CONCAT_2(NRF_RTC_EVENT_COMPARE_, channel) |
Kojto | 123:b0220dba8be7 | 38 | #define COMMON_RTC_INT_COMPARE_MASK(channel) \ |
Kojto | 123:b0220dba8be7 | 39 | CONCAT_3(NRF_RTC_INT_COMPARE, channel, _MASK) |
Kojto | 123:b0220dba8be7 | 40 | |
Kojto | 123:b0220dba8be7 | 41 | #define US_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(US_TICKER_CC_CHANNEL) |
Kojto | 123:b0220dba8be7 | 42 | #define US_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(US_TICKER_CC_CHANNEL) |
Kojto | 123:b0220dba8be7 | 43 | #define OS_TICK_EVENT COMMON_RTC_EVENT_COMPARE(OS_TICK_CC_CHANNEL) |
Kojto | 123:b0220dba8be7 | 44 | #define OS_TICK_INT_MASK COMMON_RTC_INT_COMPARE_MASK(OS_TICK_CC_CHANNEL) |
Kojto | 123:b0220dba8be7 | 45 | #define LP_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(LP_TICKER_CC_CHANNEL) |
Kojto | 123:b0220dba8be7 | 46 | #define LP_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(LP_TICKER_CC_CHANNEL) |
Kojto | 123:b0220dba8be7 | 47 | |
Kojto | 123:b0220dba8be7 | 48 | extern bool m_common_rtc_enabled; |
Kojto | 123:b0220dba8be7 | 49 | extern uint32_t volatile m_common_rtc_overflows; |
Kojto | 123:b0220dba8be7 | 50 | |
Kojto | 123:b0220dba8be7 | 51 | void common_rtc_init(void); |
Kojto | 123:b0220dba8be7 | 52 | uint32_t common_rtc_32bit_ticks_get(void); |
Kojto | 123:b0220dba8be7 | 53 | uint64_t common_rtc_64bit_us_get(void); |
Kojto | 123:b0220dba8be7 | 54 | void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel, |
Kojto | 123:b0220dba8be7 | 55 | uint32_t int_mask); |
Kojto | 123:b0220dba8be7 | 56 | |
Kojto | 123:b0220dba8be7 | 57 | #endif // COMMON_RTC_H |