iOSのBLEコントローラアプリ「RCBController」と接続し、コントローラの操作を取得するサンプルプログラムです。 mbed HRM1017で動作を確認しています。

Dependencies:   BLE_API_Native_IRC BLE_API mbed

Committer:
jksoft
Date:
Wed Aug 20 13:30:11 2014 +0000
Revision:
2:dd85fdc18224
Parent:
1:48f6e08a3ac2
???

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8c643bfe55b7 1 /**************************************************************************/
jksoft 0:8c643bfe55b7 2 /*!
jksoft 0:8c643bfe55b7 3 @file compiler.h
jksoft 0:8c643bfe55b7 4 @author hathach (tinyusb.org)
jksoft 0:8c643bfe55b7 5
jksoft 0:8c643bfe55b7 6 @section LICENSE
jksoft 0:8c643bfe55b7 7
jksoft 0:8c643bfe55b7 8 Software License Agreement (BSD License)
jksoft 0:8c643bfe55b7 9
jksoft 0:8c643bfe55b7 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
jksoft 0:8c643bfe55b7 11 All rights reserved.
jksoft 0:8c643bfe55b7 12
jksoft 0:8c643bfe55b7 13 Redistribution and use in source and binary forms, with or without
jksoft 0:8c643bfe55b7 14 modification, are permitted provided that the following conditions are met:
jksoft 0:8c643bfe55b7 15 1. Redistributions of source code must retain the above copyright
jksoft 0:8c643bfe55b7 16 notice, this list of conditions and the following disclaimer.
jksoft 0:8c643bfe55b7 17 2. Redistributions in binary form must reproduce the above copyright
jksoft 0:8c643bfe55b7 18 notice, this list of conditions and the following disclaimer in the
jksoft 0:8c643bfe55b7 19 documentation and/or other materials provided with the distribution.
jksoft 0:8c643bfe55b7 20 3. Neither the name of the copyright holders nor the
jksoft 0:8c643bfe55b7 21 names of its contributors may be used to endorse or promote products
jksoft 0:8c643bfe55b7 22 derived from this software without specific prior written permission.
jksoft 0:8c643bfe55b7 23
jksoft 0:8c643bfe55b7 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
jksoft 0:8c643bfe55b7 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
jksoft 0:8c643bfe55b7 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jksoft 0:8c643bfe55b7 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
jksoft 0:8c643bfe55b7 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jksoft 0:8c643bfe55b7 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
jksoft 0:8c643bfe55b7 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
jksoft 0:8c643bfe55b7 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jksoft 0:8c643bfe55b7 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
jksoft 0:8c643bfe55b7 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jksoft 0:8c643bfe55b7 34 */
jksoft 0:8c643bfe55b7 35 /**************************************************************************/
jksoft 0:8c643bfe55b7 36
jksoft 0:8c643bfe55b7 37 /** \file
jksoft 0:8c643bfe55b7 38 * \brief GCC Header
jksoft 0:8c643bfe55b7 39 */
jksoft 0:8c643bfe55b7 40
jksoft 0:8c643bfe55b7 41 /** \ingroup Group_Compiler
jksoft 0:8c643bfe55b7 42 * \defgroup Group_GCC GNU GCC
jksoft 0:8c643bfe55b7 43 * @{
jksoft 0:8c643bfe55b7 44 */
jksoft 0:8c643bfe55b7 45
jksoft 0:8c643bfe55b7 46 #ifndef _COMPILER_GCC_H_
jksoft 0:8c643bfe55b7 47 #define _COMPILER_GCC_H_
jksoft 0:8c643bfe55b7 48
jksoft 0:8c643bfe55b7 49 #ifdef __cplusplus
jksoft 0:8c643bfe55b7 50 extern "C" {
jksoft 0:8c643bfe55b7 51 #endif
jksoft 0:8c643bfe55b7 52
jksoft 0:8c643bfe55b7 53 #include "projectconfig.h"
jksoft 0:8c643bfe55b7 54
jksoft 0:8c643bfe55b7 55 //#ifndef __GNUC__
jksoft 0:8c643bfe55b7 56 // #define ATTR_ALWAYS_INLINE
jksoft 0:8c643bfe55b7 57 // #define ATTR_CONST
jksoft 0:8c643bfe55b7 58 //#else
jksoft 0:8c643bfe55b7 59
jksoft 0:8c643bfe55b7 60 #ifdef _TEST_
jksoft 0:8c643bfe55b7 61 #define ATTR_ALWAYS_INLINE
jksoft 0:8c643bfe55b7 62 #define STATIC_
jksoft 0:8c643bfe55b7 63 #define INLINE_
jksoft 0:8c643bfe55b7 64 #else
jksoft 0:8c643bfe55b7 65 #define STATIC_ static
jksoft 0:8c643bfe55b7 66 #define INLINE_ inline
jksoft 0:8c643bfe55b7 67
jksoft 0:8c643bfe55b7 68 #if CFG_DEBUG == 3
jksoft 0:8c643bfe55b7 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
jksoft 0:8c643bfe55b7 70 #endif
jksoft 0:8c643bfe55b7 71 #endif
jksoft 0:8c643bfe55b7 72
jksoft 0:8c643bfe55b7 73 #define ALIGN_OF(x) __alignof__(x)
jksoft 0:8c643bfe55b7 74
jksoft 0:8c643bfe55b7 75 /// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section
jksoft 0:8c643bfe55b7 76 #define ATTR_SECTION(section) __attribute__ ((#section))
jksoft 0:8c643bfe55b7 77
jksoft 0:8c643bfe55b7 78 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error that includes message is diagnosed. This is useful for compile-time checking
jksoft 0:8c643bfe55b7 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
jksoft 0:8c643bfe55b7 80
jksoft 0:8c643bfe55b7 81 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, a warning that includes message is diagnosed. This is useful for compile-time checking
jksoft 0:8c643bfe55b7 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
jksoft 0:8c643bfe55b7 83
jksoft 0:8c643bfe55b7 84 /**
jksoft 0:8c643bfe55b7 85 * \defgroup Group_VariableAttr Variable Attributes
jksoft 0:8c643bfe55b7 86 * @{
jksoft 0:8c643bfe55b7 87 */
jksoft 0:8c643bfe55b7 88
jksoft 0:8c643bfe55b7 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
jksoft 0:8c643bfe55b7 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
jksoft 0:8c643bfe55b7 91
jksoft 0:8c643bfe55b7 92 /// The packed attribute specifies that a variable or structure field should have the smallest possible alignment—one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute
jksoft 0:8c643bfe55b7 93 #define ATTR_PACKED __attribute__ ((packed))
jksoft 0:8c643bfe55b7 94
jksoft 0:8c643bfe55b7 95 #define ATTR_PREPACKED
jksoft 0:8c643bfe55b7 96
jksoft 0:8c643bfe55b7 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
jksoft 0:8c643bfe55b7 98 /** @} */
jksoft 0:8c643bfe55b7 99
jksoft 0:8c643bfe55b7 100 /**
jksoft 0:8c643bfe55b7 101 * \defgroup Group_FuncAttr Function Attributes
jksoft 0:8c643bfe55b7 102 * @{
jksoft 0:8c643bfe55b7 103 */
jksoft 0:8c643bfe55b7 104
jksoft 0:8c643bfe55b7 105 #ifndef ATTR_ALWAYS_INLINE
jksoft 0:8c643bfe55b7 106 /// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified
jksoft 0:8c643bfe55b7 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
jksoft 0:8c643bfe55b7 108 #endif
jksoft 0:8c643bfe55b7 109
jksoft 0:8c643bfe55b7 110 /// The nonnull attribute specifies that some function parameters should be non-null pointers. f the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. All pointer arguments are marked as non-null
jksoft 0:8c643bfe55b7 111 #define ATTR_NON_NULL __attribute__ ((nonull))
jksoft 0:8c643bfe55b7 112
jksoft 0:8c643bfe55b7 113 /// Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure
jksoft 0:8c643bfe55b7 114 #define ATTR_PURE __attribute__ ((pure))
jksoft 0:8c643bfe55b7 115
jksoft 0:8c643bfe55b7 116 /// Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.
jksoft 0:8c643bfe55b7 117 /// Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void
jksoft 0:8c643bfe55b7 118 #define ATTR_CONST __attribute__ ((const))
jksoft 0:8c643bfe55b7 119
jksoft 0:8c643bfe55b7 120 /// The deprecated attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses
jksoft 0:8c643bfe55b7 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
jksoft 0:8c643bfe55b7 122
jksoft 0:8c643bfe55b7 123 /// Same as the deprecated attribute with optional message in the warning
jksoft 0:8c643bfe55b7 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
jksoft 0:8c643bfe55b7 125
jksoft 0:8c643bfe55b7 126 /// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code
jksoft 0:8c643bfe55b7 127 #define ATTR_WEAK __attribute__ ((weak))
jksoft 0:8c643bfe55b7 128
jksoft 0:8c643bfe55b7 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
jksoft 0:8c643bfe55b7 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
jksoft 0:8c643bfe55b7 131
jksoft 0:8c643bfe55b7 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
jksoft 0:8c643bfe55b7 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
jksoft 0:8c643bfe55b7 134
jksoft 0:8c643bfe55b7 135 /// The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug
jksoft 0:8c643bfe55b7 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
jksoft 0:8c643bfe55b7 137
jksoft 0:8c643bfe55b7 138 /// This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly.
jksoft 0:8c643bfe55b7 139 #define ATTR_USED __attribute__ ((used))
jksoft 0:8c643bfe55b7 140
jksoft 0:8c643bfe55b7 141 /// This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function.
jksoft 0:8c643bfe55b7 142 #define ATTR_UNUSED __attribute__ ((unused))
jksoft 0:8c643bfe55b7 143
jksoft 0:8c643bfe55b7 144 /** @} */
jksoft 0:8c643bfe55b7 145
jksoft 0:8c643bfe55b7 146 #ifdef __cplusplus
jksoft 0:8c643bfe55b7 147 }
jksoft 0:8c643bfe55b7 148 #endif
jksoft 0:8c643bfe55b7 149
jksoft 0:8c643bfe55b7 150 #endif /* _COMPILER_GCC_H_ */
jksoft 0:8c643bfe55b7 151
jksoft 0:8c643bfe55b7 152 /// @}