AndroidのBLEラジコンプロポアプリ「BLEPropo」と接続し、RCサーボとDCモータを制御するプログラムです。 BLE Nanoで動作を確認しています。 BLEPropo → https://github.com/lipoyang/BLEPropo
BLEを使ったAndroid用ラジコンプロポアプリ「BLEPropo」に対応するBLE Nano用ファームウェアです。
BLEPropoは、GitHubにて公開中。
https://github.com/lipoyang/BLEPropo
ラジコンは、mbed HRM1017とRCサーボやDCモータを組み合わせて作ります。
回路図
/media/uploads/lipoyang/ministeer3.pdf
nRF51822/btle/btle_advertising.cpp@5:7f89fca19a9e, 2015-03-14 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
lipoyang | 5:7f89fca19a9e | 1 | /* mbed Microcontroller Library |
lipoyang | 5:7f89fca19a9e | 2 | * Copyright (c) 2006-2013 ARM Limited |
lipoyang | 5:7f89fca19a9e | 3 | * |
lipoyang | 5:7f89fca19a9e | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
lipoyang | 5:7f89fca19a9e | 5 | * you may not use this file except in compliance with the License. |
lipoyang | 5:7f89fca19a9e | 6 | * You may obtain a copy of the License at |
lipoyang | 5:7f89fca19a9e | 7 | * |
lipoyang | 5:7f89fca19a9e | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
lipoyang | 5:7f89fca19a9e | 9 | * |
lipoyang | 5:7f89fca19a9e | 10 | * Unless required by applicable law or agreed to in writing, software |
lipoyang | 5:7f89fca19a9e | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
lipoyang | 5:7f89fca19a9e | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
lipoyang | 5:7f89fca19a9e | 13 | * See the License for the specific language governing permissions and |
lipoyang | 5:7f89fca19a9e | 14 | * limitations under the License. |
lipoyang | 5:7f89fca19a9e | 15 | */ |
lipoyang | 5:7f89fca19a9e | 16 | #include "common/common.h" |
lipoyang | 5:7f89fca19a9e | 17 | |
lipoyang | 5:7f89fca19a9e | 18 | #include "ble_advdata.h" |
lipoyang | 5:7f89fca19a9e | 19 | #include "btle.h" |
lipoyang | 5:7f89fca19a9e | 20 | |
lipoyang | 5:7f89fca19a9e | 21 | /**************************************************************************/ |
lipoyang | 5:7f89fca19a9e | 22 | /*! |
lipoyang | 5:7f89fca19a9e | 23 | @brief Starts the advertising process |
lipoyang | 5:7f89fca19a9e | 24 | |
lipoyang | 5:7f89fca19a9e | 25 | @returns |
lipoyang | 5:7f89fca19a9e | 26 | */ |
lipoyang | 5:7f89fca19a9e | 27 | /**************************************************************************/ |
lipoyang | 5:7f89fca19a9e | 28 | error_t btle_advertising_start(void) |
lipoyang | 5:7f89fca19a9e | 29 | { |
lipoyang | 5:7f89fca19a9e | 30 | ble_gap_adv_params_t adv_para = {0}; |
lipoyang | 5:7f89fca19a9e | 31 | |
lipoyang | 5:7f89fca19a9e | 32 | /* Set the default advertising parameters */ |
lipoyang | 5:7f89fca19a9e | 33 | adv_para.type = BLE_GAP_ADV_TYPE_ADV_IND; |
lipoyang | 5:7f89fca19a9e | 34 | adv_para.p_peer_addr = NULL; /* Undirected advertising */ |
lipoyang | 5:7f89fca19a9e | 35 | adv_para.fp = BLE_GAP_ADV_FP_ANY; |
lipoyang | 5:7f89fca19a9e | 36 | adv_para.p_whitelist = NULL; |
lipoyang | 5:7f89fca19a9e | 37 | adv_para.interval = (CFG_GAP_ADV_INTERVAL_MS * 8) / 5; /* Advertising |
lipoyang | 5:7f89fca19a9e | 38 | * interval in |
lipoyang | 5:7f89fca19a9e | 39 | * units of 0.625 |
lipoyang | 5:7f89fca19a9e | 40 | * ms */ |
lipoyang | 5:7f89fca19a9e | 41 | adv_para.timeout = CFG_GAP_ADV_TIMEOUT_S; |
lipoyang | 5:7f89fca19a9e | 42 | |
lipoyang | 5:7f89fca19a9e | 43 | ASSERT_STATUS( sd_ble_gap_adv_start(&adv_para)); |
lipoyang | 5:7f89fca19a9e | 44 | |
lipoyang | 5:7f89fca19a9e | 45 | return ERROR_NONE; |
lipoyang | 5:7f89fca19a9e | 46 | } |