iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。
Dependencies: BLE_API_Native_IRC Servo mbed
Fork of BLE_RCBController by
- 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
- ライブラリ類はUpdateしないでください。コンパイルエラーになります。
うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。
BLE_API_Native_IRC/hw/nRF51822n/btle/btle_advertising.cpp@0:8c643bfe55b7, 2014-07-10 (annotated)
- Committer:
- jksoft
- Date:
- Thu Jul 10 14:21:52 2014 +0000
- Revision:
- 0:8c643bfe55b7
??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8c643bfe55b7 | 1 | /* mbed Microcontroller Library |
jksoft | 0:8c643bfe55b7 | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 0:8c643bfe55b7 | 3 | * |
jksoft | 0:8c643bfe55b7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 0:8c643bfe55b7 | 5 | * you may not use this file except in compliance with the License. |
jksoft | 0:8c643bfe55b7 | 6 | * You may obtain a copy of the License at |
jksoft | 0:8c643bfe55b7 | 7 | * |
jksoft | 0:8c643bfe55b7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 0:8c643bfe55b7 | 9 | * |
jksoft | 0:8c643bfe55b7 | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 0:8c643bfe55b7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 0:8c643bfe55b7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 0:8c643bfe55b7 | 13 | * See the License for the specific language governing permissions and |
jksoft | 0:8c643bfe55b7 | 14 | * limitations under the License. |
jksoft | 0:8c643bfe55b7 | 15 | */ |
jksoft | 0:8c643bfe55b7 | 16 | #include "common/common.h" |
jksoft | 0:8c643bfe55b7 | 17 | |
jksoft | 0:8c643bfe55b7 | 18 | #include "ble_advdata.h" |
jksoft | 0:8c643bfe55b7 | 19 | #include "btle.h" |
jksoft | 0:8c643bfe55b7 | 20 | |
jksoft | 0:8c643bfe55b7 | 21 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 22 | /*! |
jksoft | 0:8c643bfe55b7 | 23 | @brief Starts the advertising process |
jksoft | 0:8c643bfe55b7 | 24 | |
jksoft | 0:8c643bfe55b7 | 25 | @returns |
jksoft | 0:8c643bfe55b7 | 26 | */ |
jksoft | 0:8c643bfe55b7 | 27 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 28 | error_t btle_advertising_start(void) |
jksoft | 0:8c643bfe55b7 | 29 | { |
jksoft | 0:8c643bfe55b7 | 30 | ble_gap_adv_params_t adv_para = { 0 }; |
jksoft | 0:8c643bfe55b7 | 31 | |
jksoft | 0:8c643bfe55b7 | 32 | /* Set the default advertising parameters */ |
jksoft | 0:8c643bfe55b7 | 33 | adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND ; |
jksoft | 0:8c643bfe55b7 | 34 | adv_para.p_peer_addr = NULL ; /* Undirected advertising */ |
jksoft | 0:8c643bfe55b7 | 35 | adv_para.fp = BLE_GAP_ADV_FP_ANY ; |
jksoft | 0:8c643bfe55b7 | 36 | adv_para.p_whitelist = NULL ; |
jksoft | 0:8c643bfe55b7 | 37 | adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS*8)/5 ; /* Advertising interval in units of 0.625 ms */ |
jksoft | 0:8c643bfe55b7 | 38 | adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S ; |
jksoft | 0:8c643bfe55b7 | 39 | |
jksoft | 0:8c643bfe55b7 | 40 | ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para) ); |
jksoft | 0:8c643bfe55b7 | 41 | |
jksoft | 0:8c643bfe55b7 | 42 | return ERROR_NONE; |
jksoft | 0:8c643bfe55b7 | 43 | } |