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:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
126:abea610beb85
Child:
163:e59c8e839560
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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