ads1115 only

Fork of mbed by mbed official

Committer:
<>
Date:
Thu Nov 24 11:01:25 2016 +0000
Revision:
130:d75b3fe1f5cb
Parent:
128:9bcdf88f62b0
Release 130 of the mbed library

Ports for Upcoming Targets


Fixes and Changes

3127: Fixed the issue about push/pop of VFP register. https://github.com/ARMmbed/mbed-os/pull/3127
3176: Modifying micro:bit pin names to mirror micro:bit edge connector https://github.com/ARMmbed/mbed-os/pull/3176
3160: Fix wrong index at LPC43xx tx end ring assignment https://github.com/ARMmbed/mbed-os/pull/3160
3217: Add I2C_ASYNCH capability for DISCO_F469NI https://github.com/ARMmbed/mbed-os/pull/3217
3211: [NUC472/M453] Support single UART shared by multiple serial objects and other updates https://github.com/ARMmbed/mbed-os/pull/3211
3198: NUCLEO_F410RB: Add I2C_ASYNCH capability https://github.com/ARMmbed/mbed-os/pull/3198
3194: Update K64 sdk drivers https://github.com/ARMmbed/mbed-os/pull/3194
3159: User trim values for NCS36510 https://github.com/ARMmbed/mbed-os/pull/3159
3243: Fix make exporters compilation https://github.com/ARMmbed/mbed-os/pull/3243
3231: STM32F3: DISCO_F303VC - Add missing UART and ADC pin muxing options https://github.com/ARMmbed/mbed-os/pull/3231
3233: K20xx Calculate PWM clock relative to bus clock https://github.com/ARMmbed/mbed-os/pull/3233
3237: Added back USART 6 pins https://github.com/ARMmbed/mbed-os/pull/3237
3253: Fix default polarity on LPC43XX PWM driver https://github.com/ARMmbed/mbed-os/pull/3253
3238: Dev i2c stm32f4hal https://github.com/ARMmbed/mbed-os/pull/3238
3251: Dev stm32l0 cube v1.7.0 https://github.com/ARMmbed/mbed-os/pull/3251
3252: [NORDIC - NRF51 - MBED 2] Fix non handled RTC IRQ https://github.com/ARMmbed/mbed-os/pull/3252

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 128:9bcdf88f62b0 1
<> 128:9bcdf88f62b0 2 /** \addtogroup platform */
<> 128:9bcdf88f62b0 3 /** @{*/
<> 128:9bcdf88f62b0 4 /* mbed Microcontroller Library
<> 128:9bcdf88f62b0 5 * Copyright (c) 2006-2013 ARM Limited
<> 128:9bcdf88f62b0 6 *
<> 128:9bcdf88f62b0 7 * Licensed under the Apache License, Version 2.0 (the "License");
<> 128:9bcdf88f62b0 8 * you may not use this file except in compliance with the License.
<> 128:9bcdf88f62b0 9 * You may obtain a copy of the License at
<> 128:9bcdf88f62b0 10 *
<> 128:9bcdf88f62b0 11 * http://www.apache.org/licenses/LICENSE-2.0
<> 128:9bcdf88f62b0 12 *
<> 128:9bcdf88f62b0 13 * Unless required by applicable law or agreed to in writing, software
<> 128:9bcdf88f62b0 14 * distributed under the License is distributed on an "AS IS" BASIS,
<> 128:9bcdf88f62b0 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 128:9bcdf88f62b0 16 * See the License for the specific language governing permissions and
<> 128:9bcdf88f62b0 17 * limitations under the License.
<> 128:9bcdf88f62b0 18 */
<> 128:9bcdf88f62b0 19 #ifndef MBED_TOOLCHAIN_H
<> 128:9bcdf88f62b0 20 #define MBED_TOOLCHAIN_H
<> 128:9bcdf88f62b0 21
<> 130:d75b3fe1f5cb 22 #include "mbed_preprocessor.h"
<> 130:d75b3fe1f5cb 23
<> 128:9bcdf88f62b0 24
<> 128:9bcdf88f62b0 25 // Warning for unsupported compilers
<> 128:9bcdf88f62b0 26 #if !defined(__GNUC__) /* GCC */ \
<> 128:9bcdf88f62b0 27 && !defined(__CC_ARM) /* ARMCC */ \
<> 128:9bcdf88f62b0 28 && !defined(__clang__) /* LLVM/Clang */ \
<> 128:9bcdf88f62b0 29 && !defined(__ICCARM__) /* IAR */
<> 128:9bcdf88f62b0 30 #warning "This compiler is not yet supported."
<> 128:9bcdf88f62b0 31 #endif
<> 128:9bcdf88f62b0 32
<> 128:9bcdf88f62b0 33
<> 128:9bcdf88f62b0 34 // Attributes
<> 128:9bcdf88f62b0 35
<> 128:9bcdf88f62b0 36 /** MBED_PACKED
<> 128:9bcdf88f62b0 37 * Pack a structure, preventing any padding from being added between fields.
<> 128:9bcdf88f62b0 38 *
<> 128:9bcdf88f62b0 39 * @code
<> 128:9bcdf88f62b0 40 * #include "toolchain.h"
<> 128:9bcdf88f62b0 41 *
<> 128:9bcdf88f62b0 42 * MBED_PACKED(struct) foo {
<> 128:9bcdf88f62b0 43 * char x;
<> 128:9bcdf88f62b0 44 * int y;
<> 128:9bcdf88f62b0 45 * };
<> 128:9bcdf88f62b0 46 * @endcode
<> 128:9bcdf88f62b0 47 */
<> 128:9bcdf88f62b0 48 #ifndef MBED_PACKED
<> 128:9bcdf88f62b0 49 #if defined(__ICCARM__)
<> 128:9bcdf88f62b0 50 #define MBED_PACKED(struct) __packed struct
<> 128:9bcdf88f62b0 51 #else
<> 128:9bcdf88f62b0 52 #define MBED_PACKED(struct) struct __attribute__((packed))
<> 128:9bcdf88f62b0 53 #endif
<> 128:9bcdf88f62b0 54 #endif
<> 128:9bcdf88f62b0 55
<> 128:9bcdf88f62b0 56 /** MBED_ALIGN(N)
<> 128:9bcdf88f62b0 57 * Declare a variable to be aligned on an N-byte boundary.
<> 128:9bcdf88f62b0 58 *
<> 128:9bcdf88f62b0 59 * @note
<> 128:9bcdf88f62b0 60 * IAR does not support alignment greater than word size on the stack
<> 128:9bcdf88f62b0 61 *
<> 128:9bcdf88f62b0 62 * @code
<> 128:9bcdf88f62b0 63 * #include "toolchain.h"
<> 128:9bcdf88f62b0 64 *
<> 128:9bcdf88f62b0 65 * MBED_ALIGN(16) char a;
<> 128:9bcdf88f62b0 66 * @endcode
<> 128:9bcdf88f62b0 67 */
<> 128:9bcdf88f62b0 68 #ifndef MBED_ALIGN
<> 128:9bcdf88f62b0 69 #if defined(__ICCARM__)
<> 130:d75b3fe1f5cb 70 #define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N))
<> 128:9bcdf88f62b0 71 #else
<> 128:9bcdf88f62b0 72 #define MBED_ALIGN(N) __attribute__((aligned(N)))
<> 128:9bcdf88f62b0 73 #endif
<> 128:9bcdf88f62b0 74 #endif
<> 128:9bcdf88f62b0 75
<> 128:9bcdf88f62b0 76 /** MBED_UNUSED
<> 128:9bcdf88f62b0 77 * Declare a function argument to be unused, suppressing compiler warnings
<> 128:9bcdf88f62b0 78 *
<> 128:9bcdf88f62b0 79 * @code
<> 128:9bcdf88f62b0 80 * #include "toolchain.h"
<> 128:9bcdf88f62b0 81 *
<> 128:9bcdf88f62b0 82 * void foo(MBED_UNUSED int arg) {
<> 128:9bcdf88f62b0 83 *
<> 128:9bcdf88f62b0 84 * }
<> 128:9bcdf88f62b0 85 * @endcode
<> 128:9bcdf88f62b0 86 */
<> 128:9bcdf88f62b0 87 #ifndef MBED_UNUSED
<> 128:9bcdf88f62b0 88 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 128:9bcdf88f62b0 89 #define MBED_UNUSED __attribute__((__unused__))
<> 128:9bcdf88f62b0 90 #else
<> 128:9bcdf88f62b0 91 #define MBED_UNUSED
<> 128:9bcdf88f62b0 92 #endif
<> 128:9bcdf88f62b0 93 #endif
<> 128:9bcdf88f62b0 94
<> 128:9bcdf88f62b0 95 /** MBED_WEAK
<> 128:9bcdf88f62b0 96 * Mark a function as being weak.
<> 128:9bcdf88f62b0 97 *
<> 128:9bcdf88f62b0 98 * @note
<> 128:9bcdf88f62b0 99 * weak functions are not friendly to making code re-usable, as they can only
<> 128:9bcdf88f62b0 100 * be overridden once (and if they are multiply overridden the linker will emit
<> 128:9bcdf88f62b0 101 * no warning). You should not normally use weak symbols as part of the API to
<> 128:9bcdf88f62b0 102 * re-usable modules.
<> 128:9bcdf88f62b0 103 *
<> 128:9bcdf88f62b0 104 * @code
<> 128:9bcdf88f62b0 105 * #include "toolchain.h"
<> 128:9bcdf88f62b0 106 *
<> 128:9bcdf88f62b0 107 * MBED_WEAK void foo() {
<> 128:9bcdf88f62b0 108 * // a weak implementation of foo that can be overriden by a definition
<> 128:9bcdf88f62b0 109 * // without __weak
<> 128:9bcdf88f62b0 110 * }
<> 128:9bcdf88f62b0 111 * @endcode
<> 128:9bcdf88f62b0 112 */
<> 128:9bcdf88f62b0 113 #ifndef MBED_WEAK
<> 128:9bcdf88f62b0 114 #if defined(__ICCARM__)
<> 128:9bcdf88f62b0 115 #define MBED_WEAK __weak
<> 128:9bcdf88f62b0 116 #else
<> 128:9bcdf88f62b0 117 #define MBED_WEAK __attribute__((weak))
<> 128:9bcdf88f62b0 118 #endif
<> 128:9bcdf88f62b0 119 #endif
<> 128:9bcdf88f62b0 120
<> 128:9bcdf88f62b0 121 /** MBED_PURE
<> 128:9bcdf88f62b0 122 * Hint to the compiler that a function depends only on parameters
<> 128:9bcdf88f62b0 123 *
<> 128:9bcdf88f62b0 124 * @code
<> 128:9bcdf88f62b0 125 * #include "toolchain.h"
<> 128:9bcdf88f62b0 126 *
<> 128:9bcdf88f62b0 127 * MBED_PURE int foo(int arg){
<> 128:9bcdf88f62b0 128 * // no access to global variables
<> 128:9bcdf88f62b0 129 * }
<> 128:9bcdf88f62b0 130 * @endcode
<> 128:9bcdf88f62b0 131 */
<> 128:9bcdf88f62b0 132 #ifndef MBED_PURE
<> 128:9bcdf88f62b0 133 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 128:9bcdf88f62b0 134 #define MBED_PURE __attribute__((const))
<> 128:9bcdf88f62b0 135 #else
<> 128:9bcdf88f62b0 136 #define MBED_PURE
<> 128:9bcdf88f62b0 137 #endif
<> 128:9bcdf88f62b0 138 #endif
<> 128:9bcdf88f62b0 139
<> 128:9bcdf88f62b0 140 /** MBED_FORCEINLINE
<> 128:9bcdf88f62b0 141 * Declare a function that must always be inlined. Failure to inline
<> 128:9bcdf88f62b0 142 * such a function will result in an error.
<> 128:9bcdf88f62b0 143 *
<> 128:9bcdf88f62b0 144 * @code
<> 128:9bcdf88f62b0 145 * #include "toolchain.h"
<> 128:9bcdf88f62b0 146 *
<> 128:9bcdf88f62b0 147 * MBED_FORCEINLINE void foo() {
<> 128:9bcdf88f62b0 148 *
<> 128:9bcdf88f62b0 149 * }
<> 128:9bcdf88f62b0 150 * @endcode
<> 128:9bcdf88f62b0 151 */
<> 128:9bcdf88f62b0 152 #ifndef MBED_FORCEINLINE
<> 128:9bcdf88f62b0 153 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 128:9bcdf88f62b0 154 #define MBED_FORCEINLINE static inline __attribute__((always_inline))
<> 128:9bcdf88f62b0 155 #elif defined(__ICCARM__)
<> 128:9bcdf88f62b0 156 #define MBED_FORCEINLINE _Pragma("inline=forced") static
<> 128:9bcdf88f62b0 157 #else
<> 128:9bcdf88f62b0 158 #define MBED_FORCEINLINE static inline
<> 128:9bcdf88f62b0 159 #endif
<> 128:9bcdf88f62b0 160 #endif
<> 128:9bcdf88f62b0 161
<> 128:9bcdf88f62b0 162 /** MBED_NORETURN
<> 128:9bcdf88f62b0 163 * Declare a function that will never return.
<> 128:9bcdf88f62b0 164 *
<> 128:9bcdf88f62b0 165 * @code
<> 128:9bcdf88f62b0 166 * #include "toolchain.h"
<> 128:9bcdf88f62b0 167 *
<> 128:9bcdf88f62b0 168 * MBED_NORETURN void foo() {
<> 128:9bcdf88f62b0 169 * // must never return
<> 128:9bcdf88f62b0 170 * while (1) {}
<> 128:9bcdf88f62b0 171 * }
<> 128:9bcdf88f62b0 172 * @endcode
<> 128:9bcdf88f62b0 173 */
<> 128:9bcdf88f62b0 174 #ifndef MBED_NORETURN
<> 128:9bcdf88f62b0 175 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 128:9bcdf88f62b0 176 #define MBED_NORETURN __attribute__((noreturn))
<> 128:9bcdf88f62b0 177 #elif defined(__ICCARM__)
<> 128:9bcdf88f62b0 178 #define MBED_NORETURN __noreturn
<> 128:9bcdf88f62b0 179 #else
<> 128:9bcdf88f62b0 180 #define MBED_NORETURN
<> 128:9bcdf88f62b0 181 #endif
<> 128:9bcdf88f62b0 182 #endif
<> 128:9bcdf88f62b0 183
<> 128:9bcdf88f62b0 184 /** MBED_UNREACHABLE
<> 128:9bcdf88f62b0 185 * An unreachable statement. If the statement is reached,
<> 128:9bcdf88f62b0 186 * behaviour is undefined. Useful in situations where the compiler
<> 128:9bcdf88f62b0 187 * cannot deduce the unreachability of code.
<> 128:9bcdf88f62b0 188 *
<> 128:9bcdf88f62b0 189 * @code
<> 128:9bcdf88f62b0 190 * #include "toolchain.h"
<> 128:9bcdf88f62b0 191 *
<> 128:9bcdf88f62b0 192 * void foo(int arg) {
<> 128:9bcdf88f62b0 193 * switch (arg) {
<> 128:9bcdf88f62b0 194 * case 1: return 1;
<> 128:9bcdf88f62b0 195 * case 2: return 2;
<> 128:9bcdf88f62b0 196 * ...
<> 128:9bcdf88f62b0 197 * }
<> 128:9bcdf88f62b0 198 * MBED_UNREACHABLE;
<> 128:9bcdf88f62b0 199 * }
<> 128:9bcdf88f62b0 200 * @endcode
<> 128:9bcdf88f62b0 201 */
<> 128:9bcdf88f62b0 202 #ifndef MBED_UNREACHABLE
<> 128:9bcdf88f62b0 203 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
<> 128:9bcdf88f62b0 204 #define MBED_UNREACHABLE __builtin_unreachable()
<> 128:9bcdf88f62b0 205 #else
<> 128:9bcdf88f62b0 206 #define MBED_UNREACHABLE while (1)
<> 128:9bcdf88f62b0 207 #endif
<> 128:9bcdf88f62b0 208 #endif
<> 128:9bcdf88f62b0 209
<> 128:9bcdf88f62b0 210 /** MBED_DEPRECATED("message string")
<> 128:9bcdf88f62b0 211 * Mark a function declaration as deprecated, if it used then a warning will be
<> 128:9bcdf88f62b0 212 * issued by the compiler possibly including the provided message. Note that not
<> 128:9bcdf88f62b0 213 * all compilers are able to display the message.
<> 128:9bcdf88f62b0 214 *
<> 128:9bcdf88f62b0 215 * @code
<> 128:9bcdf88f62b0 216 * #include "toolchain.h"
<> 128:9bcdf88f62b0 217 *
<> 128:9bcdf88f62b0 218 * MBED_DEPRECATED("don't foo any more, bar instead")
<> 128:9bcdf88f62b0 219 * void foo(int arg);
<> 128:9bcdf88f62b0 220 * @endcode
<> 128:9bcdf88f62b0 221 */
<> 128:9bcdf88f62b0 222 #ifndef MBED_DEPRECATED
<> 130:d75b3fe1f5cb 223 #if defined(__CC_ARM)
<> 130:d75b3fe1f5cb 224 #define MBED_DEPRECATED(M) __attribute__((deprecated))
<> 130:d75b3fe1f5cb 225 #elif defined(__GNUC__) || defined(__clang__)
<> 128:9bcdf88f62b0 226 #define MBED_DEPRECATED(M) __attribute__((deprecated(M)))
<> 128:9bcdf88f62b0 227 #else
<> 128:9bcdf88f62b0 228 #define MBED_DEPRECATED(M)
<> 128:9bcdf88f62b0 229 #endif
<> 128:9bcdf88f62b0 230 #endif
<> 128:9bcdf88f62b0 231
<> 128:9bcdf88f62b0 232 /** MBED_DEPRECATED_SINCE("version", "message string")
<> 128:9bcdf88f62b0 233 * Mark a function declaration as deprecated, noting that the declaration was
<> 128:9bcdf88f62b0 234 * deprecated on the specified version. If the function is used then a warning
<> 128:9bcdf88f62b0 235 * will be issued by the compiler possibly including the provided message.
<> 128:9bcdf88f62b0 236 * Note that not all compilers are able to display this message.
<> 128:9bcdf88f62b0 237 *
<> 128:9bcdf88f62b0 238 * @code
<> 128:9bcdf88f62b0 239 * #include "toolchain.h"
<> 128:9bcdf88f62b0 240 *
<> 128:9bcdf88f62b0 241 * MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
<> 128:9bcdf88f62b0 242 * void foo(int arg);
<> 128:9bcdf88f62b0 243 * @endcode
<> 128:9bcdf88f62b0 244 */
<> 128:9bcdf88f62b0 245 #define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]")
<> 128:9bcdf88f62b0 246
<> 128:9bcdf88f62b0 247 /** MBED_CALLER_ADDR()
<> 128:9bcdf88f62b0 248 * Returns the caller of the current function.
<> 128:9bcdf88f62b0 249 *
<> 128:9bcdf88f62b0 250 * @note
<> 128:9bcdf88f62b0 251 * This macro is only implemented for GCC and ARMCC.
<> 128:9bcdf88f62b0 252 *
<> 128:9bcdf88f62b0 253 * @code
<> 128:9bcdf88f62b0 254 * #include "toolchain.h"
<> 128:9bcdf88f62b0 255 *
<> 128:9bcdf88f62b0 256 * printf("This function was called from %p", MBED_CALLER_ADDR());
<> 128:9bcdf88f62b0 257 * @endcode
<> 128:9bcdf88f62b0 258 *
<> 128:9bcdf88f62b0 259 * @return Address of the calling function
<> 128:9bcdf88f62b0 260 */
<> 128:9bcdf88f62b0 261 #ifndef MBED_CALLER_ADDR
<> 128:9bcdf88f62b0 262 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
<> 128:9bcdf88f62b0 263 #define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0))
<> 128:9bcdf88f62b0 264 #elif defined(__CC_ARM)
<> 128:9bcdf88f62b0 265 #define MBED_CALLER_ADDR() __builtin_return_address(0)
<> 128:9bcdf88f62b0 266 #else
<> 128:9bcdf88f62b0 267 #define MBED_CALLER_ADDR() (NULL)
<> 128:9bcdf88f62b0 268 #endif
<> 128:9bcdf88f62b0 269 #endif
<> 128:9bcdf88f62b0 270
<> 128:9bcdf88f62b0 271 // FILEHANDLE declaration
<> 128:9bcdf88f62b0 272 #if defined(TOOLCHAIN_ARM)
<> 128:9bcdf88f62b0 273 #include <rt_sys.h>
<> 128:9bcdf88f62b0 274 #endif
<> 128:9bcdf88f62b0 275
<> 128:9bcdf88f62b0 276 #ifndef FILEHANDLE
<> 128:9bcdf88f62b0 277 typedef int FILEHANDLE;
<> 128:9bcdf88f62b0 278 #endif
<> 128:9bcdf88f62b0 279
<> 128:9bcdf88f62b0 280 // Backwards compatibility
<> 128:9bcdf88f62b0 281 #ifndef WEAK
<> 128:9bcdf88f62b0 282 #define WEAK MBED_WEAK
<> 128:9bcdf88f62b0 283 #endif
<> 128:9bcdf88f62b0 284
<> 128:9bcdf88f62b0 285 #ifndef PACKED
<> 128:9bcdf88f62b0 286 #define PACKED MBED_PACKED()
<> 128:9bcdf88f62b0 287 #endif
<> 128:9bcdf88f62b0 288
<> 128:9bcdf88f62b0 289 #ifndef EXTERN
<> 128:9bcdf88f62b0 290 #define EXTERN extern
<> 128:9bcdf88f62b0 291 #endif
<> 128:9bcdf88f62b0 292
<> 128:9bcdf88f62b0 293 #endif
<> 128:9bcdf88f62b0 294
<> 128:9bcdf88f62b0 295 /** @}*/