Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* mbed Microcontroller Library
switches 0:5c4d7b2438d3 2 * Copyright (c) 2006-2015 ARM Limited
switches 0:5c4d7b2438d3 3 *
switches 0:5c4d7b2438d3 4 * Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 5 * you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 6 * You may obtain a copy of the License at
switches 0:5c4d7b2438d3 7 *
switches 0:5c4d7b2438d3 8 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 9 *
switches 0:5c4d7b2438d3 10 * Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 11 * distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 13 * See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 14 * limitations under the License.
switches 0:5c4d7b2438d3 15 */
switches 0:5c4d7b2438d3 16 #ifndef MBED_FUNCTIONPOINTER_H
switches 0:5c4d7b2438d3 17 #define MBED_FUNCTIONPOINTER_H
switches 0:5c4d7b2438d3 18
switches 0:5c4d7b2438d3 19 #include "platform/Callback.h"
switches 0:5c4d7b2438d3 20 #include "platform/toolchain.h"
switches 0:5c4d7b2438d3 21 #include <string.h>
switches 0:5c4d7b2438d3 22 #include <stdint.h>
switches 0:5c4d7b2438d3 23
switches 0:5c4d7b2438d3 24 namespace mbed {
switches 0:5c4d7b2438d3 25 /** \addtogroup platform */
switches 0:5c4d7b2438d3 26 /** @{*/
switches 0:5c4d7b2438d3 27
switches 0:5c4d7b2438d3 28
switches 0:5c4d7b2438d3 29 // Declarations for backwards compatibility
switches 0:5c4d7b2438d3 30 // To be foward compatible, code should adopt the Callback class
switches 0:5c4d7b2438d3 31 template <typename R, typename A1>
switches 0:5c4d7b2438d3 32 class FunctionPointerArg1 : public Callback<R(A1)> {
switches 0:5c4d7b2438d3 33 public:
switches 0:5c4d7b2438d3 34 MBED_DEPRECATED_SINCE("mbed-os-5.1",
switches 0:5c4d7b2438d3 35 "FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
switches 0:5c4d7b2438d3 36 FunctionPointerArg1(R (*function)(A1) = 0)
switches 0:5c4d7b2438d3 37 : Callback<R(A1)>(function) {}
switches 0:5c4d7b2438d3 38
switches 0:5c4d7b2438d3 39 template<typename T>
switches 0:5c4d7b2438d3 40 MBED_DEPRECATED_SINCE("mbed-os-5.1",
switches 0:5c4d7b2438d3 41 "FunctionPointerArg1<R, A> has been replaced by Callback<R(A)>")
switches 0:5c4d7b2438d3 42 FunctionPointerArg1(T *object, R (T::*member)(A1))
switches 0:5c4d7b2438d3 43 : Callback<R(A1)>(object, member) {}
switches 0:5c4d7b2438d3 44
switches 0:5c4d7b2438d3 45 R (*get_function())(A1) {
switches 0:5c4d7b2438d3 46 return *reinterpret_cast<R (**)(A1)>(this);
switches 0:5c4d7b2438d3 47 }
switches 0:5c4d7b2438d3 48
switches 0:5c4d7b2438d3 49 R call(A1 a1) const {
switches 0:5c4d7b2438d3 50 if (!Callback<R(A1)>::operator bool()) {
switches 0:5c4d7b2438d3 51 return (R)0;
switches 0:5c4d7b2438d3 52 }
switches 0:5c4d7b2438d3 53
switches 0:5c4d7b2438d3 54 return Callback<R(A1)>::call(a1);
switches 0:5c4d7b2438d3 55 }
switches 0:5c4d7b2438d3 56
switches 0:5c4d7b2438d3 57 R operator()(A1 a1) const {
switches 0:5c4d7b2438d3 58 return Callback<R(A1)>::call(a1);
switches 0:5c4d7b2438d3 59 }
switches 0:5c4d7b2438d3 60 };
switches 0:5c4d7b2438d3 61
switches 0:5c4d7b2438d3 62 template <typename R>
switches 0:5c4d7b2438d3 63 class FunctionPointerArg1<R, void> : public Callback<R()> {
switches 0:5c4d7b2438d3 64 public:
switches 0:5c4d7b2438d3 65 MBED_DEPRECATED_SINCE("mbed-os-5.1",
switches 0:5c4d7b2438d3 66 "FunctionPointer has been replaced by Callback<void()>")
switches 0:5c4d7b2438d3 67 FunctionPointerArg1(R (*function)() = 0)
switches 0:5c4d7b2438d3 68 : Callback<R()>(function) {}
switches 0:5c4d7b2438d3 69
switches 0:5c4d7b2438d3 70 template<typename T>
switches 0:5c4d7b2438d3 71 MBED_DEPRECATED_SINCE("mbed-os-5.1",
switches 0:5c4d7b2438d3 72 "FunctionPointer has been replaced by Callback<void()>")
switches 0:5c4d7b2438d3 73 FunctionPointerArg1(T *object, R (T::*member)())
switches 0:5c4d7b2438d3 74 : Callback<R()>(object, member) {}
switches 0:5c4d7b2438d3 75
switches 0:5c4d7b2438d3 76 R (*get_function())() {
switches 0:5c4d7b2438d3 77 return *reinterpret_cast<R (**)()>(this);
switches 0:5c4d7b2438d3 78 }
switches 0:5c4d7b2438d3 79
switches 0:5c4d7b2438d3 80 R call() const {
switches 0:5c4d7b2438d3 81 if (!Callback<R()>::operator bool()) {
switches 0:5c4d7b2438d3 82 return (R)0;
switches 0:5c4d7b2438d3 83 }
switches 0:5c4d7b2438d3 84
switches 0:5c4d7b2438d3 85 return Callback<R()>::call();
switches 0:5c4d7b2438d3 86 }
switches 0:5c4d7b2438d3 87
switches 0:5c4d7b2438d3 88 R operator()() const {
switches 0:5c4d7b2438d3 89 return Callback<R()>::call();
switches 0:5c4d7b2438d3 90 }
switches 0:5c4d7b2438d3 91 };
switches 0:5c4d7b2438d3 92
switches 0:5c4d7b2438d3 93 typedef FunctionPointerArg1<void, void> FunctionPointer;
switches 0:5c4d7b2438d3 94
switches 0:5c4d7b2438d3 95
switches 0:5c4d7b2438d3 96 } // namespace mbed
switches 0:5c4d7b2438d3 97
switches 0:5c4d7b2438d3 98 #endif
switches 0:5c4d7b2438d3 99
switches 0:5c4d7b2438d3 100 /** @}*/