Use Tiny BLE as a joystick. The data is got from an external data source via a serial port.

Dependencies:   BLE_API BLE_HID eMPL_MPU6050 mbed nRF51822

Fork of Seeed_Tiny_BLE_Get_Started by Seeed

Committer:
bowenfeng
Date:
Mon Jun 12 04:10:04 2017 +0000
Revision:
4:89f37a17eba6
Use Tiny BLE as a BLE joystick. The direction data is got from an external data source via serial protocol.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bowenfeng 4:89f37a17eba6 1 /* mbed Microcontroller Library
bowenfeng 4:89f37a17eba6 2 * Copyright (c) 2015 ARM Limited
bowenfeng 4:89f37a17eba6 3 *
bowenfeng 4:89f37a17eba6 4 * Licensed under the Apache License, Version 2.0 (the "License");
bowenfeng 4:89f37a17eba6 5 * you may not use this file except in compliance with the License.
bowenfeng 4:89f37a17eba6 6 * You may obtain a copy of the License at
bowenfeng 4:89f37a17eba6 7 *
bowenfeng 4:89f37a17eba6 8 * http://www.apache.org/licenses/LICENSE-2.0
bowenfeng 4:89f37a17eba6 9 *
bowenfeng 4:89f37a17eba6 10 * Unless required by applicable law or agreed to in writing, software
bowenfeng 4:89f37a17eba6 11 * distributed under the License is distributed on an "AS IS" BASIS,
bowenfeng 4:89f37a17eba6 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bowenfeng 4:89f37a17eba6 13 * See the License for the specific language governing permissions and
bowenfeng 4:89f37a17eba6 14 * limitations under the License.
bowenfeng 4:89f37a17eba6 15 */
bowenfeng 4:89f37a17eba6 16
bowenfeng 4:89f37a17eba6 17 #ifndef HID_EXAMPLES_COMMON_H_
bowenfeng 4:89f37a17eba6 18 #define HID_EXAMPLES_COMMON_H_
bowenfeng 4:89f37a17eba6 19
bowenfeng 4:89f37a17eba6 20 /**
bowenfeng 4:89f37a17eba6 21 * Functions and configuration common to all HID demos
bowenfeng 4:89f37a17eba6 22 */
bowenfeng 4:89f37a17eba6 23
bowenfeng 4:89f37a17eba6 24 #include "ble/BLE.h"
bowenfeng 4:89f37a17eba6 25
bowenfeng 4:89f37a17eba6 26 #include "HIDServiceBase.h"
bowenfeng 4:89f37a17eba6 27
bowenfeng 4:89f37a17eba6 28 /**
bowenfeng 4:89f37a17eba6 29 * IO capabilities of the device. During development, you most likely want "JustWorks", which means
bowenfeng 4:89f37a17eba6 30 * no IO capabilities.
bowenfeng 4:89f37a17eba6 31 * It is also possible to use IO_CAPS_DISPLAY_ONLY to generate and show a pincode on the serial
bowenfeng 4:89f37a17eba6 32 * output.
bowenfeng 4:89f37a17eba6 33 */
bowenfeng 4:89f37a17eba6 34 #ifndef HID_SECURITY_IOCAPS
bowenfeng 4:89f37a17eba6 35 #define HID_SECURITY_IOCAPS (SecurityManager::IO_CAPS_NONE)
bowenfeng 4:89f37a17eba6 36 #endif
bowenfeng 4:89f37a17eba6 37
bowenfeng 4:89f37a17eba6 38 /**
bowenfeng 4:89f37a17eba6 39 * Security level. MITM disabled forces "Just Works". If you require MITM, HID_SECURITY_IOCAPS must
bowenfeng 4:89f37a17eba6 40 * be at least IO_CAPS_DISPLAY_ONLY.
bowenfeng 4:89f37a17eba6 41 */
bowenfeng 4:89f37a17eba6 42 #ifndef HID_SECURITY_REQUIRE_MITM
bowenfeng 4:89f37a17eba6 43 #define HID_SECURITY_REQUIRE_MITM false
bowenfeng 4:89f37a17eba6 44 #endif
bowenfeng 4:89f37a17eba6 45
bowenfeng 4:89f37a17eba6 46 /**
bowenfeng 4:89f37a17eba6 47 * Disable debug messages by setting NDEBUG
bowenfeng 4:89f37a17eba6 48 */
bowenfeng 4:89f37a17eba6 49 #ifndef NDEBUG
bowenfeng 4:89f37a17eba6 50 #define HID_DEBUG(...) printf(__VA_ARGS__)
bowenfeng 4:89f37a17eba6 51 #else
bowenfeng 4:89f37a17eba6 52 #define HID_DEBUG(...)
bowenfeng 4:89f37a17eba6 53 #endif
bowenfeng 4:89f37a17eba6 54
bowenfeng 4:89f37a17eba6 55 /**
bowenfeng 4:89f37a17eba6 56 * Initialize security manager: set callback functions and required security level
bowenfeng 4:89f37a17eba6 57 */
bowenfeng 4:89f37a17eba6 58 void initializeSecurity(BLE &ble);
bowenfeng 4:89f37a17eba6 59
bowenfeng 4:89f37a17eba6 60 /**
bowenfeng 4:89f37a17eba6 61 * - Initialize auxiliary services required by the HID-over-GATT Profile.
bowenfeng 4:89f37a17eba6 62 * - Initialize common Gap advertisement.
bowenfeng 4:89f37a17eba6 63 *
bowenfeng 4:89f37a17eba6 64 * Demos only have to set a custom device name and appearance, and their HID
bowenfeng 4:89f37a17eba6 65 * service.
bowenfeng 4:89f37a17eba6 66 */
bowenfeng 4:89f37a17eba6 67 void initializeHOGP(BLE &ble);
bowenfeng 4:89f37a17eba6 68
bowenfeng 4:89f37a17eba6 69 #endif /* !BLE_HID_COMMON_H_ */