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:
Fri Aug 12 13:04:35 2016 +0200
Revision:
123:b0220dba8be7
Parent:
122:f9eeca106725
Child:
124:2241e3a39974
Release 123 of the mbed library

Changes:
- new targets: nucleo_f207zg, beetle, nrf51_dk, hexiwear,
nuvoton nuc472, vk rz a1h
- ST - fix timer interrupt handler, sleep api fix
- NXP - lpc15xx us ticker fix
- Nordic - analogin fixes, LF clock init addition, enable i2c async

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 65:5798e58a58b1 1 /* mbed Microcontroller Library
Kojto 98:8ab26030e058 2 * Copyright (c) 2006-2015 ARM Limited
bogdanm 65:5798e58a58b1 3 *
bogdanm 65:5798e58a58b1 4 * Licensed under the Apache License, Version 2.0 (the "License");
bogdanm 65:5798e58a58b1 5 * you may not use this file except in compliance with the License.
bogdanm 65:5798e58a58b1 6 * You may obtain a copy of the License at
bogdanm 65:5798e58a58b1 7 *
bogdanm 65:5798e58a58b1 8 * http://www.apache.org/licenses/LICENSE-2.0
bogdanm 65:5798e58a58b1 9 *
bogdanm 65:5798e58a58b1 10 * Unless required by applicable law or agreed to in writing, software
bogdanm 65:5798e58a58b1 11 * distributed under the License is distributed on an "AS IS" BASIS,
bogdanm 65:5798e58a58b1 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bogdanm 65:5798e58a58b1 13 * See the License for the specific language governing permissions and
bogdanm 65:5798e58a58b1 14 * limitations under the License.
bogdanm 65:5798e58a58b1 15 */
bogdanm 65:5798e58a58b1 16 #ifndef MBED_FUNCTIONPOINTER_H
bogdanm 65:5798e58a58b1 17 #define MBED_FUNCTIONPOINTER_H
bogdanm 65:5798e58a58b1 18
Kojto 122:f9eeca106725 19 #include "Callback.h"
Kojto 123:b0220dba8be7 20 #include "toolchain.h"
bogdanm 65:5798e58a58b1 21 #include <string.h>
Kojto 98:8ab26030e058 22 #include <stdint.h>
bogdanm 65:5798e58a58b1 23
bogdanm 65:5798e58a58b1 24 namespace mbed {
bogdanm 65:5798e58a58b1 25
Kojto 98:8ab26030e058 26
Kojto 122:f9eeca106725 27 // Declarations for backwards compatibility
Kojto 122:f9eeca106725 28 // To be foward compatible, code should adopt the Callback class
Kojto 122:f9eeca106725 29 template <typename R, typename A1>
Kojto 122:f9eeca106725 30 class FunctionPointerArg1 : public Callback<R(A1)> {
Kojto 122:f9eeca106725 31 public:
Kojto 123:b0220dba8be7 32 MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
Kojto 122:f9eeca106725 33 FunctionPointerArg1(R (*function)(A1) = 0)
Kojto 122:f9eeca106725 34 : Callback<R(A1)>(function) {}
Kojto 98:8ab26030e058 35
Kojto 98:8ab26030e058 36 template<typename T>
Kojto 123:b0220dba8be7 37 MBED_DEPRECATED("FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
Kojto 122:f9eeca106725 38 FunctionPointerArg1(T *object, R (T::*member)(A1))
Kojto 122:f9eeca106725 39 : Callback<R(A1)>(object, member) {}
Kojto 98:8ab26030e058 40
Kojto 122:f9eeca106725 41 R (*get_function())(A1) {
Kojto 122:f9eeca106725 42 return *reinterpret_cast<R (**)(A1)>(this);
Kojto 98:8ab26030e058 43 }
Kojto 98:8ab26030e058 44 };
Kojto 98:8ab26030e058 45
Kojto 98:8ab26030e058 46 template <typename R>
Kojto 122:f9eeca106725 47 class FunctionPointerArg1<R, void> : public Callback<R()> {
Kojto 98:8ab26030e058 48 public:
Kojto 123:b0220dba8be7 49 MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
Kojto 122:f9eeca106725 50 FunctionPointerArg1(R (*function)() = 0)
Kojto 122:f9eeca106725 51 : Callback<R()>(function) {}
bogdanm 65:5798e58a58b1 52
bogdanm 65:5798e58a58b1 53 template<typename T>
Kojto 123:b0220dba8be7 54 MBED_DEPRECATED("FunctionPointer has been replaced by Callback<void()>")
Kojto 122:f9eeca106725 55 FunctionPointerArg1(T *object, R (T::*member)())
Kojto 122:f9eeca106725 56 : Callback<R()>(object, member) {}
bogdanm 65:5798e58a58b1 57
Kojto 122:f9eeca106725 58 R (*get_function())() {
Kojto 122:f9eeca106725 59 return *reinterpret_cast<R (**)()>(this);
Kojto 98:8ab26030e058 60 }
bogdanm 65:5798e58a58b1 61 };
bogdanm 65:5798e58a58b1 62
Kojto 98:8ab26030e058 63 typedef FunctionPointerArg1<void, void> FunctionPointer;
Kojto 122:f9eeca106725 64
Kojto 98:8ab26030e058 65
bogdanm 65:5798e58a58b1 66 } // namespace mbed
bogdanm 65:5798e58a58b1 67
bogdanm 65:5798e58a58b1 68 #endif