AndroidのBLEラジコンプロポアプリ「BLEPropo」と接続し、RCサーボとDCモータを制御するプログラムです。 BLE Nanoで動作を確認しています。 BLEPropo → https://github.com/lipoyang/BLEPropo

Dependencies:   BLE_API mbed

BLEを使ったAndroid用ラジコンプロポアプリ「BLEPropo」に対応するBLE Nano用ファームウェアです。
BLEPropoは、GitHubにて公開中。
https://github.com/lipoyang/BLEPropo
/media/uploads/lipoyang/blepropo_ui.png
ラジコンは、mbed HRM1017とRCサーボやDCモータを組み合わせて作ります。
/media/uploads/lipoyang/ministeer3.jpg
回路図
/media/uploads/lipoyang/ministeer3.pdf

Committer:
lipoyang
Date:
Sat Mar 14 12:02:48 2015 +0000
Revision:
5:7f89fca19a9e
-convert nRF51822 library to a folder

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lipoyang 5:7f89fca19a9e 1 /**************************************************************************/
lipoyang 5:7f89fca19a9e 2 /*!
lipoyang 5:7f89fca19a9e 3 @file compiler.h
lipoyang 5:7f89fca19a9e 4 @author hathach (tinyusb.org)
lipoyang 5:7f89fca19a9e 5
lipoyang 5:7f89fca19a9e 6 @section LICENSE
lipoyang 5:7f89fca19a9e 7
lipoyang 5:7f89fca19a9e 8 Software License Agreement (BSD License)
lipoyang 5:7f89fca19a9e 9
lipoyang 5:7f89fca19a9e 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
lipoyang 5:7f89fca19a9e 11 All rights reserved.
lipoyang 5:7f89fca19a9e 12
lipoyang 5:7f89fca19a9e 13 Redistribution and use in source and binary forms, with or without
lipoyang 5:7f89fca19a9e 14 modification, are permitted provided that the following conditions are met:
lipoyang 5:7f89fca19a9e 15 1. Redistributions of source code must retain the above copyright
lipoyang 5:7f89fca19a9e 16 notice, this list of conditions and the following disclaimer.
lipoyang 5:7f89fca19a9e 17 2. Redistributions in binary form must reproduce the above copyright
lipoyang 5:7f89fca19a9e 18 notice, this list of conditions and the following disclaimer in the
lipoyang 5:7f89fca19a9e 19 documentation and/or other materials provided with the distribution.
lipoyang 5:7f89fca19a9e 20 3. Neither the name of the copyright holders nor the
lipoyang 5:7f89fca19a9e 21 names of its contributors may be used to endorse or promote products
lipoyang 5:7f89fca19a9e 22 derived from this software without specific prior written permission.
lipoyang 5:7f89fca19a9e 23
lipoyang 5:7f89fca19a9e 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
lipoyang 5:7f89fca19a9e 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
lipoyang 5:7f89fca19a9e 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
lipoyang 5:7f89fca19a9e 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
lipoyang 5:7f89fca19a9e 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
lipoyang 5:7f89fca19a9e 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
lipoyang 5:7f89fca19a9e 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
lipoyang 5:7f89fca19a9e 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
lipoyang 5:7f89fca19a9e 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
lipoyang 5:7f89fca19a9e 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
lipoyang 5:7f89fca19a9e 34 */
lipoyang 5:7f89fca19a9e 35 /**************************************************************************/
lipoyang 5:7f89fca19a9e 36
lipoyang 5:7f89fca19a9e 37 /** \file
lipoyang 5:7f89fca19a9e 38 * \brief GCC Header
lipoyang 5:7f89fca19a9e 39 */
lipoyang 5:7f89fca19a9e 40
lipoyang 5:7f89fca19a9e 41 /** \ingroup Group_Compiler
lipoyang 5:7f89fca19a9e 42 * \defgroup Group_GCC GNU GCC
lipoyang 5:7f89fca19a9e 43 * @{
lipoyang 5:7f89fca19a9e 44 */
lipoyang 5:7f89fca19a9e 45
lipoyang 5:7f89fca19a9e 46 #ifndef _COMPILER_GCC_H_
lipoyang 5:7f89fca19a9e 47 #define _COMPILER_GCC_H_
lipoyang 5:7f89fca19a9e 48
lipoyang 5:7f89fca19a9e 49 #ifdef __cplusplus
lipoyang 5:7f89fca19a9e 50 extern "C" {
lipoyang 5:7f89fca19a9e 51 #endif
lipoyang 5:7f89fca19a9e 52
lipoyang 5:7f89fca19a9e 53 #include "projectconfig.h"
lipoyang 5:7f89fca19a9e 54
lipoyang 5:7f89fca19a9e 55 //#ifndef __GNUC__
lipoyang 5:7f89fca19a9e 56 // #define ATTR_ALWAYS_INLINE
lipoyang 5:7f89fca19a9e 57 // #define ATTR_CONST
lipoyang 5:7f89fca19a9e 58 //#else
lipoyang 5:7f89fca19a9e 59
lipoyang 5:7f89fca19a9e 60 #ifdef _TEST_
lipoyang 5:7f89fca19a9e 61 #define ATTR_ALWAYS_INLINE
lipoyang 5:7f89fca19a9e 62 #define STATIC_
lipoyang 5:7f89fca19a9e 63 #define INLINE_
lipoyang 5:7f89fca19a9e 64 #else
lipoyang 5:7f89fca19a9e 65 #define STATIC_ static
lipoyang 5:7f89fca19a9e 66 #define INLINE_ inline
lipoyang 5:7f89fca19a9e 67
lipoyang 5:7f89fca19a9e 68 #if CFG_DEBUG == 3
lipoyang 5:7f89fca19a9e 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
lipoyang 5:7f89fca19a9e 70 #endif
lipoyang 5:7f89fca19a9e 71 #endif
lipoyang 5:7f89fca19a9e 72
lipoyang 5:7f89fca19a9e 73 #define ALIGN_OF(x) __alignof__(x)
lipoyang 5:7f89fca19a9e 74
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 76 #define ATTR_SECTION(section) __attribute__ ((#section))
lipoyang 5:7f89fca19a9e 77
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
lipoyang 5:7f89fca19a9e 80
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
lipoyang 5:7f89fca19a9e 83
lipoyang 5:7f89fca19a9e 84 /**
lipoyang 5:7f89fca19a9e 85 * \defgroup Group_VariableAttr Variable Attributes
lipoyang 5:7f89fca19a9e 86 * @{
lipoyang 5:7f89fca19a9e 87 */
lipoyang 5:7f89fca19a9e 88
lipoyang 5:7f89fca19a9e 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
lipoyang 5:7f89fca19a9e 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
lipoyang 5:7f89fca19a9e 91
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 93 #define ATTR_PACKED __attribute__ ((packed))
lipoyang 5:7f89fca19a9e 94
lipoyang 5:7f89fca19a9e 95 #define ATTR_PREPACKED
lipoyang 5:7f89fca19a9e 96
lipoyang 5:7f89fca19a9e 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
lipoyang 5:7f89fca19a9e 98 /** @} */
lipoyang 5:7f89fca19a9e 99
lipoyang 5:7f89fca19a9e 100 /**
lipoyang 5:7f89fca19a9e 101 * \defgroup Group_FuncAttr Function Attributes
lipoyang 5:7f89fca19a9e 102 * @{
lipoyang 5:7f89fca19a9e 103 */
lipoyang 5:7f89fca19a9e 104
lipoyang 5:7f89fca19a9e 105 #ifndef ATTR_ALWAYS_INLINE
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
lipoyang 5:7f89fca19a9e 108 #endif
lipoyang 5:7f89fca19a9e 109
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 111 #define ATTR_NON_NULL __attribute__ ((nonull))
lipoyang 5:7f89fca19a9e 112
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 114 #define ATTR_PURE __attribute__ ((pure))
lipoyang 5:7f89fca19a9e 115
lipoyang 5:7f89fca19a9e 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.
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 118 #define ATTR_CONST __attribute__ ((const))
lipoyang 5:7f89fca19a9e 119
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
lipoyang 5:7f89fca19a9e 122
lipoyang 5:7f89fca19a9e 123 /// Same as the deprecated attribute with optional message in the warning
lipoyang 5:7f89fca19a9e 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
lipoyang 5:7f89fca19a9e 125
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 127 #define ATTR_WEAK __attribute__ ((weak))
lipoyang 5:7f89fca19a9e 128
lipoyang 5:7f89fca19a9e 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
lipoyang 5:7f89fca19a9e 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
lipoyang 5:7f89fca19a9e 131
lipoyang 5:7f89fca19a9e 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
lipoyang 5:7f89fca19a9e 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
lipoyang 5:7f89fca19a9e 134
lipoyang 5:7f89fca19a9e 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
lipoyang 5:7f89fca19a9e 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
lipoyang 5:7f89fca19a9e 137
lipoyang 5:7f89fca19a9e 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.
lipoyang 5:7f89fca19a9e 139 #define ATTR_USED __attribute__ ((used))
lipoyang 5:7f89fca19a9e 140
lipoyang 5:7f89fca19a9e 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.
lipoyang 5:7f89fca19a9e 142 #define ATTR_UNUSED __attribute__ ((unused))
lipoyang 5:7f89fca19a9e 143
lipoyang 5:7f89fca19a9e 144 /** @} */
lipoyang 5:7f89fca19a9e 145
lipoyang 5:7f89fca19a9e 146 #ifdef __cplusplus
lipoyang 5:7f89fca19a9e 147 }
lipoyang 5:7f89fca19a9e 148 #endif
lipoyang 5:7f89fca19a9e 149
lipoyang 5:7f89fca19a9e 150 #endif /* _COMPILER_GCC_H_ */
lipoyang 5:7f89fca19a9e 151
lipoyang 5:7f89fca19a9e 152 /// @}