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.

Committer:
Kojto
Date:
Wed Jul 19 16:46:19 2017 +0100
Revision:
147:a97add6d7e64
Parent:
133:99b5ccf27215
Child:
163:e59c8e839560
Release 147 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 133:99b5ccf27215 1 /* mbed Microcontroller Library
<> 133:99b5ccf27215 2 * Copyright (c) 2015 ARM Limited
<> 133:99b5ccf27215 3 *
<> 133:99b5ccf27215 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 133:99b5ccf27215 5 * you may not use this file except in compliance with the License.
<> 133:99b5ccf27215 6 * You may obtain a copy of the License at
<> 133:99b5ccf27215 7 *
<> 133:99b5ccf27215 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 133:99b5ccf27215 9 *
<> 133:99b5ccf27215 10 * Unless required by applicable law or agreed to in writing, software
<> 133:99b5ccf27215 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 133:99b5ccf27215 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 133:99b5ccf27215 13 * See the License for the specific language governing permissions and
<> 133:99b5ccf27215 14 * limitations under the License.
<> 133:99b5ccf27215 15 */
<> 133:99b5ccf27215 16
<> 133:99b5ccf27215 17 #ifndef COMMON_RTC_H
<> 133:99b5ccf27215 18 #define COMMON_RTC_H
<> 133:99b5ccf27215 19
<> 133:99b5ccf27215 20 #include "nrf_rtc.h"
<> 133:99b5ccf27215 21
<> 133:99b5ccf27215 22 #define RTC_COUNTER_BITS 24u
<> 133:99b5ccf27215 23
<> 133:99b5ccf27215 24 // Instance 0 is reserved for SoftDevice.
<> 133:99b5ccf27215 25 // Instance 1 is used as a common one for us_ticker, lp_ticker and (in case
<> 133:99b5ccf27215 26 // of NRF51) as an alternative tick source for RTOS.
<> 133:99b5ccf27215 27 // ["us_ticker.c" uses hard coded addresses of the 'NRF_RTC1->EVENT_COMPARE[1]'
<> 133:99b5ccf27215 28 // register in inline assembly implementations of COMMON_RTC_IRQ_HANDLER,
<> 133:99b5ccf27215 29 // please remember to update those in case of doing changes here]
<> 133:99b5ccf27215 30 #define COMMON_RTC_INSTANCE NRF_RTC1
<> 133:99b5ccf27215 31 #define COMMON_RTC_IRQ_HANDLER RTC1_IRQHandler
<> 133:99b5ccf27215 32 #define US_TICKER_CC_CHANNEL 0
<> 133:99b5ccf27215 33 #define OS_TICK_CC_CHANNEL 1
<> 133:99b5ccf27215 34 #define LP_TICKER_CC_CHANNEL 2
<> 133:99b5ccf27215 35
<> 133:99b5ccf27215 36 #define COMMON_RTC_EVENT_COMPARE(channel) \
<> 133:99b5ccf27215 37 CONCAT_2(NRF_RTC_EVENT_COMPARE_, channel)
<> 133:99b5ccf27215 38 #define COMMON_RTC_INT_COMPARE_MASK(channel) \
<> 133:99b5ccf27215 39 CONCAT_3(NRF_RTC_INT_COMPARE, channel, _MASK)
<> 133:99b5ccf27215 40
<> 133:99b5ccf27215 41 #define US_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(US_TICKER_CC_CHANNEL)
<> 133:99b5ccf27215 42 #define US_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(US_TICKER_CC_CHANNEL)
<> 133:99b5ccf27215 43 #define OS_TICK_EVENT COMMON_RTC_EVENT_COMPARE(OS_TICK_CC_CHANNEL)
<> 133:99b5ccf27215 44 #define OS_TICK_INT_MASK COMMON_RTC_INT_COMPARE_MASK(OS_TICK_CC_CHANNEL)
<> 133:99b5ccf27215 45 #define LP_TICKER_EVENT COMMON_RTC_EVENT_COMPARE(LP_TICKER_CC_CHANNEL)
<> 133:99b5ccf27215 46 #define LP_TICKER_INT_MASK COMMON_RTC_INT_COMPARE_MASK(LP_TICKER_CC_CHANNEL)
<> 133:99b5ccf27215 47
<> 133:99b5ccf27215 48 extern bool m_common_rtc_enabled;
<> 133:99b5ccf27215 49 extern uint32_t volatile m_common_rtc_overflows;
<> 133:99b5ccf27215 50
<> 133:99b5ccf27215 51 void common_rtc_init(void);
<> 133:99b5ccf27215 52 uint32_t common_rtc_32bit_ticks_get(void);
<> 133:99b5ccf27215 53 uint64_t common_rtc_64bit_us_get(void);
<> 133:99b5ccf27215 54 void common_rtc_set_interrupt(uint32_t us_timestamp, uint32_t cc_channel,
<> 133:99b5ccf27215 55 uint32_t int_mask);
<> 133:99b5ccf27215 56
<> 133:99b5ccf27215 57 #endif // COMMON_RTC_H